这里提供两种geojson转shp的方法,一种是直接使用在线工具转换,方便快捷,另一种是使用ArcGIS来进行转换,下面对两种方法分别介绍:
1. 在线工具
网址:https://mapshaper.org/
直接将geojson文件拖进来,然后选择【export】,选择想要转出的文件类型,这里可以选择【shapefile】,导出时可以自己选择导出路径或者默认导出路径,导出完成后在ArcGIS中打开即可使用,转换起来很方便快捷。
2. 在ArcGIS中转换
将GeoJSON 转换为EsriJSON,通过ArcMap中工具JSONToFeatures将JSON转换为shp
(1)将EsriJSON的头替换GeoJSON 的 “type”: “FeatureCollection”,即用以下代码,替换 “type”: “FeatureCollection”
"displayFieldName": "", "fieldAliases": { "FID": "FID", "UserID": "UserID", "height": "height", "id": "id", "name": "name" }, "geometryType": "esriGeometryPolygon", "spatialReference": { "wkt": "GEOGCS["WGS84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["degree",0.0174532925199433]]" }, "fields": [ { "name": "FID", "type": "esriFieldTypeOID", "alias": "FID" }, { "name": "UserID", "type": "esriFieldTypeSmallInteger", "alias": "UserID" }, { "name": "height", "type": "esriFieldTypeSmallInteger", "alias": "height" }, { "name": "id", "type": "esriFieldTypeSmallInteger", "alias": "id" }, { "name": "name", "type": "esriFieldTypeString", "alias": "name", "length": 78 } ]
(2)将geojson中的属性“coordinates”替换为“rings”
(3)将geojson中的属性“properties”替换为“attributes”
(4)将geojson转换为EsriJSON后,用notepad++打开,启用ANSI编码
(5)使用ArcMap(10.2及以上版本)中工具JSONToFeatures
点击JSONToFeatures弹出窗口,选中你处理好的json,选择保存位置,点击确定即可。