GeoJSON_README
文章目录
GeoJSON
1 引子
GeoJSON 是用 JSON 的语法表达和存储地理数据,可以说是 JSON 的子集。
图片数据参考:http://geojson.io
- 下面是一个点数据。
{
"type": "FeatureCollection",
"features": [
{
"type":"Feature",
"properties":{
},
"geometry":{
"type":"Point",
"coordinates":[105.380859375,31.57853542647338]
}
}
]
}
2 基本要素
地理要素分为
Point(点)
、MultiPoint(多点)
、LineString(线)
、MultiLineString(多线)
、Polygon(面)
、MultiPolygon(多面)
、GeometryCollection(几何集合)
。
这些地理要素被规划到
geometry
特征的type
属性下。
并且不同的
type
会有不同的coordinates
值。
"geometry":{
"type":"Point",
"coordinates":[105.380859375,31.57853542647338]
}
- Point(点)
点要素是最简单的,类型
type
对应Point
,然后坐标是一个1维
的数组,里面有两个元素(如果是立体的坐标就是三维x,y,z),分别为经度和纬度。
coordinates
的值是一个点。
"geometry":{
"type":"Point",
"coordinates":[105.380859375,31.57853542647338]
}
- MultiPoint(多点)
多点,坐标数目变多。
coordinates
的值是多个点。
"geometry":{
"type":"MultiPoint",
"coordinates":[[105.380859375,31.57853542647338],
[105.580859375,31.52853542647338]
]
}
- LineString(线)
线要素就是指线段,记录的是线的端点坐标,可视化时会按照记录
顺序联结
。
对于曲线(如贝塞尔曲线
)目前还没有很好的表达,但是在地理数据中,曲线一般会用LineString
去拟合,现实地理世界中也没有标准的曲线地理要素。线要素的坐标
coordinates
里的二维数组和多点要素
基本一样,区别就在type
上了。
coordinates
的值是多个点,类似MultiPoint(多点)
。
"geometry"