什么是GeoJson?
GeoJSON是一种对各种地理数据结构进行编码的格式,基于json的地理空间信息数据交换格式。GeoJSON对象可以表示几何、特征或者特征集合,支持点、线、面、多点、多线、多面和几何集合。GeoJSON里的特征包含一个几何对象和其他属性,特征集合表示一系列特征。
GeoJson的构成
GeoJSON数据的构成如下,type为必须值,其包含如下类型:"Point/点", "MultiPoint/多点", "LineString/线", "MultiLineString/多线", "Polygon/面", "MultiPolygon/多面", "GeometryCollection", "Feature","FeatureCollection"
{
"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"
}
}
}
]
}