-
Notifications
You must be signed in to change notification settings - Fork 220
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
Use a different dataset in the gallery example "examples/gallery/lines/roads.py" #3320
Comments
I like the current geopandas line-geometry example. However, I agree that we should use a dataset which is accessible to more [all] users! import geopandas as gpd
import pygmt
# -----------------------------------------------------------------------------
gpd_lines = gpd.read_file(
"https://www.eea.europa.eu/data-and-maps/data/wise-large-rivers-and-large-lakes/zipped-shapefile-with-wise-large-rivers-vector-line/zipped-shapefile-with-wise-large-rivers-vector-line/at_download/file/" + \
"wise_large_rivers.zip"
)
gpd_lines.crs
gpd_lines_new = gpd_lines.to_crs('EPSG:4326')
gpd_lines_new
# -----------------------------------------------------------------------------
fig = pygmt.Figure()
fig.coast(
projection="M10c",
region=[-10, 30, 35, 57],
land="gray99",
shorelines="1/0.1p,gray50",
borders="1/0.1,gray30",
frame=True,
# rivers="1/1p,lightred", # Compare with GMT built-in
)
fig.plot(data=gpd_lines_new, pen="0.5p,steelblue")
fig.show() For this dataset, we can [only] filter based on import geopandas as gpd
import pygmt
# -----------------------------------------------------------------------------
gpd_rivers_org = gpd.read_file(
"https://www.eea.europa.eu/data-and-maps/data/wise-large-rivers-and-large-lakes/zipped-shapefile-with-wise-large-rivers-vector-line/zipped-shapefile-with-wise-large-rivers-vector-line/at_download/file/" + \
"wise_large_rivers.zip"
)
gpd_rivers = gpd_rivers_org.to_crs('EPSG:4326')
# -----------------------------------------------------------------------------
fig = pygmt.Figure()
for i_panel in range(2):
fig.coast(
projection="M10c",
region=[-10, 35, 35, 58],
land="gray99",
shorelines="1/0.1p,gray50",
borders="1/0.01p,gray70",
frame=True,
)
# -----------------------------------------------------------------------------
if i_panel==0:
len_limit = 700000
gpd_rivers_short = gpd_rivers[gpd_rivers["Shape_Leng"] < len_limit]
gpd_rivers_long = gpd_rivers[gpd_rivers["Shape_Leng"] > len_limit]
fig.plot(data=gpd_rivers_short, pen="0.5p,orange", label=f"shorter {len_limit} m")
fig.plot(data=gpd_rivers_long, pen="0.5p,darkred", label=f"longer {len_limit} m")
fig.legend()
# -----------------------------------------------------------------------------
if i_panel==1:
pygmt.makecpt(
cmap="oslo",
series=[gpd_rivers.Shape_Leng.min(), 1500000],
reverse=True,
)
for i_river in range(len(gpd_rivers)):
fig.plot(
data=gpd_rivers[gpd_rivers.index==i_river],
zvalue=gpd_rivers.loc[i_river, "Shape_Leng"],
pen="0.5p",
cmap=True,
)
fig.colorbar(frame=["x+llength", "y+lm"], position="+ef0.2c")
# -----------------------------------------------------------------------------
fig.shift_origin(xshift="w+1.5c")
fig.show() |
ping the author of the gallery example @weiji14 |
Hm. Not sure, but looking at PR #1474 it seems like @michaelgrund wrote the first version of this example. |
You're right. @michaelgrund is the original author. @weiji14 was dealing with the Okina character |
I'm fine with changing the data resource for this example and really like the rivers dataset @yvonnefroehlich proposed. However:
|
Yes, I can access the data. The current dataset in this example is hosted by US government site. I guess that's why it blocks China. |
I was hopeing so, as this dataset is provided by the European Union / European Environment Agency (EEA).
Sure, one figures should be enough to show the principle. I just took the opportunity to play around with the data 😄.
I don't think that this is a larger issue. Users may have own datasets with more detailed (or newer) data. If people think it is needed we can maybe include a short comment in the description of the example? |
The gallery example (https://www.pygmt.org/v0.12.0/gallery/lines/roads.html) uses a dataset from http://www2.census.gov/geo/tiger/TIGER2015/PRISECROADS/tl_2015_15_prisecroads.zip.
I'm getting the "Access Denied" error when I try to download the data using a China IP, but it works when I use a VPN server in US or Japan.
It would be better if we could find another dataset which is more accessible to users.
The text was updated successfully, but these errors were encountered: