[gdal-dev] Open WMS datasets with GDAL Java

Even Rouault even.rouault at mines-paris.org
Thu Mar 27 10:27:16 PDT 2014


Selon Fabio Rinnone <fabio.rinnone0 at gmail.com>:

> Hi, I'm trying to open datasets of WMS service with GDAL Java warp in an
> Android app project with native support. Opening datasets always returns
> null datasets. An example WMS is the following:
>
> http://kaart.maakaart.ee/geoserver/wms
>
> I use following statements:
>
> name = "WMS:http://kaart.maakaart.ee/geoserver/wms";
> gdal.Open(name);
>
> For my implementation I have adapted python sample code found here[2].

I guess you lack a call to gdal.AllRegister(); that will register the WMS driver
(in Python the registration of drivers is automatically done)

Because the following works :

java -Djava.library.path=. -cp gdal.jar:build/apps gdalinfo
"WMS:http://kaart.maakaart.ee/geoserver/wms"

Driver: WMS/OGC Web Map Service
Files: none associated
Size is 512, 512
Coordinate System is `'
Origin = (0.0,0.0)
Pixel Size = (1.0,1.0)
Subdatasets:
 
SUBDATASET_1_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm&SRS=EPSG:900913&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_1_DESC=osm:osm
 
SUBDATASET_2_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=eesti:asustusyksus_20130401&SRS=EPSG:3301&BBOX=369032.1030000001,6377141.06,739156.2899999991,6634019.129999999
  SUBDATASET_2_DESC=asustusyksus_20130401
 
SUBDATASET_3_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:countries&SRS=EPSG:3857&BBOX=-2.00374842409172E7,-8.55413855279643E7,2.00375083427893E7,1.84286291455416E7
  SUBDATASET_3_DESC=osm:countries
 
SUBDATASET_4_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=eesti:maakond_20130401&SRS=EPSG:3301&BBOX=369032.1030000001,6377141.06,739156.2899999991,6634019.129999999
  SUBDATASET_4_DESC=maakond_20130401
 
SUBDATASET_5_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=eesti:omavalitsus_20130401&SRS=EPSG:3301&BBOX=369032.1030000001,6377141.06,739156.2899999991,6634019.129999999
  SUBDATASET_5_DESC=omavalitsus_20130401
 
SUBDATASET_6_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_admin&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_6_DESC=osm_admin
 
SUBDATASET_7_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_amenities&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_7_DESC=osm_amenities
 
SUBDATASET_8_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_buildings&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_8_DESC=osm_buildings
 
SUBDATASET_9_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_landusages&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_9_DESC=osm_landusages
 
SUBDATASET_10_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_mainroads&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_10_DESC=osm_mainroads
 
SUBDATASET_11_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_mainroads_gen1&SRS=EPSG:3857&BBOX=-2.00375083427892E7,-1.42888648422354E7,2.00375083335705E7,1.45048034741689E7
  SUBDATASET_11_DESC=osm_mainroads_gen1
 
SUBDATASET_12_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_places&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_12_DESC=osm_places
 
SUBDATASET_13_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_roads&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_13_DESC=osm_roads
 
SUBDATASET_14_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:osm_waterways&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_14_DESC=osm_waterways
 
SUBDATASET_15_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:planet_osm_roads&SRS=EPSG:900913&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_15_DESC=planet_osm_roads
 
SUBDATASET_16_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osmee:roads&SRS=EPSG:900913&BBOX=2428195.3992778542,7870642.716299254,3141984.8130118935,8326161.739777454
  SUBDATASET_16_DESC=roads
 
SUBDATASET_17_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=topp:states&SRS=EPSG:4326&BBOX=-124.73142200000001,24.955967,-66.969849,49.371735
  SUBDATASET_17_DESC=states
 
SUBDATASET_18_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm:towns&SRS=EPSG:3857&BBOX=-20000.0,-20000.0,20000.0,20000.0
  SUBDATASET_18_DESC=towns
 
SUBDATASET_19_NAME=WMS:http://kaart.maakaart.ee/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=nurc:world&SRS=EPSG:4267&BBOX=-180.0,-89.9,180.0,83.674733
  SUBDATASET_19_DESC=world
Corner Coordinates:
Upper Left  (0.0,0.0)
Lower Left  (0.0,512.0)
Upper Right (512.0,0.0)
Lower Right (512.0,512.0)
Center      (256.0,256.0)


>
> [1] http://svn.osgeo.org/gdal/trunk/autotest/gdrivers/wms.py
>
> --
> Fabio Rinnone
> 93015 Niscemi CL, Italia
> Skype: fabiorinnone
> Web: http://www.fabiorinnone.eu
>
>




More information about the gdal-dev mailing list