Skip to content

Commit

Permalink
Merge pull request #1 from aaryno/master
Browse files Browse the repository at this point in the history
Improve readability around clipping points to tmax raster
  • Loading branch information
aaryno authored Nov 15, 2019
2 parents a056375 + dc15f2f commit 5c4ec8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,19 @@ poly
```
Geopandas wants the `Polygon` in a `GeoSeries`:
```
tmax_env = geopandas.GeoSeries(poly)
tmax_env_series = geopandas.GeoSeries(poly)
```
Finally, to create the `GeoDataFrame` we need a `geometry` and a `DataFrame`
```
tmax_env = geopandas.GeoDataFrame({'geometry': tmax_env, 'a':[1]})
tmax_env
tmax_env.head()
tmax_env.plot()
tmax_env_gdf = geopandas.GeoDataFrame({'geometry': tmax_env_series, 'a':[1]})
tmax_env_gdf
tmax_env_gdf.head()
tmax_env_gdf.plot()
```
Now we can intersect the points with the polygons. This is doing using the geopandas `sjoin` method. See
[geopandas doc](http://geopandas.org/mergingdata.html#spatial-joins) for more information.
```
gaz_48 = geopandas.sjoin(gaz_geo, df)
gaz_48 = geopandas.sjoin(gaz_geo, tmax_env_gdf)
gaz_48
gaz_48.shape
gaz_48.plot()
Expand Down

0 comments on commit 5c4ec8b

Please sign in to comment.