matplotlib / matplotlib/basemap

readshapefile() raises incorrect error msg regarding shpproj and shapelib

Open
#285 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the readshapefile() entry point and inspect the error path that recommends shpproj from shapelib. Reproduce the reported conversion and the subsequent “only handle 2D shape types” failure, then determine whether the guidance or the handling is incorrect. Done means the error message and conversion guidance accurately reflect available tools and supported shape types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.