[QGIS-Developer] Convert from mapunits to pixels
Tom Chadwin
tom.chadwin at nnpa.org.uk
Fri Nov 10 02:47:21 PST 2017
Thanks for the link - this looks relevant:
map_units_per_pixel = (wgs84_maximum.x() -
wgs84_minimum.x())/self.iface.mapCanvas().width()
To explain more fully, my plugin exports QGIS projects as webmaps. I am
working on Leaflet webmaps at the moment, and, as far as I can see, Leaflet
only supports styling (point feature radius, stroke width etc) in pixels.
The plugin therefore works when styling units are pixels, but fails if they
are mapunits.
I therefore need to understand how QGIS (or whatever) calculates the pixel
dimensions for something on screen when the QGIS units are mapunits. In
other words, some formula for converting map units to pixels (presumably
involving scale/zoom as a parameter).
Hope this makes sense
Tom
-----
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
More information about the QGIS-Developer
mailing list