What I have is a list of coordinates (lat,long) and I need to create a shapefile with all of them as points. I am using pyshp to do so, and everything runs smoothly until I upload my file. Every point will appear in some unrelated place, such as the Pacific ocean.
For these files, I just copied an existing prj file I found on Manitoba's website (the same area my points will be in), but after looking at the files that the original prj file came with, the numbers aren't similar.
Their point: [365100.81763949705, 5436444.752255431]
My point: [49.0304527, -95.7514267]
I am wondering what I have to do to make my points show up in the correct location. Do I need to change the prj file? If so, how would I go about doing so?
Solved! Go to Solution.
You are using WGS coordinates and should make sure your .prj is reflective of such. This is one of those times that you could actually use define projection! Since you don't seem to have access to the app, I would recommend just opening the prj in a text editor and overwriting with this:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
You are using WGS coordinates and should make sure your .prj is reflective of such. This is one of those times that you could actually use define projection! Since you don't seem to have access to the app, I would recommend just opening the prj in a text editor and overwriting with this:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
I did that, and now when I try to upload my files I get this error:
Unable to import this shapefile. (The operation was attempted on an empty geometry.)
Can you go over exactly how you created the shapefile using pyshp? How many file components do you have for your shapefile (.prj, .dbf, .shp, .shx, etc.)? Do you have access to ArcGIS? If not, can you install QGIS (free/open source) and follow the instructions here? Importing Spreadsheets or CSV files — QGIS Tutorials and Tips
If you have ArcGIS, have a look at Rebecca's post - I assumed you didn't since you were using pyshp.
It's fixed! Thanks Chris.
Take a look at this help topic Make XY Event Layer—Help | ArcGIS for Desktop
the python syntax is
MakeXYEventLayer_management (table, in_x_field, in_y_field, out_layer, {spatial_reference}, {in_z_field})
And the Spatial_reference refers to the coordinates of you XY coordinates, not what you want them to be. You can also do this thru the toolbox. Make sure to choose the correct coordinate system for the input.
Also remember, that an Event table is not permanent, so you will want to save it as a shape of feature-class. If you want, you can use the projection tool from the Event table in geographic coordinates to a new projection, like the projection used by Manitoba.