Skip to content

Commit

Permalink
Raise ValueError and ImportError in shapefile reader. Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Paulik committed Aug 14, 2017
1 parent ad41c48 commit dbd3929
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pygeogrids/shapefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def get_gad_grid_points(grid, gadm_shp_path, level, name=None, oid=None):
-------
grid : BasicGrid
Subgrid.
Raises
------
ValueError: If name or oid are not found in shapefile of given level
ImportError: If gdal or osgeo are not installed
"""
if ogr_installed:
drv = ogr.GetDriverByName('ESRI Shapefile')
Expand All @@ -81,7 +86,9 @@ def get_gad_grid_points(grid, gadm_shp_path, level, name=None, oid=None):
feature = lyr_in.GetNextFeature()
ply = feature.GetGeometryRef()
return grid.get_shp_grid_points(ply)
else:
raise ValueError("Requested Object not found in shapefile.")

else:
raise Exception("No supported implementation installed.\
Please install gdal and osgeo.")
raise ImportError("No supported implementation installed."
"Please install gdal and osgeo.")

0 comments on commit dbd3929

Please sign in to comment.