Discussion:
[Community] OWSlib tests
Thomas Gratier
2011-03-26 16:26:33 UTC
Permalink
Hello list,

I'm doing some test with OWSlib
http://gispython.org/owslib/docs/en/trunk/and I get some troubles.

In the doc, you can correct
['global_mosaic'].crsOptions with wms['global_mosaic'].crsOptions

The part below doesn't work.
It sends back "This server no longer provides full WMS services! " because
http://onearth.jpl.nasa.gov/ services have changed.

#####################################################################
img = wms.getmap( layers=['global_mosaic'],
styles=['visual_bright'],
srs='EPSG:4326',
bbox=(-112, 36, -106, 41),
size=(300, 250),
format='image/jpeg',
transparent=True
)
out = open('jpl_mosaic_visb.jpg', 'wb')
out.write(img.read())
out.close()
#####################################################################

My own sample doesn't work either e.g.

#####################################################################
wms = WebMapService('http://vmap0.tiles.osgeo.org/wms/vmap0',
version='1.1.1')

img = wms.getmap(layers=['basic'],
styles=[''],
srs='EPSG:4326',
bbox=(0, 45, 45, 90),
size=(256, 256),
format='image/jpeg'
)
#####################################################################

It's because in
http://vmap0.tiles.osgeo.org/wms/vmap0?REQUEST=getCapabilities&VERSION=1.1.1&SERVICE=WMSin
OnlineResource, the xlink:href value is
http://vmap0.tiles.osgeo.org/wms? when it has to be
http://vmap0.tiles.osgeo.org/wms/vmap0
Some ideas to add an option (already exist ?) that use
http://vmap0.tiles.osgeo.org/wms/vmap0 instead of the wrong url from
OnlineResource

Regards

ThomasG
GIS specialist

PS : I will give you more return about OWSlib docs in the next days.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20110326/dc1a888c/attachment.htm>
Dominic Lowe
2011-03-28 15:06:15 UTC
Permalink
Hi Thomas,

Thanks for the feedback. Much appreciated.

Okay - we'd better fix the NASA example...

In your example, as you point out it's the server OnlineResource which
is wrong - so it may be better to try and get this fixed at source?


Cheers,
Dominic
Post by Thomas Gratier
Hello list,
I'm doing some test with OWSlib http://gispython.org/owslib/docs/en/trunk/ and I get some troubles.
In the doc, you can correct
['global_mosaic'].crsOptions with wms['global_mosaic'].crsOptions
The part below doesn't work.
It sends back "This server no longer provides full WMS services! " because http://onearth.jpl.nasa.gov/ services have changed.
#####################################################################
img = wms.getmap( layers=['global_mosaic'],
styles=['visual_bright'],
srs='EPSG:4326',
bbox=(-112, 36, -106, 41),
size=(300, 250),
format='image/jpeg',
transparent=True
)
out = open('jpl_mosaic_visb.jpg', 'wb')
out.write(img.read())
out.close()
#####################################################################
My own sample doesn't work either e.g.
#####################################################################
wms = WebMapService('http://vmap0.tiles.osgeo.org/wms/vmap0', version='1.1.1')
img = wms.getmap(layers=['basic'],
styles=[''],
srs='EPSG:4326',
bbox=(0, 45, 45, 90),
size=(256, 256),
format='image/jpeg'
)
#####################################################################
It's because in http://vmap0.tiles.osgeo.org/wms/vmap0?REQUEST=getCapabilities&VERSION=1.1.1&SERVICE=WMS in OnlineResource, the xlink:href value is http://vmap0.tiles.osgeo.org/wms? when it has to be http://vmap0.tiles.osgeo.org/wms/vmap0
Some ideas to add an option (already exist ?) that use http://vmap0.tiles.osgeo.org/wms/vmap0 instead of the wrong url from OnlineResource
Regards
ThomasG
GIS specialist
PS : I will give you more return about OWSlib docs in the next days.
--
Scanned by iCritical.
Dominic Lowe
2011-03-29 09:24:39 UTC
Permalink
Hi Thomas,

I discovered that you can work around this if you download the
capabilities document and correct all the OnlineResource elements
locally - you can then load the static capabilities doc using the 'xml'
keyword and OWSLib will make the right getMap requests.
e.g.

capdoc=open('/home/dom/Downloads/vmap0', 'r').read()
wms=WebMapService('url', version='1.1.1', xml=capdoc)

img = wms.getmap(layers=['basic'],
styles=[''],
srs='EPSG:4326',
bbox=(0, 45, 45, 90),
size=(256, 256),
format='image/jpeg'
)

f=open('newfile.jpg', 'wb')
f.write(img.read())
f.close()


I still think it's a problem with the server though :)

Cheers,
Dom
Post by Dominic Lowe
Hi Thomas,
Thanks for the feedback. Much appreciated.
Okay - we'd better fix the NASA example...
In your example, as you point out it's the server OnlineResource which
is wrong - so it may be better to try and get this fixed at source?
Cheers,
Dominic
Post by Thomas Gratier
Hello list,
I'm doing some test with OWSlib http://gispython.org/owslib/docs/en/trunk/ and I get some troubles.
In the doc, you can correct
['global_mosaic'].crsOptions with wms['global_mosaic'].crsOptions
The part below doesn't work.
It sends back "This server no longer provides full WMS services! " because http://onearth.jpl.nasa.gov/ services have changed.
#####################################################################
img = wms.getmap( layers=['global_mosaic'],
styles=['visual_bright'],
srs='EPSG:4326',
bbox=(-112, 36, -106, 41),
size=(300, 250),
format='image/jpeg',
transparent=True
)
out = open('jpl_mosaic_visb.jpg', 'wb')
out.write(img.read())
out.close()
#####################################################################
My own sample doesn't work either e.g.
#####################################################################
wms = WebMapService('http://vmap0.tiles.osgeo.org/wms/vmap0', version='1.1.1')
img = wms.getmap(layers=['basic'],
styles=[''],
srs='EPSG:4326',
bbox=(0, 45, 45, 90),
size=(256, 256),
format='image/jpeg'
)
#####################################################################
It's because in http://vmap0.tiles.osgeo.org/wms/vmap0?REQUEST=getCapabilities&VERSION=1.1.1&SERVICE=WMS in OnlineResource, the xlink:href value is http://vmap0.tiles.osgeo.org/wms? when it has to be http://vmap0.tiles.osgeo.org/wms/vmap0
Some ideas to add an option (already exist ?) that use http://vmap0.tiles.osgeo.org/wms/vmap0 instead of the wrong url from OnlineResource
Regards
ThomasG
GIS specialist
PS : I will give you more return about OWSlib docs in the next days.
--
Scanned by iCritical.
Loading...