You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Which data to use for geopandas.GeoDataFrame choropleth example? #2786
I wanted to continue on the choropleth example mentioned in #1374, however, in the meanwhile world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")) raises a deprection warning saying the datasets will be removed in geopandas v1.0 (see discussion in #2751).
Thus, we need to use another data source. Any ideas what can be used without to much effort and without adding further dependecies to PyGMT?
world = gpd.read_file("https://naciscdn.org/naturalearth/110m/physical/ne_110m_land.zip")
world = gpd.read_file("https://naciscdn.org/naturalearth/110m/physical/ne_110m_land.zip")
Yes that works but unfortunately the fetched data does neither contain population values nor it's possible to filter e.g. for a specific continent/region like "Europe".
{'geoda': {'airbnb': {'url': 'https://geodacenter.github.io/data-and-lab//data/airbnb.zip',
'license': 'NA',
'attribution': 'Center for Spatial Data Science, University of Chicago',
'name': 'geoda.airbnb',
'description': 'Airbnb rentals, socioeconomics, and crime in Chicago',
'geometry_type': 'Polygon',
'nrows': 77,
'ncols': 21,
'details': 'https://geodacenter.github.io/data-and-lab//airbnb/',
'hash': 'a2ab1e3f938226d287dd76cde18c00e2d3a260640dd826da7131827d9e76c824',
'filename': 'airbnb.zip'},
'atlanta': {'url': 'https://geodacenter.github.io/data-and-lab//data/atlanta_hom.zip',
'license': 'NA',
'attribution': 'Center for Spatial Data Science, University of Chicago',
'name': 'geoda.atlanta',
'description': 'Atlanta, GA region homicide counts and rates',
'geometry_type': 'Polygon',
'nrows': 90,
'ncols': 24,
'details': 'https://geodacenter.github.io/data-and-lab//atlanta_old/',
'hash': 'a33a76e12168fe84361e60c88a9df4856730487305846c559715c89b1a2b5e09',
'filename': 'atlanta_hom.zip',
'members': ['atlanta_hom/atl_hom.geojson']},
...
There also the complete URL can be found (directly via geodatasets.data.geoda.airbnb or geodatasets.get_url("geoda.airbnb")). The URL can be passed directly to geopandas.read_file(). So, if you know the URL of the dataset, it is not needed anymore to have geodatasets installed.
The dataset is read into a GeoDataFrame and can then be used for analysis and plotting, e.g., in PyGMT. I just tried this with the first dataset listed by geodatasets.data:
I didn't realize that I could load the file directly. I thought you also need to include the geodatasets library, which would have been a new dependency. Thanks @yvonnefroehlich. Just modified your example a little, see #2796.
Activity
seisman commentedon Oct 31, 2023
Maybe read a URL directly?
michaelgrund commentedon Oct 31, 2023
Yes that works but unfortunately the fetched data does neither contain population values nor it's possible to filter e.g. for a specific continent/region like "Europe".
yvonnefroehlich commentedon Oct 31, 2023
I faced this issue when starting to work on possible figures for the PyGMT paper.
So far I understood that there is now a separate repro from the geopandas organization for datasets:
geodatasetshttps://github.com/geopandas/geodatasets and https://geodatasets.readthedocs.io/en/latest/.These datasets can be accessed:
It is possible to get more information about these datasets (please see https://geodatasets.readthedocs.io/en/latest/#how-to-use):
Gives:
There also the complete URL can be found (directly via
geodatasets.data.geoda.airbnborgeodatasets.get_url("geoda.airbnb")). The URL can be passed directly togeopandas.read_file(). So, if you know the URL of the dataset, it is not needed anymore to havegeodatasetsinstalled.The dataset is read into a GeoDataFrame and can then be used for analysis and plotting, e.g., in PyGMT. I just tried this with the first dataset listed by
geodatasets.data:Output figure:

So, @michaelgrund maybe you can find in the overview at https://geodatasets.readthedocs.io/en/latest/introduction.html#what-is-the-geodatasets-data-object an interesting dataset which you can use for your gallery example?
michaelgrund commentedon Nov 3, 2023
I didn't realize that I could load the file directly. I thought you also need to include the
geodatasetslibrary, which would have been a new dependency. Thanks @yvonnefroehlich. Just modified your example a little, see #2796.