[Gfoss] gdallocationinfo

Paolo Corti pcorti a gmail.com
Mar 5 Mar 2013 09:53:44 CET


2013/3/5 Vito Borneo <vitoborneo a yahoo.it>:
> Potreste aiutarmi a capire la sintassi di gdallocationinfo?
> http://www.gdal.org/frmt_wms.html
> vorrei interrogare un server wms per conoscerne SizeX e SizeY.
> ad esempio della carta geologica
> http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/Vettoriali/Carta_geologica.map&service=wms&request=getCapabilities
>
> Vito

Ciao
la sintassi corretta, come da esempio nella pagina di documentazione
da te indicata, sarebbe questa:

$ gdallocationinfo
"WMS:http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/Vettoriali/Carta_geologica.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=GE.CARTAGEOLOGICA&SRS=EPSG:4326&BBOX=6,34.5,19,49"
-geoloc 10.0 40.0 -xml -b 1
<Report pixel="-1" line="-1">
  <Alert>Location is off this file! No further details to report.</Alert>
</Report>

Come vedi per qualche motivo non mi restituisce il valore della cella.
La stessa sintassi mi funziona su altri servizi (ho appena verificato).

Il motivo secondo me e' che nel mapfile non e' abilitata la
GetFeatureInfo per quello che in questo caso e' un grouplayer.
Infatti provando la getfeatureinfo (che e' quello che gdallocationinfo
fa dietro le quinte):

wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/Vettoriali/Carta_geologica.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&WIDTH=100&HEIGHT=100&LAYERS=GE.CARTAGEOLOGICA&BBOX=6,34.5,19,49&SRS=EPSG:4326&x=10&y=40&QUERY_LAYERS=GN:Predefinito

<ServiceExceptionReport version="1.1.1"><ServiceException
code="LayerNotDefined">
msWMSFeatureInfo(): WMS server error. Layer(s) specified in
QUERY_LAYERS parameter is not offered by the service instance.
</ServiceException></ServiceExceptionReport>

Ad ogni modo, cosa te ne fai del valore RGB della cella? In questo
caso non ci sono bande esposte sul raster che contengano valori da
utilizzare, ma le sole tre bande RGB:

$ gdalinfo "WMS:http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/Vettoriali/Carta_geologica.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=GE.CARTAGEOLOGICA&SRS=EPSG:4326&BBOX=6,34.5,19,49"
Driver: WMS/OGC Web Map Service
Files: none associated
Size is 962592768, 1073741824
Coordinate System is:
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"]]
Origin = (6.000000000000000,49.000000000000000)
Pixel Size = (0.000000013505192,-0.000000013504177)
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (   6.0000000,  49.0000000) (  6d 0' 0.00"E, 49d 0' 0.00"N)
Lower Left  (   6.0000000,  34.5000000) (  6d 0' 0.00"E, 34d30' 0.00"N)
Upper Right (  19.0000000,  49.0000000) ( 19d 0' 0.00"E, 49d 0' 0.00"N)
Lower Right (  19.0000000,  34.5000000) ( 19d 0' 0.00"E, 34d30' 0.00"N)
Center      (  12.5000000,  41.7500000) ( 12d30' 0.00"E, 41d45' 0.00"N)
Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
  Overviews: 481296384x536870912, 240648192x268435456,
120324096x134217728, 60162048x67108864, 30081024x33554432,
15040512x16777216, 7520256x8388608, 3760128x4194304, 1880064x2097152,
940032x1048576, 470016x524288, 235008x262144, 117504x131072,
58752x65536, 29376x32768, 14688x16384, 7344x8192, 3672x4096,
1836x2048, 918x1024
Band 2 Block=1024x1024 Type=Byte, ColorInterp=Green
  Overviews: 481296384x536870912, 240648192x268435456,
120324096x134217728, 60162048x67108864, 30081024x33554432,
15040512x16777216, 7520256x8388608, 3760128x4194304, 1880064x2097152,
940032x1048576, 470016x524288, 235008x262144, 117504x131072,
58752x65536, 29376x32768, 14688x16384, 7344x8192, 3672x4096,
1836x2048, 918x1024
Band 3 Block=1024x1024 Type=Byte, ColorInterp=Blue
  Overviews: 481296384x536870912, 240648192x268435456,
120324096x134217728, 60162048x67108864, 30081024x33554432,
15040512x16777216, 7520256x8388608, 3760128x4194304, 1880064x2097152,
940032x1048576, 470016x524288, 235008x262144, 117504x131072,
58752x65536, 29376x32768, 14688x16384, 7344x8192, 3672x4096,
1836x2048, 918x1024

ciao
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


Maggiori informazioni sulla lista Gfoss