• GeoJSON 是一种用于表达地理数据的 JSON,即是 JSON 的一种特定形式。
    • GeoJSON 定义了七种几何类型来表达地理要素,分别是(大小写敏感)
      • Point
      • MultiPoint
      • LineString
      • MultiLineString
      • Polygon
      • MultiPolygon
      • GeometryCollection

    可以参考 geojson.io 来动态生成 GeoJSON。

    GeoJSON 总体就是地理几何数据的集合,每一个几何数据就是一个 Feature,一个 GeoJSON 就是一个 FeatureCollection。例如下边就是一个 GeoJSON 的样例:
    image.png

    1. {
    2. "type": "FeatureCollection",
    3. "features": [
    4. {
    5. "type": "Feature",
    6. "properties": {},
    7. "geometry": {
    8. "type": "Polygon",
    9. "coordinates": [
    10. [
    11. [
    12. 113.983154296875,
    13. 22.507482299898438
    14. ],
    15. [
    16. 114.488525390625,
    17. 22.507482299898438
    18. ],
    19. [
    20. 114.488525390625,
    21. 22.659640758754797
    22. ],
    23. [
    24. 113.983154296875,
    25. 22.659640758754797
    26. ],
    27. [
    28. 113.983154296875,
    29. 22.507482299898438
    30. ]
    31. ]
    32. ]
    33. }
    34. },
    35. {
    36. "type": "Feature",
    37. "properties": {},
    38. "geometry": {
    39. "type": "Point",
    40. "coordinates": [
    41. 113.26904296874999,
    42. 23.150462029224087
    43. ]
    44. }
    45. },
    46. {
    47. "type": "Feature",
    48. "properties": {},
    49. "geometry": {
    50. "type": "LineString",
    51. "coordinates": [
    52. [
    53. 113.65905761718749,
    54. 23.054461926693815
    55. ],
    56. [
    57. 113.84033203125,
    58. 23.024131861805987
    59. ],
    60. [
    61. 113.9556884765625,
    62. 23.049407390110577
    63. ]
    64. ]
    65. }
    66. },
    67. {
    68. "type": "Feature",
    69. "properties": {},
    70. "geometry": {
    71. "type": "Polygon",
    72. "coordinates": [
    73. [
    74. [
    75. 113.7249755859375,
    76. 22.867317960075614
    77. ],
    78. [
    79. 113.851318359375,
    80. 22.786310789104277
    81. ],
    82. [
    83. 113.97216796875,
    84. 22.85213278864118
    85. ],
    86. [
    87. 113.9337158203125,
    88. 22.948276856880895
    89. ],
    90. [
    91. 113.7249755859375,
    92. 22.867317960075614
    93. ]
    94. ]
    95. ]
    96. }
    97. }
    98. ]
    99. }