How to set WMS layer on concrete envelope

Topics: SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Aug 25, 2014 at 7:16 PM
Edited Aug 25, 2014 at 7:32 PM
Hello,
I'm creating application with map preview for concrete address. When user navigates addres, he wants to add layers from wms at concrete envelope which fits to address. How can i do that?
Actually when I set my wms layer, it is positioned on coordinate (0,0) but i want to set layer on envelope:
//minx="20.683805020560506" miny="51.88775165655495" maxx="21.27542939853875" maxy="52.1448409867012"
my code:
WmsLayer layWms = new WmsLayer("adr_pkt", _wmsHelper.BaseAddress + string.Format(_wmsHelper.WmsParameters,
                dest.MinX.ToString(CultureInfo.InvariantCulture), dest.MinY.ToString(CultureInfo.InvariantCulture),
                (dest.MaxX).ToString(CultureInfo.InvariantCulture), (dest.MaxY).ToString(CultureInfo.InvariantCulture), mapBox1.Width, mapBox1.Height));
            layWms.AddLayer("adr_pkt");
            layWms.SetImageFormat(layWms.OutputFormats[0]);
            layWms.SetOpacity(0.5f);
            layWms.Transparent = true;
            layWms.ContinueOnError = true;
            layWms.TimeOut = 5000;
            layWms.SRID = 4326;
            mapBox1.Map.Layers.Add(layWms);
The Background layer is OpenStreetMap.
Coordinator
Aug 26, 2014 at 7:21 AM
You don't set the extent to show on the layer, you need to use
mapBox1.Map.ZoomToBox(....);
mapBox1.Refresh();
If you use an OpenStreetMap backgroundlayer with an WGS84 (SRID=4326) WMSLayer I assume those images won't align.
Your WMS layer needs to be in WebMercator (SRID=900913 or SRID=3857).