« Return to Thread: Raster Layer is Clipped

Re: Raster Layer is Clipped

by ajayre :: Rate this Message:

Reply to Author | View in Thread

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.

Andy

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

 « Return to Thread: Raster Layer is Clipped