pyNMS icon indicating copy to clipboard operation
pyNMS copied to clipboard

Shapefiles issue

Open devnullNZ opened this issue 8 years ago • 4 comments

Start fails with shapefile error - File "/usr/local/lib/python3.5/dist-packages/shapefile.py", line 291, in load raise ShapefileException("Unable to open %s.dbf or %s.shp." % (shapeName, shapeName) ) shapefile.ShapefileException: Unable to open /home/e069390/Projects/pyNMS/Shapefiles/World countries (low resolution).dbf or /home/e069390/Projects/pyNMS/Shapefiles/World countries (low resolution).shp

Shapefiles dir contains no .dbf files, only .shp

Edited pyNMS/views/geographical_view.py to use a different shapefile set & it works fine, so definitely an issue with either missing or corrupt files

devnullNZ avatar Sep 19 '17 02:09 devnullNZ

Well that's strange, /pyNMS/Shapefiles does contain a 'World countries (low resolution).shp' file. (.dbf files are not needed, only .shp) I only have windows right now, and I see you're using linux, that may be the reason why. I'll test on linux and try to fix it. Thanks for reporting the bug !

afourmy avatar Sep 19 '17 03:09 afourmy

Renamed file & tested importing directly. Looks like the .shp file is the issue:

import shapefile sf = shapefile.Reader("./wc_lowres.shp") Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/shapefile.py", line 237, in init self.load(args[0]) File "/usr/local/lib/python3.5/dist-packages/shapefile.py", line 291, in load raise ShapefileException("Unable to open %s.dbf or %s.shp." % (shapeName, shapeName) ) shapefile.ShapefileException: Unable to open ./wc_lowres.dbf or ./wc_lowres.shp.

devnullNZ avatar Sep 19 '17 03:09 devnullNZ

I see, thank you. I will try to reproduce it. In the meantime, I will deactivate the display of a map by default, so that it does not prevent pyNMS from running (and pyshp, shapely and pyproj will no longer be compulsory, which is also a good thing).

afourmy avatar Sep 19 '17 03:09 afourmy

The 'World countries (low resolution).shp' shapefile is no longer imported at running time. A new entry was added to the toolbar (globe icon) for the user to import shapefiles. pyshp and shapely are no longer mandatory to run pyNMS, only pyproj is, as the geographical system (display of nodes at their GPS coordinates) remains active. This should fix the problem for now, until I have a unix system to reproduce the bug as I suspect this might have something to do with the way filepaths are handled on unix.

afourmy avatar Sep 19 '17 12:09 afourmy