geojson

 

Geographic JSON 简称GeoJson,是一种使用json格式的地理信息数据结构。

1
2
3
4
5
6
7
8
9
10
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}

GeoJson支持的地理信息格式有Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon

有额外属性的地理信息主体(Geometric objects)称为Feature,Feature集合称为FeatureCollection。

上述例子中,为Point Feature,经纬度坐标为125.6,10.1,有一个name属性,该Point的name为”Dinagat Islands”。

A GeoJSON FeatureCollection:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
   {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [102.0, 0.5]
},
"properties": {
"prop0": "value0"
}
}, {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[102.0, 0.0],
[103.0, 1.0],
[104.0, 0.0],
[105.0, 1.0]
]
},
"properties": {
"prop0": "value0",
"prop1": 0.0
}
}, {
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[100.0, 0.0],
[101.0, 0.0],
[101.0, 1.0],
[100.0, 1.0],
[100.0, 0.0]
]
]
},
"properties": {
"prop0": "value0",
"prop1": {
"this": "that"
}
}
}]
}

更多详细的信息可以参考The GeoJSON Specification (RFC 7946)