Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace geopandas.datasets by geodatasets in the examples #1362

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: env setup
run: |
python -m pip install --upgrade pip setuptools
python -m pip install build
run: python -m pip install build
- name: pip build
run: python -m build
- name: Publish package to PyPI
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: upgrade pip / setuptools
run: pip install -U pip setuptools
- name: install with geo
run: pip install -v --prefer-binary -e '.[tests, examples-tests, geo, hvdev, hvdev-geo, dev-extras]'
- name: pip list
Expand Down
Binary file modified doc/_static/home/geopandas.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ align: center

:::{tab-item} GeoPandas
```python
import geopandas as gpd
import geopandas as gpd, geodatasets
import hvplot.pandas

gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
gdf.hvplot(global_extent=True, tiles=True)
chicago = gpd.read_file(geodatasets.get_path("geoda.chicago_commpop"))
chicago.hvplot.polygons(geo=True, c='POP2010', hover_cols='all')
```
```{image} ./_static/home/geopandas.gif
---
Expand Down
16 changes: 13 additions & 3 deletions doc/reference/geopandas/points.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@
"source": [
"import geopandas as gpd\n",
"\n",
"cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))\n",
"cities.sample(5)"
"\n",
"data = {\n",
" 'City': ['London', 'Paris', 'Berlin', 'Madrid', 'Rome', 'Vienna', 'Warsaw', 'Amsterdam'],\n",
" 'Country': ['United Kingdom', 'France', 'Germany', 'Spain', 'Italy', 'Austria', 'Poland', 'Netherlands'],\n",
" 'Latitude': [51.5074, 48.8566, 52.5200, 40.4168, 41.9028, 48.2082, 52.2297, 52.3676],\n",
" 'Longitude': [-0.1278, 2.3522, 13.4050, -3.7038, 12.4964, 16.3738, 21.0122, 4.9041]\n",
"}\n",
"cities = gpd.GeoDataFrame(\n",
" data,\n",
" geometry=gpd.points_from_xy(data['Longitude'], data['Latitude']),\n",
" crs=\"EPSG:4326\",\n",
")"
]
},
{
Expand Down Expand Up @@ -82,7 +92,7 @@
"metadata": {},
"outputs": [],
"source": [
"cities.hvplot(coastline=True, projection=ccrs.Geostationary(central_longitude=-30), global_extent=True)"
"cities.hvplot(coastline=True, projection=ccrs.Geostationary(central_longitude=10), global_extent=True)"
]
}
],
Expand Down
15 changes: 10 additions & 5 deletions doc/reference/geopandas/polygons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"metadata": {},
"outputs": [],
"source": [
"import geodatasets\n",
"import geopandas as gpd\n",
"\n",
"countries = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))\n",
"countries.sample(5)"
"chicago = gpd.read_file(geodatasets.get_path(\"geoda.chicago_commpop\"))\n",
"chicago.sample(3)"
]
},
{
Expand All @@ -41,7 +42,7 @@
"metadata": {},
"outputs": [],
"source": [
"countries.hvplot(geo=True)"
"chicago.hvplot(geo=True)"
]
},
{
Expand All @@ -57,7 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
"countries.hvplot.polygons(geo=True, c='pop_est', hover_cols='all')"
"chicago.hvplot.polygons(geo=True, c='POP2010', hover_cols='all')"
]
},
{
Expand All @@ -73,7 +74,11 @@
"metadata": {},
"outputs": [],
"source": [
"countries.hvplot.polygons(geo=True, c=countries.pop_est/countries.area, clabel='pop density')"
"chicago.hvplot.polygons(\n",
" geo=True,\n",
" c=chicago.POP2010/chicago.to_crs('EPSG:32616').area,\n",
" clabel='pop density',\n",
")"
]
}
],
Expand Down
5 changes: 3 additions & 2 deletions hvplot/plotting/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,10 +1767,11 @@ def polygons(self, x=None, y=None, c=None, **kwds):
.. code-block::

import geopandas as gpd
import geodatasets
import hvplot.pandas

countries = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
countries.hvplot.polygons(geo=True, c='pop_est', hover_cols='all')
chicago = gpd.read_file(geodatasets.get_path("geoda.chicago_commpop"))
chicago.hvplot.polygons(geo=True, c='POP2010', hover_cols='all')
"""
return self(x, y, c=c, kind='polygons', **kwds)

Expand Down
Loading