[owslib-devel] image file is 1kb
Osman Kepoglu
osmankepoglu at gmail.com
Tue Feb 21 23:19:18 PST 2012
Dear all,
wms getmap produces image file but size is 1kb and could not show anything.
Could you help me please?
>>> wms = WebMapService('http://labs.metacarta.com/wms/vmap0',
version='1.1.1')
>>> list(wms.contents)
['disp', 'bridge', 'priroad', 'stateboundary', 'country_02', 'country_01',
'secr
oad', 'CAUSE', 'statelabel', 'Vmap0', 'depthcontour', 'ctylabel',
'population',
'clabel', 'basic', 'rail', 'coastline_02', 'coastline_01', 'trail',
'ground_01',
'inwater', 'ground_02', 'tunnel', 'ocean', 'ferry', 'river']
>>> wms['basic'].boundingBoxWGS84
(-180.0, -90.0, 180.0, 90.0)
>>> wms['basic'].crsOptions
['EPSG:900913', 'EPSG:4326', 'EPSG:4269']
>>> wms['basic'].styles
{}
>>> [op.name for op in wms.operations]
['GetCapabilities', 'GetMap', 'GetFeatureInfo', 'DescribeLayer',
'GetLegendGraph
ic', 'GetStyles']
>>> wms.getOperationByName('GetMap').methods
{'Post': {'url': 'http://vmap0.tiles.osgeo.org/wms?'}, 'Get': {'url': '
http://vm
ap0.tiles.osgeo.org/wms?'}}
>>> wms.getOperationByName('GetMap').formatOptions
['image/jpeg', 'image/png', 'image/gif', 'image/png; mode=24bit',
'image/wbmp',
'image/tiff', 'image/svg+xml']
>>>
>>> img = wms.getmap(layers=['basic'], srs='EPSG:4326', bbox=(-180.0,
-90.0, 180.0, 90.0), size=(256, 256), format='image/png')
>>> out = open('a.png', 'wb')
>>> out.write(img.read())
>>> out.close()
>>> dir(img)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'getcode', 'geturl', 'headers', 'info', 'msg', 'next',
'read', 'readline', 'readlines', 'url']
>>> img.geturl()
'
http://vmap0.tiles.osgeo.org/wms?layers=basic&styles=&srs=EPSG%3A4326&format=image%2Fpng&request=GetMap&bgcolor=0xFFFFFF&height=256&width=256&version=1.1.1&bbox=-180.0%2C-90.0%2C180.0%2C90.0&exceptions=application%2Fvnd.ogc.se_xml&transpar
ent=FALSE'
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/owslib-devel/attachments/20120222/2899a0b6/attachment.html>
More information about the OWSLib-devel
mailing list