Skip to content

Conversation

@yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Nov 27, 2025

Description of proposed changes

Use the Use the Natural Earth dataset in the example for geopandas line geometry. For details see #4223 (comment).
Let's hope the request / download is more stable and this will make our docs build less often fail 🚀.

For the rivers there is only one river plotted for Europe. When changing to 50 m (instead of 110 m) I get the error

File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\helpers\tempfile.py:148 in tempfile_from_geojson
    for col in geojson.columns:

  File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pandas\core\generic.py:6321 in __getattr__
    return object.__getattribute__(self, name)

AttributeError: 'GeoSeries' object has no attribute 'columns'

RuntimeError: GDAL Error: Features without geometry not supported by GMT writer.. Failed to write record: <fiona.model.Feature object at 0x00000206E466CFB0>. 

When using the subset rivers[rivers["scalerank"] != 5] it works. Interestingly the subset rivers_five = rivers[rivers["scalerank"] == 5] is empty. For 10 m, I do not face such an error.

Europe (currently) Europe 110 m Europe 50 m Europe 10 m
Image image image image

Related to

Fixes #4223

Preview: https://pygmt-dev--4229.org.readthedocs.build/en/4229/gallery/lines/linestrings.html

Guidelines

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@yvonnefroehlich yvonnefroehlich added this to the 0.18.0 milestone Nov 27, 2025
@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Nov 27, 2025
@yvonnefroehlich yvonnefroehlich changed the title Example for : Use Natural Earth dataset Example for geopandas line geometry: Use Natural Earth dataset Nov 27, 2025
@michaelgrund
Copy link
Member

Third option, just show line objects for a geopandas line geometry example, nothing else. So, no cities should appear 😉 .

@yvonnefroehlich
Copy link
Member Author

Third option, just show line objects for a geopandas line geometry example, nothing else. So, no cities should appear 😉 .

Yep, here for the line example we will stay with the rivers only.
The image with the cities was from the related issue, as I was wondering if we maybe want to add a new third example for points.

@seisman
Copy link
Member

seisman commented Nov 27, 2025

When changing to 50 m (instead of 110 m) I get the error

File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\helpers\tempfile.py:148 in tempfile_from_geojson
    for col in geojson.columns:

  File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pandas\core\generic.py:6321 in __getattr__
    return object.__getattribute__(self, name)

AttributeError: 'GeoSeries' object has no attribute 'columns'

RuntimeError: GDAL Error: Features without geometry not supported by GMT writer.. Failed to write record: <fiona.model.Feature object at 0x00000206E466CFB0>. 

It's likely there are one or a few rivers that doesn't have geometry information.

This can be avoided if we focus on the rivers in Europe only. This can be done by:

rivers = rivers.cx[-10:30, 35:57]

@yvonnefroehlich
Copy link
Member Author

yvonnefroehlich commented Nov 27, 2025

I am wondering if it would be welcome to change the region from Europe to South America for the line geometry example. Then we can use Europe for an example on the point geometry. The plotting of the point geometry is straightforward, but I think it's good to show that users can pass the columns of a gdf directly to the Figure.text method to label features, e.g., cities, which is much easier than having to set up a GMT-specific file. I prefer to have Europe for the points example because there are no overlapping labels.

rivers, lines, South America, 50 m (this PR #4229) cities, points, Europe, 50 m (new PR #4231)
image image

@yvonnefroehlich yvonnefroehlich changed the title Example for geopandas line geometry: Use Natural Earth dataset Example for geopandas line geometry: Use Natural Earth dataset, change to South America Nov 28, 2025
@yvonnefroehlich yvonnefroehlich self-assigned this Nov 28, 2025
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Nov 28, 2025
@Esteban82
Copy link
Member

A suggestion regarding figures in tutorials: I think that horizontally-oriented (landscape) figures are often more effective than vertical (portrait) ones. Because they don't fill the entire screen, landscape figures enable users to see the visual aid and the relevant text side-by-side, which creates a smoother and more efficient reading flow.

This approach is implemented effectively in these PyGMT tutorials:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation final review call This PR requires final review and approval from a second reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the Natural Earth datasets rather than geodataset datasets in geopandas gallery examples

5 participants