- GeoJSON 是一种用于表达地理数据的 JSON,即是 JSON 的一种特定形式。
- GeoJSON 定义了七种几何类型来表达地理要素,分别是(大小写敏感)
- Point
- MultiPoint
- LineString
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection
可以参考 geojson.io 来动态生成 GeoJSON。
GeoJSON 总体就是地理几何数据的集合,每一个几何数据就是一个 Feature,一个 GeoJSON 就是一个 FeatureCollection。例如下边就是一个 GeoJSON 的样例:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
113.983154296875,
22.507482299898438
],
[
114.488525390625,
22.507482299898438
],
[
114.488525390625,
22.659640758754797
],
[
113.983154296875,
22.659640758754797
],
[
113.983154296875,
22.507482299898438
]
]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
113.26904296874999,
23.150462029224087
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
113.65905761718749,
23.054461926693815
],
[
113.84033203125,
23.024131861805987
],
[
113.9556884765625,
23.049407390110577
]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
113.7249755859375,
22.867317960075614
],
[
113.851318359375,
22.786310789104277
],
[
113.97216796875,
22.85213278864118
],
[
113.9337158203125,
22.948276856880895
],
[
113.7249755859375,
22.867317960075614
]
]
]
}
}
]
}