Skip to content

add wmsimage method #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Aug 30, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version 1.0.6 (not yet released)
--------------------------------
* added support for cylindrical equal area ('cea') projection.
* add 'arcgisimage' method for displaying background image retrieved from
an ArcGIS server using the REST API (requires using 'epsg' keyword to define projection).
* add 'epsg' keyword for defining projections.
* add 'ellps' keyword (rsphere ignored if ellps given).
* fixed shiftdata method so it shifts mask along with data
(https://github.com/matplotlib/basemap/pull/68).
* added linestyle keyword to all draw* methods.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ include Changelog
include setup.py
include nad2bin.c
include src/*
include examples/testarcgis.py
include examples/counties.py
include examples/shiftdata.py
include examples/allskymap.py
3 changes: 3 additions & 0 deletions examples/README
Original file line number Diff line number Diff line change
@@ -158,3 +158,6 @@ shiftdata.py shows how to use the 'latlon' keyword to automatically transform to
projection coordinates and shift the data longitudinally to fit the map projection region.

counties.py shows how to draw U.S. county boundaries.

testarcgis.py tests using arcgisimage method to retrieve a background image from a
ArcGIS server using the REST API.
20 changes: 18 additions & 2 deletions examples/test.py
Original file line number Diff line number Diff line change
@@ -71,6 +71,22 @@
print('plotting Gall Stereographic Cylindrical example ...')
print(m.proj4string)

# create new figure
fig=plt.figure()
# setup cylindrical equal area map projection.
m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\
resolution='c',area_thresh=10000.,lat_ts=30,projection='cea')
# plot image over map.
im = m.pcolormesh(lons,lats,topodat,cmap=cmap,latlon=True)
cb = m.colorbar() # draw colorbar
m.drawcoastlines() # draw coastlines
# draw parallels and meridiands
m.drawparallels(np.arange(-90,90,30),labels=[1,0,0,1])
m.drawmeridians(np.arange(0,360,60),labels=[1,0,0,1])
plt.title('Cylindrical Equal Area',y=1.1)
print('plotting Cylindrical Equal Area example ...')
print(m.proj4string)

# create new figure
fig=plt.figure()
# setup mercator map projection (-80 to +80).
@@ -411,7 +427,7 @@
m.colorbar() # draw colorbar
# draw coastlines and political boundaries.
m.drawcoastlines()
# draw parallels and meridians (labelling is
# draw parallels and meridians (labelling is
# not implemented for orthographic).
parallels = np.arange(-80.,90,20.)
m.drawparallels(parallels)
@@ -433,7 +449,7 @@
m.colorbar() # draw colorbar
# draw coastlines and political boundaries.
m.drawcoastlines()
# draw parallels and meridians (labelling is
# draw parallels and meridians (labelling is
# not implemented for geostationary).
parallels = np.arange(-80.,90,20.)
m.drawparallels(parallels)
38 changes: 38 additions & 0 deletions examples/testarcgis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np

# test arcgisimage method for retrieving images from web map servers.

plt.figure(figsize=(8,8))
epsg = 3413; width = 8000.e3; height = 8000.e3
m=Basemap(epsg=epsg,resolution='l',width=width,height=height)
# default 'blue marble' image.
m.arcgisimage()
m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1],color='y')
m.drawparallels(np.arange(0,80,10),labels=[1,0,0,0],color='y')
m.drawcoastlines(linewidth=0.5,color='0.5')
plt.title('test WMS map background EPSG=%s' % epsg)

plt.figure(figsize=(10,6.6666))
epsg = 2263; width=600.e3; height = 400.e3
m=Basemap(epsg=epsg,resolution='h',width=width,height=height)
# specify a different server.
m.arcgisimage(server='http://maps.ngdc.noaa.gov',service='etopo1',verbose=True)
m.drawmeridians(np.arange(-180,180,2),labels=[0,0,0,1])
m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0])
m.drawcoastlines(linewidth=0.25)
plt.title('test WMS map background EPSG=%s' % epsg)

plt.figure(figsize=(6,8))
epsg = 3086; lon1 = -85; lat1 = 24; lon2 = -79; lat2 =32
m=Basemap(epsg=epsg,resolution='i',llcrnrlon=lon1,llcrnrlat=lat1,\
urcrnrlon=lon2,urcrnrlat=lat2)
# specify a different service
m.arcgisimage(service='NatGeo_World_Map',verbose=True,xpixels=600,interpolation='bicubic')
m.drawmeridians(np.arange(-180,180,2),labels=[0,0,0,1])
m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0])
m.drawcoastlines(linewidth=0.25)
plt.title('test WMS map background EPSG=%s' % epsg)

plt.show()
Loading