[owslib-devel] image file is 1kb

Dominic Lowe dominic.lowe at stfc.ac.uk
Wed Feb 22 02:03:51 PST 2012


Hi,

If you open a.png in a text editor you can see that the server has 
reported an error:
     msLoadMap(): Unable to access file. (/osgeo/tiles/vmap0/.map)

So it looks like it may be a setup problem with the server.

Cheers,
Dom

On 22/02/12 07:19, osmankepoglu at gmail.com wrote:
> 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<http://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?'<http://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'

-- 
Scanned by iCritical.




More information about the OWSLib-devel mailing list