On 11/01/18 10:38, Bjoern Hassler wrote:
(1) DPI on exported images
Actually isn't the real problem here just needing to know what DPI
is being being assumed by mapnik when rendering?
IIRC it's 96dpi?
As you say (and also in the link Yves posted) it's about 90.7dpi,
standard pixel size of 0.28 millimeters as defined by the OGC (Open
Geospatial Consortium) SLD (Styled Layer Descriptor). However, the
images downloaded are claiming 72dpi. I need to check whether they don't
have dpi metadata (and therefore my OS assumes 72) or whether they are
tagged incorrectly.
Either way, that sounds like a discrepancy though, right?
If you're fetching PNG then does PNG even have a way of specifying the
DPI in the format?
Frankly it's not something I'm going to lose much sleep over and may
well not be anything we have any control over.
(2) "project the bounding box from EPSG:4326 lat/lon to spherical
mercator which gives us coordinates on a projected sheet measuring
roughly 40075016m on each edge (2 x PI x assumed earth radius)."
That's very helpful. What is the function (of latitude) that maps the
sheet to the smaller scale map? I'd assumed cos(lat), but it seems to be
more complicated. I can dig around, but if you happen to know it, thenÂ
don't need to dig around. The code has this:
  scale = float(form.getvalue("scale"))
  width = int(bbox.width() / scale / 0.00028)
  height = int(bbox.height() / scale / 0.00028)
where I assume form.getvalue fetches the "mapnik_" form. So,
equivalently, it would be about the variation of the bbox.width() with
lat, in the  spherical mercator projection. Any thoughts on this?
I don't think there is one simple function. We (or rather mapnik) just
uses the proj4 library like everybody else that does this stuff. You can
see the precise configuration we feed it a few lines above that in the
source.
It then does a load of funky maths that I'm not even going to try to
understand.
(3) Filing a bug: Clearly there's nothing wrong with the rendering (bar
issue 1 above?). However, one might say that the 'scale' label on the
box is misleading to a casual user, as users would assume geographical
scale, rather than mapnik_scale. Would it be helpful to users to have a
few words underneath to the scale box, saying "Note that this is not
geographical scale." and link to page that explained how to convert?
I'm not really sure what you mean by geographical scale?
Like any other projected map the value we show is the amount by which
the projected sheet is scaled. Basically you unwrap the globe (or part
of the globe that you are dealing with) and do the necessary funky
stretching to make it a flat sheet than you scale that sheet by the
specified amount. That is how every printed map you see works.
Because this is a digital version there is then a second step of how
many pixels you use for each physical unit.
Tom
--
Tom Hughes (t...@compton.nu)
http://compton.nu/
_______________________________________________
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev