Select to view content in your preferred language

arcpy script to convert shapefile to Json format

1441
4
01-20-2013 05:10 AM
AmmarAssem1
Emerging Contributor
i need arcpy script to use it when creating Geoprocessing task.
0 Kudos
4 Replies
AnthonyGiles
Honored Contributor
Ammar,

There is a script on ths page that takes the json produced in flex and converts it to shapefiles, I have used it and it works. Maybe of some use:

http://forums.arcgis.com/threads/33618-FAO-Robert-Scheitlin-or-anyone-who-knows-about-saved-graphics...

Also there is a script here to convert feature class to JSON:

http://arcscripts.esri.com/details.asp?dbid=15545

Regards

Anthony
0 Kudos
AmmarAssem1
Emerging Contributor
Hi Anthon,

Thanks for reply, I downloaded (convert feature class to JSON Script) and try to run it but this error occurred

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'write'
Failed to execute (FeatureClassToGeoJSON).

I follow steps in ReadMe textfile but noway.

I gooogle this error but I cannot find any solution

Best wishes
0 Kudos
nicogis
MVP Alum
you can also use Generate operation serializing shapefile to json (esri)
see http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/portal_addshapefile
0 Kudos
AmmarAssem1
Emerging Contributor
Hi Ciava,

I know this way but the problem the user upload cadfile, then display cad file into map but the are are two problems

1- this example only for shape file and user need to upload cad not shape file and this shape file shoud be in define format
zip file.

2-Cad file that user upload it may be not have coordinate system so I create geoprocessing task to set coordinate to cad file and i wish to convert cad file to json to display it into map.

Thanks and best wished.
0 Kudos