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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
MrShaggy87
  • 303
  • 1
  • 8
  • you might want to check that code.... according to the doco https://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 Jul 12 '21 at 01:16
  • 1
    You're working with the raw Geometry type, not file-oriented dataset translation tools like arcpy.conversion.JSONToFeatures – Vince Jul 12 '21 at 01:18

2 Answers2

2

You can use the JSON to Features tool:

arcpy.JSONToFeatures_conversion(in_geojson, out_shapefile)
user2856
  • 65,736
  • 6
  • 115
  • 196
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.

nr_aus
  • 3,535
  • 6
  • 26
  • 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 Jul 12 '21 at 03: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 Jul 12 '21 at 04:49