一、GeoJSON 概述
GeoJSON 是一种对各种地理数据结构进行编码的格式,基于 JSON
二、GeoJSON 格式
- 一个典型的 GeoJSON 数据块如下
最外层是一个 FeatureCollection,即,要素集合
geometry:描述在哪儿、长啥样,即,是点、线还是面
properties:描述是什么,即,名字、地址、长度等额外属性
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [116.40, 39.90]
},
"properties": {
"name": "故宫博物院",
"address": "北京市…"
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[116.40, 39.90], [116.50, 39.95]]
},
"properties": {
"name": "景山前街",
"width": 20
}
}
]
}
三、GeoJSON 类型
{ "type": "Point", "coordinates": [116.40, 39.90] }
{ "type": "LineString", "coordinates": [[116.40, 39.90], [116.41, 39.91], [116.42, 39.92]] }
{ "type": "Polygon", "coordinates": [ [ [116.40, 39.90], [116.41, 39.91], [116.42, 39.90], [116.40, 39.90] ] ] }
{
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [
[105.380859375,31.57853542647338],
[105.580859375,31.52853542647338]
]
}
}
{
"geometry":{
"type":"LineString",
"coordinates":[
[
[105.6005859375,30.65681556429287],
[107.95166015624999,31.98944183792288],
[109.3798828125,30.031055426540206],
[107.7978515625,29.935895213372444]
],
[
[109.3798828125,30.031055426540206],
[107.1978515625,31.235895213372444]
]
]
}
}
{
"geometry": {
"type": "MultiPolygon",
"coordinates":[
[
[
[109.2041015625,30.088107753367257],
[115.02685546875,30.088107753367257],
[115.02685546875,32.7872745269555],
[109.2041015625,32.7872745269555],
[109.2041015625,30.088107753367257]
]
],
[
[
[112.9833984375,26.82407078047018],
[116.69677734375,26.82407078047018],
[116.69677734375,29.036960648558267],
[112.9833984375,29.036960648558267],
[112.9833984375,26.82407078047018]
]
]
]
}
}



