On Wed, Oct 10, 2012 at 11:28 PM, Jeff Whitaker wrote:
>
> I wonder whether it would be better to use OWSlib 
> (http://geopython.github.com/OWSLib/) for OGS/WMS support, instead of trying 
> to roll our own solution.  It only has ElementTree as a dependency.  Klo - 
> would you be interested in rewriting your wmsimage method using OWSlib?  I 
> bet it would simplify the code quite a bit.


Hi Jeff,

that's good idea :D
But really, OWSlib is very small package that doesn't depend on
anything so why rewrite, right?

I installed it and played with it shortly. It provides all sorts of
useful functions for WMS service and it can return HTTPmessage
suitable for writing to file object, but not for imshow()/imread() as
it's chunked encoded, as I mentioned in that gist sample. So my
suggestion is we just use warpimage() and handle WMS that way, as
warpimage() uses temp file with urlretrieve(). Although we can use
cStringIO and avoid temp file.

So user handles WMS through OWSLib the way he likes and then passes it
to warpimage() like this (taken from docs):

========================================
m = Basemap(...)
img = wms.getmap(layers=['global_mosaic'],
                 styles=['visual_bright'],
                 srs='EPSG:4326',
                 bbox=(-112, 36, -106, 41),
                 size=(300, 250),
                 format='image/jpeg'
                )

m.warpimage(image=img.url)
========================================

where obviously wms in OWSLib WebMapService class instance

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to