[GRASS-SVN] r37052 - grass/trunk/scripts/r.in.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 8 10:33:58 EDT 2009
Author: martinl
Date: 2009-05-08 10:33:58 -0400 (Fri, 08 May 2009)
New Revision: 37052
Modified:
grass/trunk/scripts/r.in.wms/r.in.wms.html
grass/trunk/scripts/r.in.wms/r.in.wms.py
Log:
r.in.wms:
* fix list_layers()
* remove wget/curl options
Modified: grass/trunk/scripts/r.in.wms/r.in.wms.html
===================================================================
--- grass/trunk/scripts/r.in.wms/r.in.wms.html 2009-05-08 14:02:42 UTC (rev 37051)
+++ grass/trunk/scripts/r.in.wms/r.in.wms.html 2009-05-08 14:33:58 UTC (rev 37052)
@@ -1,15 +1,15 @@
<h2>DESCRIPTION</h2>
-<em>r.in.wms</em> handles all of downloading and importing raster data from
-an <a href="http://www.opengeospatial.org/specs/?page=specs">OpenGIS</a>
-WMS web mapping server. It need only be told the desired data to collect
-(bounds and resolution) via a region, the server to get the data from, and
-the layer or layers to get. It downloads the data in tiles, reprojects it,
-imports it, and patches it back together.
+<em>r.in.wms</em> handles all of downloading and importing raster data
+from an <a href="http://www.opengeospatial.org/standards/wms">OGC
+WMS</a> web mapping server. It need only be told the desired data to
+collect (bounds and resolution) via a region, the server to get the
+data from, and the layer or layers to get. It downloads the data in
+tiles, reprojects it, imports it, and patches it back together.
<h2>NOTES</h2>
-By default data is downloaded to $GISDBASE/wms_download. This can be changed
+By default data is downloaded to <tt>$GISDBASE/wms_download</tt>. This can be changed
by setting the <b>folder</b> option when using <em>r.in.wms</em>.
<p>
@@ -37,14 +37,12 @@
it is in, where to find meta data, resolutions, scales, and bounds for
data, etc.
-<h3>NASA OnEarth server: Get Capabilities Request</h3>
+E.g. lists the layers available from the NASA OnEarth server.
<div class="code"><pre>
r.in.wms mapserver=http://wms.jpl.nasa.gov/wms.cgi -l
</pre></div>
-Lists the layers available from the NASA OnEarth server.
-
<h3>US NED Elevation from OnEarth server download (metric units)</h3>
Set the resolution to 30 (assuming you're in metric units):
Modified: grass/trunk/scripts/r.in.wms/r.in.wms.py
===================================================================
--- grass/trunk/scripts/r.in.wms/r.in.wms.py 2009-05-08 14:02:42 UTC (rev 37051)
+++ grass/trunk/scripts/r.in.wms/r.in.wms.py 2009-05-08 14:33:58 UTC (rev 37052)
@@ -5,7 +5,7 @@
# MODULE: r.in.wms
#
# AUTHOR(S): Cedric Shock, 2006
-# Pythonized by Martin Landa <landa.martin gmail.com>, 2009
+# Upgraded for GRASS 7 by Martin Landa <landa.martin gmail.com>, 2009
#
# PURPOSE: To import data from web mapping servers
# (based on Bash script by Cedric Shock)
@@ -149,22 +149,6 @@
#% guisection: Download
#%end
#%option
-#% key: wgetoptions
-#% type: string
-#% description: Additional options for wget
-#% answer: -c -t 5 -nv
-#% required : no
-#% guisection: Download
-#%end
-#%option
-#% key: curloptions
-#% type: string
-#% description: Additional options for curl
-#% answer: -C - --retry 5 -s -S
-#% required : no
-#% guisection: Download
-#%end
-#%option
#% key: method
#% type: string
#% description: Reprojection method to use
@@ -195,7 +179,6 @@
wmsPath = os.path.join(os.getenv('GISBASE'), 'etc', 'r.in.wms')
sys.path.append(wmsPath)
-print wmsPath
import wms_request
import wms_download
@@ -247,7 +230,10 @@
def getLayers(self):
"""Print list of layers"""
for ly in self.layers:
- print "LAYER: " + ly['name']
+ if ly.has_key('name'):
+ print "LAYER: " + ly['name']
+ else:
+ print "LAYER: ???"
if ly.has_key('title'):
print " Title: " + ly['title']
if ly.has_key('srs'):
@@ -258,15 +244,15 @@
print " Style title: " + ly['style']['title'][idx]
def list_layers():
- """Get available layers from WMS server"""
+ """Get list of available layers from WMS server"""
qstring = "service=WMS&request=GetCapabilities&" + options['wmsquery']
grass.debug("POST-data: %s" % qstring)
# download capabilities file
grass.verbose("List of layers for server <%s>:" % options['mapserver'])
- cap_file = urllib.urlopen(options['mapserver'] + qstring)
+ cap_file = urllib.urlopen(options['mapserver'] + '?' + qstring)
if not cap_file:
- grass.fatal("Unable to get capabilities of <%s>" % options['mapserver'])
+ grass.fatal("Unable to get capabilities of '%s'" % options['mapserver'])
# parse file with sax
cap_xml = ProcessCapFile()
@@ -275,7 +261,7 @@
except xml.sax.SAXParseException, err:
grass.fatal("Reading capabilities failed. "
"Unable to parse XML document: %s" % err)
-
+
cap_xml.getLayers()
def main():
More information about the grass-commit
mailing list