GeoJSON
参考链接:https://www.jianshu.com/p/852d7ad081b3
GeoJSON is a format for encoding a variety of geographic data structures.
格式
{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } }
geometry types:Point
, LineString
,Polygon
,MultiPoint
,MultiLineString
,MultiPolygon和
GeometryCollection
Future集合使用FeatureCollection对象包含
{ "type": "FeatureCollection", "features": [ {
"type":"Feature", "properties":{}, "geometry":{ "type":"Point", "coordinates":[105.38085,31.57853] } } ] }
Point 对应的坐标是一维数组,里面是两个元素,如果是立体的坐标就是三维x,y,z;
{ "type":"Feature", "properties":{}, "geometry":{ "type":"Point", "coordinates":[105.380859375,31.57853542647338] } }
MultiPoint
{ "type":"Feature", "properties":{}, "geometry":{ "type":"MultiPoint", "coordinates":[ [105.380859375,31.57853542647338], [105.580859375,31.52853542647338] ] } }
LineString 线要素就是指线段,记录的是线的端点坐标,可视化时会按照记录顺序联结。对于曲线(如贝塞尔曲线)目前还没有很好的表达,但是在地理数据中,曲线一般会用LineString去拟合
{ "type":"Feature", "properties":{}, "geometry":{ "type":"LineString", "coordinates":[ [105.6005859375,30.65681556429287], [107.95166015624999,31.98944183792288], [109.3798828125,30.031055426540206], [107.7978515625,29.935895213372444] ] } }
MultiLineString
{ "type":"Feature", "properties":{}, "geometry":{ "type":"MultiLineString", "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] ] ] } }
多边形Polygon
注:单个多边形是一个3维数组,可以包含多个二维数组,这种情况和MultiPolygon效果很像。
{ "type":"Feature", "properties":{}, "geometry":{ "type":"Polygon", "coordinates":[ [ [106.10595703125,33.33970700424026], [106.32568359375,32.41706632846282], [108.03955078125,32.2313896627376], [108.25927734375,33.15594830078649], [106.10595703125,33.33970700424026] ] ] } }
多多边形MultiPolygon
type 1 两个不会相交的多边形
type 2 两个镶套的多边形
type 3 有孔洞的多边形
[ [ [ [109.20410,30.088107], [115.02685,30.08810], [115.02685,32.78727], [109.20410,32.78727], [109.20410,30.08810] ] ], [ [ [112.98339,26.82407], [116.69677,26.82407], [116.69677,29.03696], [112.98339,29.03696], [112.98339,26.82407] ] ] ]
GeometryCollection 是多种基本地理要素的集合,就是里面可以包含点、线、面要素
{ "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [108.62, 31.02819] }, { "type": "LineString", "coordinates": [
[108.89648,30.10711], [108.218437,30.91717], [109.518437,31.217578]
] }
] }
GeometryCollection不需要放在FeatureCollection里
geojson自定义生成工具:http://geojson.io/#map=4/38.89/104.70
datav的中国省市边界下载页:http://datav.aliyun.com/tools/atlas/#&lat=30.37018632615852&lng=106.68898666525287&zoom=3.5
echarts边界下载页:https://hxkj.vip/demo/echartsMap/