[GRASS-user] WCS import into GRASS GIS - select region extent only

Blumentrath, Stefan Stefan.Blumentrath at nina.no
Sat Jan 4 13:40:16 PST 2014


Hi Markus,

I should not write emails offline ;-), so sorry for reposting parts of your answer...
And thanks for the hints. I was not aware that the BBOX had no effect in the XML.

Hopefully, the HEIGHT and WIDTH parameter work, as Martin seemed to have problems to fetch the data for his region due to tile-size limits...

If you consider enhancing r.external (or r.in.gdal) in the direction of a projwin option, maybe a "limit import to current region flag" would be more easy to use and maybe also more consistent (like e.g in v.in.ogr).

Cheers
Stefan

-----Original Message-----
From: neteler.osgeo at gmail.com [mailto:neteler.osgeo at gmail.com] On Behalf Of Markus Neteler
Sent: 4. januar 2014 21:49
To: Blumentrath, Stefan
Cc: grass-user at lists.osgeo.org
Subject: Re: [GRASS-user] WCS import into GRASS GIS - select region extent only

Hi,

just for fun I have made a test with r.external (of GRASS GIS 7, it potentially works with G6 as well):

# create ASCII file with this content, named e.g. "wcs_geoserver_LL.wcs":
<WCS_GDAL>
  <ServiceURL>http://demo.opengeo.org/geoserver/wcs?</ServiceURL>
  <CoverageName>Img_Sample</CoverageName>
</WCS_GDAL>

or download this file from
http://svn.osgeo.org/gdal/trunk/autotest/gdrivers/data/geoserver.wcs

Start GRASS in latlong location, then

GRASS 7.0.svn (latlong):~ > r.external input=wcs_geoserver_LL.wcs output=wcs_data --o Projection of input dataset and current location appear to match Reading band 1 of 3...
r.external complete. Link to raster map <wcs_data.1> created.
Reading band 2 of 3...
r.external complete. Link to raster map <wcs_data.2> created.
Reading band 3 of 3...
r.external complete. Link to raster map <wcs_data.3> created.
Imagery group <wcs_data> created

Interestingly the content of wcs_geoserver_LL.wcs is expanded on the fly, i.e. the file is rewritten.
BTW I had to run r.external twice on the same file to avoid some GDAL errors (perhaps the demo server is simply stressed).

GRASS 7.0.svn (latlong):~ > g.region rast=wcs_data.1 -p
projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      54:06:50.76N
south:      20:42:18.72N
west:       130:51:06.048W
east:       62:00:19.44W
nsres:      0:03:21.123813
ewres:      0:04:12.132867
rows:       598
cols:       983
cells:      587834

Voilà, the WCS layer is loaded (then I used the RGB viewer in the wxGUI).

Eventually I then played around with the bounding box
(BBOX=minx,miny,maxx,maxy) and "injected" it in above small file <GetCoverageExtra>&bbox=-103.93,33.74-93.4940.61</GetCoverageExtra>

so that it becomes:

<WCS_GDAL>
  <ServiceURL>http://demo.opengeo.org/geoserver/wcs?</ServiceURL>
  <CoverageName>Img_Sample</CoverageName>
  <GetCoverageExtra>&bbox=-103.93,33.74-93.4940.61</GetCoverageExtra>
</WCS_GDAL>

BUT, as stated in
http://lists.osgeo.org/pipermail/gdal-dev/2008-March/016552.html
it does not have any effect.
I don't know if it would make sense to implement a "projwin" parameter in r.external.

BTW: Another file/WCS server to play with is http://svn.osgeo.org/gdal/trunk/autotest/gdrivers/data/srtmplus.wcs

Not really helpful but at least we know that r.external works with WCS servers.

Markus


More information about the grass-user mailing list