Uh oh!
There was an error while loading. Please reload this page.
Add gallery example to show usage of tile maps - #2585
Conversation
michaelgrund
commented
Jun 26, 2023
/format |
michaelgrund
commented
Jun 26, 2023
/format |
michaelgrund
commented
Jun 26, 2023
/format |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
weiji14
left a comment
There was a problem hiding this comment.
Nice one, thanks @michaelgrund for adding this example! Just one comment for now.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
seisman
commented
Jun 28, 2023
Nice example! Do you think switching the order of the two examples makes more sense? I.e., the first example uses the tile providers available from contextily and the second is a more advanced example for people who wants to use custom tile servers that contextily doesn't provide ( |
michaelgrund
commented
Jun 29, 2023
Not sure, since contextily needs to be loaded additionally as a separate library, compared to the "direct" link to the custom tile servers. What do others think? |
yvonnefroehlich
commented
Jun 30, 2023
I have no clear answer here, and I feel I am fine with both orders. Here are some thoughts or ideas, which are maybe helpful regarding a decision: Code example: (comments need definitly some improvement) importcontextilyimportpygmtfig=pygmt.Figure()
# Default xyzservices.providers.Stamen.Terrainfig.tilemap(
region=[-157.84, -157.8, 21.255, 21.285],
projection="M12c",
frame="af+e",
)
fig.shift_origin(xshift="13c")
fig.tilemap(
region=[-157.84, -157.8, 21.255, 21.285],
projection="M12c",
# Instead of Stamen.Terrain web tiles use the Stamen.Watercolor option# from contextilysource=contextily.providers.Stamen.Watercolor,
frame=["wSne", "af+e"],
)
fig.show()
################################################################################ Instead of a web tile provider in the form of a xyzservices.TileProvider# object use one in the form of a URLfig=pygmt.Figure()
fig.tilemap(
region=[-157.84, -157.8, 21.255, 21.285],
projection="M12c",
# Set level of details (0-22)# Higher levels mean a zoom level closer to the Earth's# surface with more tiles covering a smaller# geographic area and thus more details and vice versa# Please note, not all zoom levels are always availablezoom=14,
# Use tiles from OpenStreetMap tile serversource="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
frame="afg+e",
)
fig.show() |
seisman
commented
Jul 1, 2023
Good idea! |
weiji14
commented
Jul 3, 2023
This is starting to sound like a tutorial instead of a gallery example 😅 Let's maybe keep to just 2 maps at a maximum instead of 3 for this gallery example. We can still show one using Note that the latter OpenStreetMap example is actually the same as using |
Uh oh!
There was an error while loading. Please reload this page.
seisman
commented
Jul 3, 2023
Why not extend it as a tutorial? |
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
michaelgrund
commented
Jul 3, 2023
I think we should have both, gallery example and tutorial. |
yvonnefroehlich
left a comment
There was a problem hiding this comment.
I am fine with having both gallery example and tutorial, as suggested by @michaelgrund. In this case, I feel @weiji14 is right, and the gallery example should be short. For the tutorial, I suggest considering also the lonlat parameter.
weiji14
left a comment
There was a problem hiding this comment.
Yep, let's open up a separate PR for a longer tutorial.
yvonnefroehlich
commented
Jul 16, 2023
@michaelgrund do you also plan to add this tutorial, or @weiji14 do you want to work on this? |


Description of proposed changes
So far we don't promote the usage of tilemaps. Here's a gallery example to show its application using two different sources.
Preview:https://pygmt-dev--2585.org.readthedocs.build/en/2585/gallery/maps/tilemaps.html
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version