4

I want to read a shapefile using pyshp:

sf = shapefile.Reader(('/tmp/India_PCs_Boundary_4_2_19/India_PCs_Boundary.shp'))

but when I look at the result, the polygons look all squishy and distorted; they're supposed to exactly cover India, but they don't.

One theory for what might have happened is that I did not read the .prj file correctly, and the .prj file contained some sort of projection data that would un-distort the polygons.

When I read the pyshp documentation, it says:

You specify the base filename of the shapefile or the complete filename of any of the shapefile component files.... OR any of the other 5+ formats which are potentially part of a shapefile. The library does not care about file extensions.

But it does not mention .prj specifically.

Does pyshp, by default, read .prj files correctly? If not, is there a way to get it to do so?

Dan B
  • 41
  • 2

1 Answers1

2

PyShp does not handle projections. You can use pyproj for that. What are you using to visualize the shapefile? If the data is in a geographic coordinate system, it won't appear in the cartesian format that you are expecting.

DJH
  • 69
  • 5