Jon Burgess wrote:
> On Sun, 2009-06-21 at 17:00 -0700, Andrew Ayre wrote:
>> Jon Burgess wrote:
>>> On Sun, 2009-06-21 at 11:28 -0700, Andrew Ayre wrote:
>>>> I've given up on trying to compile pgsql2sqlite for now and instead made 
>>>> some progress on using a georeferenced layer using Gdal. However it 
>>>> seems that Mapnik is clipping the image even though I have set the map 
>>>> size to the size of the bitmap and used the bitmap envelope.
>>>>
>>>> Here are my input files:
>>>>
>>>> http://files.britishideas.com/public/mapping/osmgeoref.png
>>>> http://files.britishideas.com/public/mapping/osmgeoref.pgw
>>>>
>> [snipped]
>>>> And here is the output with the top and bottom of the input PNG missing:
>>>>
>>>> http://files.britishideas.com/public/mapping/demo.png
>>>>
>>>> For completeness here is the output XML file:
>>>>
>>>> http://files.britishideas.com/public/mapping/map.xml
>>>>
>>>> I used red as a background colour to highlight the issue. Any ideas what 
>>>>   I am doing wrong? I'm sure I'm overlooking something silly.
>>> I can not explain it particularly clearly, but I believe the problem is
>>> that the original image was not created in latlong projection, hence the
>>> 800x361 pixels are not square:
>>>
>>> $ gdalinfo osmgeoref.png
>>> Driver: PNG/Portable Network Graphics
>>> Files: osmgeoref.png
>>> Size is 800, 391
>>> Coordinate System is `'
>>> Origin = (-110.812896694075803,32.220948081346208)
>>> Pixel Size = (0.000037724479586,-0.000031870889024)
>>>
>>> Notice how the pixel sizes are different in the two dimensions. If you
>>> adjust the output bitmap to fit this ratio then you get:
>>>
>>> 800 * 0.000037724479586 / 0.000031870889024 = 947
>>>
>>> Then resize the map to this dimension:
>>>
>>> m = Map(947,391,'+proj=latlong +datum=WGS84')
>>>
>>> The final output then looks like the original with no clipping.
>>>
>> Hi Jon,
>>
>> I tried it and the output isn't quite the same as the input. The top of 
>> the image now matches but the bottom doesn't. Notice the orange road at 
>> the very bottom of the input image? It's chopped off the output image.
> 
> No, it looks the same as the input to me.
> 
> There will always be some slight distortion if you are using an image in
> a different projection.

Interesting! So with the same input files and same script you get a 
different output to me. Here is my output:

http://files.britishideas.com/public/mapping/output.png

Notice how it is the same dimensions as yours but missing quite a bit 
off the bottom. Also there are lots of jagged lines because it looks 
like the image has been stretched.

I am using Mapnik 0.6.0 on Windows XP. If you are not using Windows 
perhaps this is a bug in the Windows version?

Andy

-- 
Andy
PGP Key ID: 0xDC1B5864
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to