-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Description
Description of the desired feature
To allow for a greater variety of basemaps from e.g. OpenStreetMap, Stamen, MapBox, etc, it would be nice to integrate with contextily
(part of the geopandas organization). This is motivated by https://forum.generic-mapping-tools.org/t/pygmt-vs-plotly/3250/10.
On the implementation, here are 2 ideas on how to integrate contextily
basemaps with pygmt
.
- Have an additional option under
fig.basemap
which allows selection of the basemap (e.g. OpenStreetMap, Stamen, Mapbox, etc) (Add Figure.tilemap to plot XYZ tile maps #2394, to be calledfig.tilemap
) - Create a new
load_basemap
function underpygmt/datasets
that would load the image (np.ndarray
) and georeference it (to anxarray.DataArray
), and then the user plots it usingfig.grdimage
. (done at Add function to load raster tile maps using contextily #2125, calledload_tile_map
) - Maybe there's another more Pythonic way? Comment down below!
Either way, these would require:
- Wrapping around the
contextily.bounds2img
function at https://contextily.readthedocs.io/en/latest/reference.html#contextily.bounds2img. This returns anumpy.ndarray
and a geographic extent. - The
numpy.ndarray
needs to be georeferenced into anxarray.DataArray
. I have some recent code at https://zen3geo.readthedocs.io/en/v0.4.0/object-detection-boxes.html#georeference-image-using-rioxarray to do that - The
xarray.DataArray
will need to be plotted on the PyGMT map
Are you willing to help implement and maintain this feature? Yes, but discuss about the implementation first
seisman
Metadata
Metadata
Assignees
Labels
feature requestNew feature wantedNew feature wanted