[OSM-dev] Scale of downloaded images seems to vary.

Tom Hughes tom at compton.nu
Thu Jan 11 10:55:42 UTC 2018


On 11/01/18 10:47, Tom Hughes wrote:
> 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?

Per 
https://en.wikipedia.org/wiki/Portable_Network_Graphics#Ancillary_chunks 
I think that a pHYs chunk could store it but our images don't appear to 
have that:

% ./pngcheck -v map.png
File: map.png (205670 bytes)
   chunk IHDR at offset 0x0000c, length 13
     1192 x 1018 image, 32-bit RGB+alpha, non-interlaced
   chunk IDAT at offset 0x00025, length 32768
     zlib: deflated, 32K window, default compression
   chunk IDAT at offset 0x08031, length 32768
   chunk IDAT at offset 0x1003d, length 32768
   chunk IDAT at offset 0x18049, length 32768
   chunk IDAT at offset 0x20055, length 32768
   chunk IDAT at offset 0x28061, length 32768
   chunk IDAT at offset 0x3006d, length 8933
   chunk IEND at offset 0x3235e, length 0
No errors detected in map.png (9 chunks, 95.8% compression).

I suspect 72 is just an OS default.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://compton.nu/



More information about the dev mailing list