JavaScript Object Notation是一种对各种地理数据结构进行编码的格式。GeoJSON对象可以表示几何、特征或者特征集合。
GeoJSON支持下面几何类型:点、线、面、多点、多线、多面和几何集合。即:Point, MultiPoint, LineString, MultiLineString,? Polygon, MultiPolygon, GeometryCollection。
首先是将这些要素封装到单个的geometry里,然后作为一个个的Feature(也就是要素);要素放到一个要素集合里,从树状结构来理解FeatureCollection就是根节点
GeoJSON模板
{
??"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":?"MultiLineString",
????????"coordinates":?[
??????????[?[100.0,?0.0],?[101.0,?1.0]?],
??????????[?[102.0,?2.0],?[103.0,?3.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"}
??????}
????},
????{
??????"type":?"Feature",
??????"geometry":?{?
????????"type":?"MultiPolygon",
????????"coordinates":?[
??????????[[[102.0,?2.0],?[103.0,?2.0],?[103.0,?3.0],?[102.0,?3.0],?[102.0,?2.0]]],
??????????[[[100.0,?0.0],?[101.0,?0.0],?[101.0,?1.0],?[100.0,?1.0],?[100.0,?0.0]],
????????????[[100.2,?0.2],?[100.8,?0.2],?[100.8,?0.8],?[100.2,?0.8],?[100.2,?0.2]]]
????????]
??????},
??????"properties":?{
????????"prop0":?"value0",
????????"prop1":?{"this":?"that"}
??????}
????},
????{
??????"type":?"Feature",
??????"geometry":
??????{?"type":?"GeometryCollection",
????????"geometries":?[
??????????{?"type":?"Point",
????????????"coordinates":?[100.0,?0.0]
??????????},
??????????{?"type":?"LineString",
????????????"coordinates":?[?[101.0,?0.0],?[102.0,?1.0]?]
??????????}
????????]
??????},
??????"properties":?{
????????"prop0":?"value0",
????????"prop1":?{"this":?"that"}
??????}
????}
??]
}
所有地理要素放在features的列表里。
默认的CRS是地理坐标参考系统,使用的是WGS84数据,长度和高度的单位是十进制标示。
"crs":?{
??"type":?"name",
??"properties":?{
????"name":?"urn:ogc:def:crs:OGC:1.3:CRS84"
????}
??}
bbox成员的值必须是2*n数组,这儿n是所包含几何对象的维数,并且所有坐标轴的最低值后面跟着最高者值。bbox的坐标轴的顺序遵循几何坐标轴的顺序。除此之外,bbox的坐标参考系统假设匹配它所在GeoJSON对象的坐标参考系统。
{?"type":?"Feature",
??"bbox":?[-180.0,?-90.0,?180.0,?90.0],
??"geometry":?{
????"type":?"Polygon",
????"coordinates":?[[
??????[-180.0,?10.0],?[20.0,?90.0],?[180.0,?-5.0],?[-30.0,?-90.0]
??????]]
????}
??...
??}
参考文章:
GeoJSON格式规范说明 https://blog.csdn.net/qq_36944793/article/details/79666619
GEOJSON标准格式学习 https://www.jianshu.com/p/852d7ad081b3
GeoJSON格式规范说明 https://www.oschina.net/translate/geojson-spec?cmp
转载本站文章《从GeoJSON模板速记GeoJSON规范》, 请注明出处:https://www.zhoulujun.cn/html/GIS/GIS-Science/2476.html
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。