I tried to clip a raster to a shapefile in a python 3.5 environment and get an error. clip(shp,return=False) does not cause an error. I get a `dict object has no attribute iterkeys' error, so looks like that is a standard python 2 vs python 3 issue.
replication code (requires DMSP, i bet a student of Weil and Galor's needs no intro to that dataset :smile: )
import geopandas as gpd
import georasters as gr
raster = gr.from_file('dmsp_stable_nightlights_1992.tif')
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
countries = world[world.name.isin(['Nepal','India'])
clipped = raster.clip(countries, keep = True)
error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-34-82e70efc2e93> in <module>()
----> 1 clipped = raster0.clip(subset_shape(['Nepal']),keep=True)
~/anaconda3/envs/gds/lib/python3.5/site-packages/georasters/georasters.py in clip(self, shp, keep, *args, **kwargs)
698 projection=self.projection,
699 datatype=self.datatype))
--> 700 cols = list(set([i for i in df.properties[0].iterkeys()]).intersection(set(shp.columns)))
701 df2 = pd.DataFrame([df.properties.apply(lambda x: x[i]) for i in df.properties[0].iterkeys()
702 if i in cols]).T.merge(df[['GeoRaster']], left_index=True, right_index=True,)
AttributeError: 'dict' object has no attribute 'iterkeys'
I tried to clip a raster to a shapefile in a python 3.5 environment and get an error.
clip(shp,return=False)
does not cause an error. I get a `dict object has no attribute iterkeys' error, so looks like that is a standard python 2 vs python 3 issue.replication code (requires DMSP, i bet a student of Weil and Galor's needs no intro to that dataset :smile: )
error: