[owslib-devel] image file is 1kb

Osman Kepoglu osmankepoglu at gmail.com
Wed Feb 22 07:35:44 PST 2012


thanks alot for quick answer. You are right, I have the same error

I finally find a correct wms server and run with these parameters. An image
file is produced showing USA srtm

>>> wms = WebMapService('
http://wms.lizardtech.com/lizardtech/iserv/ows?service=WMS&request=GETCAPABILITIES',
version='1.1.1')
>>> img = wms.getmap(layers=["usa_srtm"], srs="EPSG:4326", bbox=(-126.0,
16.999722, -63.999722, 50.0), size=(1366,768), format="image/jpeg",
transparent=True)
>>> out = open('d:\sample.jpg', 'wb')
>>> out.write(img.read())
>>> out.close()
>>> img.geturl()
'
http://wms.lizardtech.com/lizardtech/iserv/ows?layers=usa_srtm&styles=&srs=EPSG%3A4326&format=image%2Fjpeg&request=GetMap&bgcolor=0xFFFFFF&height=768&width=1366&version=1.1.1&bbox=-126.0%2C16.999722%2C-63.999722%2C50.0&exceptions=application%2Fvnd.ogc.se_xml&transparent=TRUE
'
>>>

regards,
Volkan K.

2012/2/22 Dominic Lowe <dominic.lowe at stfc.ac.uk>

> 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.
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> owslib-devel mailing list
> owslib-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owslib-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/owslib-devel/attachments/20120222/fa84b32a/attachment.html>


More information about the OWSLib-devel mailing list