3

I have a python code which converts JSON text file to a shapefile. I have to set coordinate system to this shapefile created. I do not want to access the .prj file from my computer as this code will be embedded in a web toolbox.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked May 31, 2012 at 22:16
1
  • 1
    What is your GIS software platform? Commented May 31, 2012 at 23:22

2 Answers 2

2

There's a Python code example for doing this under Define Projection.

answered May 31, 2012 at 22:33
3
  • @PolyGeo.. ya I used that. It worked , I wanted that only. Thanks Commented May 31, 2012 at 23:29
  • 1
    How did we know he.she was on the ESRI platform? Is it safe to assume that all new posters who don't specify their platform are using ESRI?...curious... Commented Jun 1, 2012 at 2:30
  • It sounded like ArcGIS/ArcPy and I had answer at fingertips so did not take time to be certain. Commented Jun 1, 2012 at 4:45
1

There is no way to set a shapefile's coordinate system without the .prj file. Without knowing your platform it's hard to provide advice. You mention a 'web toolbox' and python. If you know the input coordinate system of your JSON text file(which I'm betting is WGS84 lat/lon). You could build a generic .prj file on the fly to kick back to the user to accompany the generated shapefile.

Something like:

body='GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984"'
body+=',SPHEROID["WGS_1984",6378137.0,298.257223563]]'
body+=',PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'
fout=open("c:/whereverIamstagingmyshapefileoutput/myprj.prj","w")
fout.write(body)
fout.close()
answered May 31, 2012 at 22:30

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.