Can desktop edition support WMS?
Can desktop edition support WMS?
Hello duong,
Yes, you can simply use WmsRasterLayer to load the data from your wms server.
Regards,
Gary
Thanks Gary, I load a map from my geoserver succefully.
But, there is a problem:
+ I use MapClick event to get coordinate of worldmap: Result is correct.
+ I use MouseMove event to get current coordinates of worldmap: Result is not correct.
I 've change values of CurrentExtent, the result seem to be change. I guess that My CurrentExtent affect to the result and there are some relations between CurrentExtend, Dimension of Frame which contains map, CurrentScale …
Please explain me some term and their relationship: CurrentExtent, CurrentScale, ZoomLever.
This my code:
private void Form1_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
WmsRasterLayer ws = new WmsRasterLayer(new Uri(“192.168.6.177:8181/geoserver/wms”));
ws.Name = “BanDoNen”;
ws.Parameters.Add(“layers”, “BanDoNen”);
ws.ActiveLayerNames.Add(“BanDoNen”);
ws.Open();
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(ws);
winformsMap1.Overlays.Add(layerOverlay);
winformsMap1.CurrentExtent = new RectangleShape(100, 25, 125, 7);
winformsMap1.CurrentScale = 5000000;
Feature f = new Feature(107, 16);
ScreenPointF screenPoint = ExtentHelper.ToScreenCoordinate(new RectangleShape(100, 25, 125, 7), f, 1328, 706);
winformsMap1.MapClick += new EventHandler<MapClickWinformsMapEventArgs>(winformsMap1_Click);
winformsMap1.CenterAt(screenPoint);
winformsMap1.Refresh();
}
private void winformsMap1_MouseMove(object sender, MouseEventArgs e)
{
ScreenPointF screenPoint = new ScreenPointF(e.X, e.Y);
PointShape f = ExtentHelper.ToWorldCoordinate(new RectangleShape(100, 25, 125, 7), screenPoint, 1328, 706);
this.label1.Text = “Coordinate(” + f.X + “,” + f.Y + “)”;
}
private void winformsMap1_Click(object sender, MapClickWinformsMapEventArgs e)
{
this.label2.Text = “Coordinate(” + e.WorldX.ToString(“N4”, CultureInfo.InvariantCulture) + “,” + e.WorldY.ToString(“N4”, CultureInfo.InvariantCulture) + “)”;
}
Hi Duong,
Thanks for your question!
Both the CurrentExtent and the CurrentScale values are values that are applied to the map right away. Thus their name of 'Current".
So if you want the current extent (view) of the map to include a specific RectangleShape you set the CurrentExtent of the map to some value.
I would not recommend entering direct values for the CurrentExtent or Width or Height values as we have special parameters setup for these values.
Perhaps the following might provide you with the correct values:
PointShape pointShape = ExtentHelper.ToWorldCoordinate(winformsMap1.CurrentExtent, new ScreenPointF(e.X, e.Y), winformsMap1.Width, winformsMap1.Height);
OK, It 's work correctly. Thanks Ryan a lot.
However, I want to understand the meaning of each values CurrentScale, CurrentExtend in details. Pls, explain or show me the way to find the official documents. I want to be clear!
DuongNV.
Hi Duong,
These elements are pretty self-explanatory.
The Current Extent is the current Rectangle Shape that defines the bounds of the map.
The CurrentScale is the current scale value of the map.
You are welcome to review our API Documentation located in our Wiki at this link: wiki.thinkgeo.com/wiki/Map_S...umentation