Hi Even,
Sorry, I'm only noticing your reply now.
My use case is weird as I am using GDAL to reproject a WMS source which
doesn't offer web mercator (French Cadastral Parcels WMS) and needs some
computation on the URL (city code, CRS depending on location).
If I understand your solution, I can't directly output my datasource to
the webserver, I need to write it on disk first ?
All the best
Guillaume
Le 26/09/13 01:19, Even Rouault a écrit :
Le mercredi 25 septembre 2013 10:48:00, Guillaume Sueur a écrit :
Hi list,
I've build a python gdal script which retrieves WMS images from a remote
layer. I'd like to send the image back to the browser, but I can't
figure out how to do that...
Once I've got a correct gdal dataset, how to read it into the server
response ?
Guillaume,
Not sure to completely understand your use case, but why not just using
OpenLayers to display images from a WMS source ?
If you want to stick with your script, a solution could be to create a PNG file
from the GDAL dataset ( gdal.GetDriverByName('PNG').CreateCopy('the.png',
src_ds) ) and then dump it to the standard output of your webserver after
having written a "ContentType: image/png\n\n" header.
Note : you can do that without having to create a file on the regular
filesystem, but by CreateCopy'ing() instead to /vsimem/the.png and using
gdal.VSIFOpenL() / gdal.VSIFReadL() / gdal.VSIFCloseL() to get the content
into a Python buffer object ( see autotest/gcore/vsifile.py in GDAL source tree
)
Even
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev