|
From: Jeff W. <js...@fa...> - 2012-10-16 15:44:03
|
On 10/16/12 8:48 AM, Rich Signell wrote: > Klo & Jeff, > > I tried making a concrete example of using OWSlib with Basemap, but > althought the WMS image looks good, the warpimage does not. > > http://nbviewer.ipython.org/3899690/ > > Do you see where I went wrong? > > Thanks, > Rich Rich: warpimage assumes the image is of global extent. In your example, I think you can just pass the image to the basemap imshow method with from matplotlib.image import imread import urllib2 m.imshow(imread(urllib2.urlopen(url)),origin='upper') Klo previously mentioned there might be a problem with the png data from the WMS server being 'chunked', s you might have to use klo's imshow_chunked function http://www.mail-archive.com/mat...@li.../msg25618.html -Jeff > > On Sat, Oct 13, 2012 at 7:26 PM, klo uo <kl...@gm...> wrote: >> That's also what that snippet I linked does. You can add it to to Basemap >> and it should work. >> >> However Jeff suggested we use this tiny package OWSlib and handle WMS that >> way, which is better IMHO, but for some reason we did not got further reply. >> >> >> >> On Fri, Oct 12, 2012 at 1:31 PM, Rich Signell <rsi...@us...> wrote: >>> WMS services are required to respond to "GetCapabiltiies" request, >>> reporting what layers, styles, times, elevations, and projections they >>> have available. So for example, using the Unidata WMS example below, >>> if we do: >>> >>> >>> http://motherlode.ucar.edu:8080/thredds/wms/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km-noaaport_best.ncd?service=WMS&request=GetCapabilities >>> >>> we can see from the XML response that the Coordinate Reference Systems >>> supported are: >>> >>> <CRS>EPSG:4326</CRS> >>> <CRS>CRS:84</CRS> >>> <CRS>EPSG:41001</CRS> >>> <CRS>EPSG:3857</CRS> >>> <CRS>EPSG:27700</CRS> >>> <CRS>EPSG:3408</CRS> >>> <CRS>EPSG:3409</CRS> >>> <CRS>EPSG:32661</CRS> >>> <CRS>EPSG:32761</CRS> >>> >>> And for this server, the supported response types are: >>> <Format>image/jpeg</Format> >>> <Format>image/png</Format> >>> <Format>application/vnd.google-earth.kmz</Format> >>> <Format>image/gif</Format> >>> >>> So I guess one way to proceed if you wanted to use WMS in Matplotlib >>> and avoid reprojection in python would be to: >>> 1. do the WMS GetCapabilities request to find the available supported >>> Coordinate Reference Systems (which will vary with WMS server) >>> 2. setup Basemap to use one of these CRS >>> 3. use the bounding box of your current axis (in projection units) as >>> part of a GetMap request to the WMS. >>> >>> -Rich >>> >>> On Thu, Oct 11, 2012 at 12:16 AM, klo uo <kl...@gm...> wrote: >>>> I guess that's it? >>>> >>>> warpimage() as it is now, checks if passed image is url, so we can add >>>> additional check if image is url, with urlparse to deduce image >>>> coordinates >>>> and projection if present, then overlay it over already created Basemap >>>> object. >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> 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 >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>> >>> >>> -- >>> Dr. Richard P. Signell (508) 457-2229 >>> USGS, 384 Woods Hole Rd. >>> Woods Hole, MA 02543-1598 >> > > |