WMS and its coordinates

Dec 11, 2009 at 3:05 PM
Edited Dec 11, 2009 at 3:17 PM

Hi @ all,

I'm going to load maps from a WMS Server. I just displayed the Tiles, but in the edges they don't really fit. Here is the Code i used in the MakeImageURL Method:

case MapType.GeoContent:
var p = new MercatorProjection();
var mapFrom = p.FromPixelToLatLng(p.FromTileXYToPixel(new Point(pos.X + 0, pos.Y + 1)), zoom);
var mapTo = p.FromPixelToLatLng(p.FromTileXYToPixel(new Point(pos.X + 1, pos.Y - 0)), zoom);

FormString format = s => ((double)s).ToString().Replace(",", ".");

var arg0 = format(mapFrom.Lng);
var arg1 = format(mapFrom.Lat);

var arg2 = format(mapTo.Lng);
var arg3 = format(mapTo.Lat);

return string.Format("{0},{1},{2},{3}", arg0, arg1, arg2, arg3);

(Sorry, code Snippet Tool didn't work)

Does anyon have an idea, what i did wrong? i tried some other resolutions, too, but the tiles didn't fit, too.



PS: The link doesn't work, because i deletes the accountinformations.

Dec 11, 2009 at 6:00 PM

hard to tell...

Dec 14, 2009 at 6:08 AM

Or another question:

Is this the right way to include wms maps when they are in the Open GIS Standard?

Dec 14, 2009 at 4:36 PM

i really do not know, if it work, perfect ;}

Jan 18, 2010 at 8:44 AM

you must set the ratio of output image.for example in sharpmap you must set:

map.PixelAspectRatio = (map.Size.Width / (double)map.Size.Height) / (BBox.Width / BBox.Height);

May 4, 2010 at 7:51 PM

check http://greatmaps.codeplex.com/Thread/View.aspx?ThreadId=211166 runs perfectly ;}