geojson轉shp

第一種方式:

https://mapshaper.org/

直接導入geojson ,最後導出shp 但導出的shp中 字段中有中文值得亂碼

 

第二種方式:將GeoJSON 轉換爲EsriJSON,通過ArcMap中工具JSONToFeatures將JSON轉換爲shp

第一步:將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
        }
    ]

第二步:將geojson中的屬性“coordinates”替換爲“rings”

第三步:將geojson中的屬性“properties”替換爲“attributes”

第四步:將geojson轉換爲EsriJSON後,用notepad++打開,啓用ANSI編碼

 

第五步:使用ArcMap(10.2及以上版本)中工具JSONToFeatures

 

點擊JSONToFeatures彈出窗口,選中你處理好的json,選擇保存位置,點擊ok即可

 

最後結果如下(結果集可以右鍵導出爲shp):

 

PS:

1、以下一個標準的EsriJSON

{
    "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
        }
    ],
    "features": [
        {
            "attributes": {
                "FID": 1,
                "UserID": 0,
                "height": 26,
                "id": 1,
                "name": "東方銀座"
            },
            "geometry": {
                "rings": [
                    [
                        [
                            116.4296391258555,
                            39.938547050529
                        ],
                        [
                            116.4296390613181,
                            39.93892545530012
                        ],
                        [
                            116.4293486753082,
                            39.93892492181583
                        ],
                        [
                            116.4293486823351,
                            39.93888379087441
                        ],
                        [
                            116.4292196218916,
                            39.93888355377568
                        ],
                        [
                            116.4289830420634,
                            39.93870214301881
                        ],
                        [
                            116.4289830575557,
                            39.93861165498078
                        ],
                        [
                            116.4289292823856,
                            39.93861155620433
                        ],
                        [
                            116.4289293232417,
                            39.93837299684417
                        ],
                        [
                            116.4293810317527,
                            39.93839027883599
                        ],
                        [
                            116.42938106126,
                            39.93821752887639
                        ],
                        [
                            116.4289293500095,
                            39.93821669933233
                        ],
                        [
                            116.4289293598713,
                            39.93815911603849
                        ],
                        [
                            116.4287142592885,
                            39.93815872103016
                        ],
                        [
                            116.4287141549038,
                            39.93876745857678
                        ],
                        [
                            116.428778685118,
                            39.93876757711857
                        ],
                        [
                            116.4287786752475,
                            39.93882516040372
                        ],
                        [
                            116.4288754705743,
                            39.93882533822202
                        ],
                        [
                            116.4288969778287,
                            39.93884183010633
                        ],
                        [
                            116.4288539506355,
                            39.93888288199632
                        ],
                        [
                            116.4289614869192,
                            39.9389653414294
                        ],
                        [
                            116.4290045141116,
                            39.93892428953856
                        ],
                        [
                            116.4290260199623,
                            39.93894900761276
                        ],
                        [
                            116.429026008698,
                            39.93901481709778
                        ],
                        [
                            116.4291012939665,
                            39.93901495541522
                        ],
                        [
                            116.4291012855221,
                            39.93906431253271
                        ],
                        [
                            116.4293809165335,
                            39.93906482629721
                        ],
                        [
                            116.4293808954568,
                            39.93918821912546
                        ],
                        [
                            116.4296390164226,
                            39.93918869340175
                        ],
                        [
                            116.4296390374674,
                            39.93906530054161
                        ],
                        [
                            116.4298971584015,
                            39.93906577478625
                        ],
                        [
                            116.4298971864187,
                            39.93890125093023
                        ],
                        [
                            116.4298219011586,
                            39.93890111262125
                        ],
                        [
                            116.4298219614223,
                            39.93854738635743
                        ],
                        [
                            116.4296391258555,
                            39.938547050529
                        ]
                    ]
                ]
            }
        }
    ]
}

2、北京奧林匹克體育場geojson

 

 

詳細內容請查看我的微信公衆號:

後續小編的主要精力放到GIS理論開發知識的大衆化的道路了,通過淺顯易懂的語言,結合多年行業應用開發,通過微信訂閱號傳播(每週更新三篇文章及相關GIS編碼知識),爲GIS的發展盡微博之力。終極目標是讓GIS不再專業,讓GIS更加大衆,使得GIS深入各行業應用,讓每位GISER都有一股自豪感!以下是我的微信訂閱號二維碼,感興趣的可以交流溝通!

一位更懂IT的GISER,一位更懂GIS的IT
 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章