[mapserver-users] Which mapscript function to use?

Roger André randre at gmail.com
Mon Jan 18 18:49:25 EST 2010


Hi all,

I'm trying to pass a python mapscript image object directly into GDAL, and
can't seem to hit on the correct mapscript object to feed it with.

- Passing a valid WMS url directly into GDAL works fine, like this.

url = "
http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/sav0656/basemap.map&layers=Ditches&styles=&service=WMS&width=1056&format=image%2Fpng&request=GetMap&height=1056&srs=EPSG%3A900913&version=1.1.1&bbox=19411336.2028%2C19411336.2028%2C60738697.1524%2C60738697.1524
"
gdal.Open(url)

- However, none of these mapscript objects can seem to be read in a similar
way:

  mapobject = mapscript.mapObj('basemap.map')
  imageobject = mapobject.draw()
  f = StringIO()
  imageobject.write(f)
  gdal.Open(f)

TypeError: in method 'Open', argument 1 of type 'char const *'

- or:

  mapobject = mapscript.mapObj('basemap.map')
  imageobject = mapobject.draw()
  buffer = imageobject.getBytes()
  gdal.Open(buffer)

(Creates a 'NoneType' object without any attributes or methods)


So I'm guessing that the image object that's written as the result of the
WMS request is somehow different from the objects written by
imageObj.write() and imageObj.getBytes().  Any ideas on how to mimic this?

Thanks,

Roger
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100118/81fc3685/attachment.html


More information about the mapserver-users mailing list