Skip to content

readshapefile() raises incorrect error msg regarding shpproj and shapelib #285

@pwgerman

Description

@pwgerman

When plotting a shapefile using readshapefile()

m.readshapefile(shapefile_path, 'roads')

I received this error message:

ValueError: shapefile must have lat/lon vertices - it looks like this one has vertices in map projection coordinates. You can convert the shapefile to geographic coordinates using the shpproj utility from the shapelib tools (http://shapelib.maptools.org/shapelib-tools.html)

However, it appears that the specified module "shapelib" is no longer maintained or available. To add to the confusion, there is a completely different module that also goes by the name "shapelib" available on pypi and github, but that does not contain the functionality suggested above.

In regard to a suggested solution. I found the fix on this site to be useful for converting the shapefile and getting past this readshapefile() error.
http://fascicul.us/convert-display-shapefile-matplotlib.html

However, this conversion sometimes leads to a new error:

ValueError: readshapefile can only handle 2D shape types

Which I have yet to find a way to resolve

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions