0

I want to transform a GeoJSON file in .txt format into shapefile, but I don't know how. The geometry of these is points.

According to the help for desktop.arcgis, the syntax is as follows:

import arcpy
geojson_point = {"type": "Point", "coordinates": [5.0, 5.0]}
point = arcpy.AsShape (geojson_point)

But the question arises in which way I tell the program where the file is on my C: drive?

Could you give me an example of a syntax of how to do it?

2
  • you might want to check that code.... according to the doco pro.arcgis.com/en/pro-app/latest/arcpy/functions/asshape.htm the code you have quoted will simply convert GeoJSON geometry to ArcPy geometry. Nothing to do with Shapefiles.
    – nr_aus
    Commented Jul 12, 2021 at 1:16
  • 1
    You're working with the raw Geometry type, not file-oriented dataset translation tools like arcpy.conversion.JSONToFeatures
    – Vince
    Commented Jul 12, 2021 at 1:18

2 Answers 2

2

You can use the JSON to Features tool:

arcpy.JSONToFeatures_conversion(in_geojson, out_shapefile)
0

As per my comment above, your code example is not related to file conversion. Try reading the following Converting GeoJSON to Shapefile

There are some further links in that article as well.

2
  • 1
    Whilst this may answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Also, the accepted answer in your link does not use libraries available by default in the Esri ArcGIS (Pro or Desktop) python environment.
    – user2856
    Commented Jul 12, 2021 at 3:23
  • yer fair enough. its a bit a bodge question anyways given the code example given, perhaps if OP rehashes his question, we can make your above answer the accepted answer.
    – nr_aus
    Commented Jul 12, 2021 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.