[Qgis-developer] qgis web

Richard Duivenvoorde rdmailings at duif.net
Sun Feb 13 06:06:09 EST 2011


Mohammed Rashad wrote:
> How to render a shapefile to an image file so that it can be reused on a 
> web page.
> Anyone please send a me a minimal code or tell me where and what to 
> modify. I looked src/mapserver folder but I cant get the code for it
> 
> Atleast please tell me the file to modify to render a vector file(shape) 
> to an image file

Hi,

you're not very clear what exactly you want.

But, if you want a one time imagefile of a map from a shapefile, use 
'Save as Image' from the File menu.

If you want to do some python coding for a plugin, please have a look in 
to for example the "Html Image Map plugin", that one saves an image from 
current map. Minimal code from Python console in a running qgis:

qgis.utils.iface.mapCanvas().saveAsImage("/tmp/mymap.png")

If you want a server process generating maps from the (changing?) 
shapefile, you need a WMS (Web Mapping Server). You can use QGIS 
mapserver for that: http://karlinapp.ethz.ch/qgis_wms/. But even more 
famous ones like Minnesote Mapserver (mapserver.org), or Geoserver 
(geoserver.org).


Regards,

Richard Duivenvoorde


More information about the Qgis-developer mailing list