|
From: Jeff W. <js...@fa...> - 2012-08-26 19:56:30
|
On 8/26/12 5:44 AM, klo uo wrote: > On Sun, Aug 26, 2012 at 12:18 AM, Jeff Whitaker <js...@fa...> wrote: >> Klo: The image in interpolated to the Basemap projection region. This is >> slow - the main reason to use the WMS is to avoid this by having it done on >> the server side. > All right, that's the right way anyway > > >> The trick is to figure out what the EPSG projection code is based on the >> Basemap projection info, and pass that information to the WMS server so it >> can do the interpolation. > Yes, and also to pass right `size` parameter as aspect ratio needs to be correct > Do you want me to try to pair both projections (Basemap name and WKID > and WKT as they call it)? Klo: Since epsg codes comprise a very small subset of possible Basemap projections, it may be better to just allow Basemap to accept an epsg kwarg. That keyword would be required in order to use a WMS to display a map background. This may be tricky though, since Basemap needs more information to define a map projection region than is provided by the epsg code. We may have to start with just a few supported epsg codes and then add more as necessary. I added a testwms.py example to my fork (https://github.com/jswhit/basemap.git) that shows how to use three different map projections (epsg codes). -Jeff -Jeff > > >> Here's an example for south polar stereographic: >> >> width = 12000.e3 >> plt.figure() >> basemap_url =\ >> "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export?\ >> bbox=%d,%d,%d,%d&\ >> bboxSR=3412&\ >> imageSR=3412&\ >> size=800,800&\ >> dpi=128&\ >> format=png32&\ >> f=image" % (-width/2,-width/2,width/2,width/2) >> m =\ >> Basemap(projection='stere',resolution='i',lon_0=0,lat_0=-90,lat_ts=-70,\ >> width=width,height=width,rsphere=(6378273,6356889.449)) >> m.imshow(plt.imread(urllib2.urlopen(basemap_url)),origin='upper') >> m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1],color='y') >> m.drawparallels(np.arange(-80,-0,10),labels=[1,0,0,0],color='y') >> m.drawcoastlines() >> plt.show() >> > Looks beautifully :) > > As said later today I'll look at Nokia maps and then will try to look > for WMS servers. |