Load GeoJSON in ArcMap

buat yang ngga mau pake QGIS … eh?

Architecture and Planning

It came up on Twitter that you cannot edit GeoJSON in ArcMap. That gave me the idea to try and write a plugin that allows just that. This post will layout a procedure for editing GeoJSON in ArcMap. The final code solution needs work, but it is a good start.

Reading GeoJSON in ArcMap

I grabbed a text file from my Github and saved it to my desktop. This is not the best example, but it was good enough to test the process. I started by reading the file in to ArcMap. The code reads in the file and converts it to JSON. It then iterates through the features, grabbing the coordinates and putting them in to an array.  Lastly, it writes it to a default geodatabase.

import arcpy
from arcpy import env
import json
d=open(r”C:UserspaulDesktopart.geojson”)
data=json.load(d)
points=[]
i=0
for x in data[“features”]:
points.append(arcpy.PointGeometry(arcpy.Point(data[“features”][i][1],data[“features”][i][0])))
i=i+1
arcpy.CopyFeatures_management(points,”testlayer13″)

You will have a map like…

Lihat pos aslinya 138 kata lagi

Iklan