[GRASS-user] r.in.wms help needed

Helmut Kudrnovsky hellik at web.de
Tue Aug 9 11:12:53 PDT 2016


hi,

there is a nice map compilation available via WMTS: http://www.basemap.at/
WMTS GetCapabilities :
https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml

what I've done:

- create a location with EPSG:3857
- set the region for a small area of interest

g.region -p                                                                     
projection: 99 (WGS 84 / Pseudo-Mercator)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      5961400
south:      5930120
west:       1401500
east:       1407550
nsres:      10
ewres:      10
rows:       3128
cols:       605
cells:      1892440

then check the WMTS server via gdalinfo

------------------------------
gdalinfo "https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml"
Driver: WMTS/OGC Web Mab Tile Service
Files: none associated
Size is 512, 512
Coordinate System is `'
Origin = (0.000000000000000,0.000000000000000)
Pixel Size = (1.000000000000000,1.000000000000000)
Subdatasets:
 
SUBDATASET_1_NAME=WMTS:http://maps.wien.gv.at/basemap/1.0.0/WMTSCapabilities.xml,layer=geolandbasemap
  SUBDATASET_1_DESC=Layer Geoland Basemap
 
SUBDATASET_2_NAME=WMTS:http://maps.wien.gv.at/basemap/1.0.0/WMTSCapabilities.xml,layer=bmapoverlay
  SUBDATASET_2_DESC=Layer Geoland Basemap Overlay
 
SUBDATASET_3_NAME=WMTS:http://maps.wien.gv.at/basemap/1.0.0/WMTSCapabilities.xml,layer=bmapgrau
  SUBDATASET_3_DESC=Layer Geoland Basemap Grau
 
SUBDATASET_4_NAME=WMTS:http://maps.wien.gv.at/basemap/1.0.0/WMTSCapabilities.xml,layer=bmaphidpi
  SUBDATASET_4_DESC=Layer Basemap High DPI
 
SUBDATASET_5_NAME=WMTS:http://maps.wien.gv.at/basemap/1.0.0/WMTSCapabilities.xml,layer=bmaporthofoto30cm
  SUBDATASET_5_DESC=Layer Geoland Basemap Orthofoto
Corner Coordinates:
Upper Left  (   0.0000000,   0.0000000) 
Lower Left  (       0.000,     512.000) 
Upper Right (     512.000,       0.000) 
Lower Right (     512.000,     512.000) 
Center      (     256.000,     256.000) 
------------------------------

then check one of the available layers:

------------------------------
gdalinfo
"WMTS:https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml,layer=bmapgrau"

Driver: WMTS/OGC Web Mab Tile Service
Files: none associated
Size is 3134414, 1484550
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext
+no_defs"],
    AUTHORITY["EPSG","3857"]]
Origin = (977649.895442947745323,6281290.132053932175040)
Pixel Size = (0.298582141740400,-0.298582141740400)
Metadata:
  ABSTRACT=basemap von Österreich in Grau
  TITLE=Geoland Basemap Grau
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  977649.895, 6281290.132) (  8d46'56.56"E, 49d 2'16.34"N)
Lower Left  (  977649.895, 5838030.014) (  8d46'56.56"E, 46d21'31.57"N)
Upper Right ( 1913529.941, 6281290.132) ( 17d11'22.31"E, 49d 2'16.34"N)
Lower Right ( 1913529.941, 5838030.014) ( 17d11'22.31"E, 46d21'31.57"N)
Center      ( 1445589.918, 6059660.073) ( 12d59' 9.44"E, 47d42'55.93"N)
Band 1 Block=128x128 Type=Byte, ColorInterp=Red
  Overviews: 1567207x742275, 783604x371138, 391802x185569, 195901x92784,
97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900, 3061x1450,
1530x725, 765x362, 383x181
  Mask Flags: PER_DATASET ALPHA 
  Overviews of mask band: 1567207x742275, 783604x371138, 391802x185569,
195901x92784, 97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900,
3061x1450, 1530x725, 765x362, 383x181
Band 2 Block=128x128 Type=Byte, ColorInterp=Green
  Overviews: 1567207x742275, 783604x371138, 391802x185569, 195901x92784,
97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900, 3061x1450,
1530x725, 765x362, 383x181
  Mask Flags: PER_DATASET ALPHA 
  Overviews of mask band: 1567207x742275, 783604x371138, 391802x185569,
195901x92784, 97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900,
3061x1450, 1530x725, 765x362, 383x181
Band 3 Block=128x128 Type=Byte, ColorInterp=Blue
  Overviews: 1567207x742275, 783604x371138, 391802x185569, 195901x92784,
97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900, 3061x1450,
1530x725, 765x362, 383x181
  Mask Flags: PER_DATASET ALPHA 
  Overviews of mask band: 1567207x742275, 783604x371138, 391802x185569,
195901x92784, 97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900,
3061x1450, 1530x725, 765x362, 383x181
Band 4 Block=128x128 Type=Byte, ColorInterp=Alpha
  Overviews: 1567207x742275, 783604x371138, 391802x185569, 195901x92784,
97950x46392, 48975x23196, 24488x11598, 12244x5799, 6122x2900, 3061x1450,
1530x725, 765x362, 383x181
------------------------------

then create GDAL's Capabilities file

------------------------------  
gdal_translate
"WMTS:https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml,layer=bmapgrau"
wmts_bmapgrau.xml -of WMTS

<GDAL_WMTS>
 
<GetCapabilitiesUrl>https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml</GetCapabilitiesUrl>
  <Layer>bmapgrau</Layer>
  
  <TileMatrixSet>google3857</TileMatrixSet>
  <DataWindow>
    <UpperLeftX>977649.8954429477</UpperLeftX>
    <UpperLeftY>6281290.132053932</UpperLeftY>
    <LowerRightX>1913529.940664042</LowerRightX>
    <LowerRightY>5838030.013533222</LowerRightY>
  </DataWindow>
  <BandsCount>4</BandsCount>
  <Cache />
  <UnsafeSSL>true</UnsafeSSL>
  <ZeroBlockHttpCodes>204,404</ZeroBlockHttpCodes>
  <ZeroBlockOnServerException>true</ZeroBlockOnServerException>
</GDAL_WMTS>
------------------------------ 

then switch to GRASS GIS and save the Capabilities file  
basemap_rinwms_flag_c.xml
<http://osgeo-org.1560.x6.nabble.com/file/n5280116/basemap_rinwms_flag_c.xml>  

it seems ok so far

then try r.in.wms with GRASS WMTS driver:

------------------------------                                                     
r.in.wms --verbose
url=https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml output=test
layers=bmapgrau srs=3857 driver=WMTS_GRASS
Downloading data from WMS server...
WARNING: no switch
Fetching 56 tiles with 256 x 256 pixel size per tile...
Traceback (most recent call last):
  File "/home/bugs/dev/cpp/grass7_trunk/dist.x86_64-pc-
linux-gnu/scripts/r.in.wms", line 236, in <module>
    sys.exit(main())
  File "/home/bugs/dev/cpp/grass7_trunk/dist.x86_64-pc-
linux-gnu/scripts/r.in.wms", line 222, in main
    fetched_map = wms.GetMap(options, flags)
  File "/home/bugs/dev/cpp/grass7_trunk/dist.x86_64-pc-
linux-gnu/etc/r.in.wms/wms_base.py", line 210, in GetMap
    self.temp_map = self._download()
  File "/home/bugs/dev/cpp/grass7_trunk/dist.x86_64-pc-
linux-gnu/etc/r.in.wms/wms_drv.py", line 205, in _download
    tile_dataset.GetRasterBand(1).DataType)
AttributeError: 'NoneType' object has no attribute
'DataType'
------------------------------

and then with with the GDAL WMS driver:

------------------------------
r.in.wms --verbose
url=https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml output=test
layers=bmapgrau srs=3857 driver=WMS_GDAL
Downloading data from WMS server...
ERROR 1: GDALWMS: The server returned unknown exception.
ERROR 1: /home/bugs/grassdata/loc_epsg3857/rastadata/.tmp/na
da/3422.1, band 1: IReadBlock failed at X offset 0, Y offset
0
ERROR 1: GetBlockRef failed at X block offset 0, Y block
offset 0
ERROR: Incorrect WMS query
------------------------------ 

GDAL has WMS/WMTS support

gdalinfo --formats
[...]
WCS -raster- (rovs): OGC Web Coverage Service
WMS -raster- (rwvs): OGC Web Map Service
[...]
WMTS -raster- (rwv): OGC Web Mab Tile Service

tested with

------------------------------ 
System Info                                                                     
GRASS version: 7.3.svn                                                          
GRASS SVN revision: r69110                                                      
Build date: 2016-08-09                                                          
Build platform: x86_64-pc-linux-gnu                                             
GDAL: 2.1.1                                                                     
PROJ.4: 4.8.0                                                                   
GEOS: 3.4.2                                                                     
SQLite: 3.8.7.1                                                                 
Python: 2.7.9                                                                   
wxPython: 3.0.1.1                                                               
Platform: Linux-3.16.0-4-amd64-x86_64-with-debian-8.5
------------------------------ 

any ideas?

downloading subsets by GDAL works without any problems



-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-in-wms-help-needed-tp5280116.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list