Menu

#1 Tiles are draw at wrong proportions

open
nobody
None
5
2012-02-15
2012-02-15
Fossdal
No

the tiles from OpenStreetMap are drawned at wrong propertions

try to modify GdiRenderer.DoDrawImage(
to this for debug info

protected override void DoDrawImage(View view, Image image, GeoCoordinateBox box)
{
PointF target_top_left = view.ConvertToTargetCoordinates(this.Target, new GeoCoordinate(box.MaxLat, box.MinLon)).ConvertToDrawing();
PointF target_bottom_right = view.ConvertToTargetCoordinates(this.Target, new GeoCoordinate(box.MinLat, box.MaxLon)).ConvertToDrawing();

try
{
var recF = new RectangleF(
target_top_left,
new SizeF(target_bottom_right.X - target_top_left.X + 1f,target_bottom_right.Y - target_top_left.Y + 1f));

Debug.WriteLine("DoDrawImage box at zoom "+view.ZoomFactor+" at pos "+ view.Box.Center +" width: "+recF.Width+" height: "+recF.Height);
this.Target.Graphics.DrawImage(image, recF);
}
catch (Exception)
{
// nasty GDI-bug!
//http://blog.lavablast.com/post/2007/11/The-Mysterious-Parameter-Is-Not-Valid-Exception.aspx
}
}

and if you try to center the map at 62.0, -7.0 at zoom level 17
width 257
height 181.2

if you try to center the map to 0,0 at zoom level 17
widh 257
height 385

the width and height of a openstreetmap tile should always be 256x256 at a integer zoom level

Discussion