[owslib-users] I'm looking for sources of sample code with regard to retrieving data

Jachym Cepicky jachym.cepicky at gmail.com
Wed May 30 12:44:41 PDT 2012


Hi,

you can form the request "by hand" (using
http://opengeospatial.org/standards/wms) :

http://imselev.cr.usgs.gov/wmsconnector/com.esri.wms.Esrimap/USGS_EDC_Elev_NED?service=wms&version=1.3.0&request=getmap&width=800&height=600&bbox=14.5,-127,54,-65&layers=CONUS_RELIEF256&format=image/png&crs=epsg:4326

Now, how to perform this using owslib:

>>> from owslib.wms import WebMapService as WMS
>>> w =
WMS("http://imselev.cr.usgs.gov/wmsconnector/com.esri.wms.Esrimap/USGS_EDC_Elev_NED",version="1.3.0")

>>> w.contents.keys() # get list of layers:
['HI_RELIEF128', 'TI_W_RELIEF64', 'AK_RELIEF8', 'PR_RELIEF4',
'TI_E_RELIEF4', 'HI_RELIEF4', 'CONUS_RELIEF'

# make the GetMap request
>>> m =
w.getmap(layers=["CONUS_RELIEF256"],size=[800,600],format="image/png",bbox=[14.5,-127,54,-65],crs="epsg:4326")

# save file
>>> out=open("/tmp/out.png","w")
>>> out.write(m.read())
>>> out.close()

result is stored into file named /tmp/out.png

NOTE: BBOX coordinates are in this case to be given in
"min_lat,min_lon,max_lat,max_long" order, so kind of
"miny,minx,maxy,maxx". If you would be using other coordinate reference
system (different from epsg:4326), the order would be "minx,miny,maxx,maxy"

Jachym


Dne 30.5.2012 18:19, Dennis Shimer napsal(a):
> I am familiar with and reasonably proficient with python, but brand new to
> owslib.  I have it installed and have issued a couple commands based on the
> usage page so it seems to be working.  I have a list of steps that I would
> like to accomplish and would be very grateful for any code examples that
> would point me in the right direction. In my CAD system I can digitize a
> bounding box in a particular standard projection in the end I would like to
> pull down an arc ascii grid file in the same projection for the area
> represented by the bounds.
> 
> I can...
> Create the bounds.
> Connect to the server: "
> http://imselev.cr.usgs.gov:80/wmsconnector/com.esri.wms.Esrimap/USGS_EDC_Elev_NED
> ?"
> 
> I need to...
> Send a properly formatted request
> download the data in the projection and format necessary.
> 
> Thanks in advance for any pointers toward helpful information.
> Dennis
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> 
> 
> 
> _______________________________________________
> owslib-users mailing list
> owslib-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owslib-users

-- 
Jachym Cepicky
Help Service - Remote Sensing s.r.o.
jachym.cepicky at gmail.com | jachym at hsrs.cz
http://les-ejk.cz | http://bnhelp.cz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/owslib-users/attachments/20120530/3f9767be/attachment.pgp>


More information about the Owslib-users mailing list