Quick Overview of the Project: I have 9000 records of individuals, each with a coordinate pair in a csv. I also have a shapefile/folder(dbf, prj, sbn, sbx, shp, shx) of municipalities within the range of coordinates. I'd like to know which municipality(shape) in the shapefile corresponds to each record in the csv

Problem: When I look at the shapefile in python, the grid isn't lat/long. I subscribed to a trial version of arcGIS to be able to load up the coordinates and look at them, and they map correctly, so I must just be missing something. Attached is my code and the map printed by Python.

How can I transpose my csv coordinates to the map or vice versa?

import shapefile as shp
import matplotlib.pyplot as plt
from shapely.geometry import Point

import csv

n = 0
m = 1

coorDict = {}
coor = ''
fileName = 'TestLatLong'

sf = shp.Reader("wcmun/wcmun")
sfRec = sf.records()
for shape in sf.shapeRecords():
    x = [i[0] for i in shape.shape.points[:]]
    y = [i[1] for i in shape.shape.points[:]]

n = 0    
#Then create a dictionary of lat/longs from 'TestLatLong.csv'

WestchesterCounty The output of all shape records and data in the first shape record above For comparison, all the data should be roughly in a rectangle from (40.881321, -73.926644) to (41.442483, -73.542874), and as you can see this map isn't.


According to the metadata the boundary shapefile is in New York State Plane East (NAD_1983_StatePlane_New_York_East_FIPS_3101_Feet).

You can use the Project tool in ArcMap to make a new shapefile in WGS 84 Lat/Lon to match your points. This PDF walks you through the process.

  • This did it, thanks so much- I don't know which coordinate system to use (there are many different options under WGS 84) would you happen to know which one is correct? The one I tried (WGS 84 Web Mercator) is a bit off, otherwise I can just play around until I find the correct one. Thank you so much though – Martin Goni Aug 3 '17 at 21:56
  • 1
    It's just "WGS 84". It's under Geographic Coordinate Systems > World > WGS 84. Or search for "4326", its EPSG code. – Marc Pfister Aug 3 '17 at 22:01
  • You're right I was looking in the wrong spot, thanks so much- this was massively helpful – Martin Goni Aug 4 '17 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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