Skip to content

Conversation

jswhit
Copy link

@jswhit jswhit commented Oct 16, 2012

code from Rich Signell that shows how to retrieve an image from a WMS server and display it on a map. Uses OWSlib. This could be folded into a 'wmsimage' method, but there are so many possible options to pass to OWSlib.wms.WebMapService that this is probably best left to the the user.

@jswhit
Copy link
Author

jswhit commented Oct 17, 2012

I went ahead and added a wmsimage anyway, and just let it pass **kwargs on to OWSLib.wms.WebMapService.getmap. The example was changed to use the new method.

@@ -1,5 +1,8 @@
version 1.0.6 (not yet released)
--------------------------------
* added 'wmsimage' method for displaying background image retrieved from
a OGC-compliant WMS server using OWSLib (http://pypi.python.org/OWSLib)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to have a "batteries not included" message making it clear that the OWSLib is not automatically installed by basemap.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wmsimage method will raise an exception if OWSLib cannot be imported, telling the user that OWSLib is required.

@rsignell-usgs
Copy link

Hopefully this example will also work, where JPG is returned? Had to go through some gyrations to read the returned image without writing to disk, because PIL is being used
http://nbviewer.ipython.org/3907909/

@jswhit
Copy link
Author

jswhit commented Oct 17, 2012

I add the noaa openstreetmaps example to testwmsimage.py. It works for me without any gyrations. My guess is that your PIL is misbehaving.

jswhit pushed a commit that referenced this pull request Oct 22, 2012
@jswhit jswhit merged commit 5cc2a3f into matplotlib:master Oct 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants