Hi,
I am using your LoadAWmaImage.xaml.cs from How DoISamples (Satellite Image) to acces to my local WMS server and get features.
My code looks like:
private void MyLayer()
{
wpfMap1.Overlays.Clear();
wpfMap1.CurrentExtent = new RectangleShape(-122.3425, 37.8233, -122.2537, 37.8011);
WebProxy wP = new WebProxy("127.0.0.1", 8888);
WmsRasterLayer wmsImageLayer = new WmsRasterLayer(new Uri("172.16.6.9:8080/geoserver/amazon/wms"), wP);
wmsImageLayer.UpperThreshold = double.MaxValue;
wmsImageLayer.LowerThreshold = 0;
wmsImageLayer.Open();
wmsImageLayer.ActiveLayerNames.Add("wgs_1984_PolylineCamera_1");
wmsImageLayer.Exceptions = "application/vnd.ogc.se_xml";
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("wmsImageLayer", wmsImageLayer);
wpfMap1.Overlays.Add(staticOverlay);
wmsImageLayer.Close();
wpfMap1.Refresh();
}
private void wpfMap1_MapClick(object sender, MapClickWpfMapEventArgs e)
{
try {
LayerOverlay layerOverlay = (LayerOverlay)wpfMap1.Overlays[0];
ScreenPointF sp = new ScreenPointF((float)e.ScreenX, (float)e.ScreenY);
WmsRasterLayer wL = (WmsRasterLayer)layerOverlay.Layers[0];
Dictionary<String, Collection<Feature>> ft = wL.GetFeatureInfo(sp, "text/html", 16);
Debug.Write("vsm7wms: ft" + ft.Count);
} catch(Exception ex) {
Debug.Write("vsm7wms:" + ex.Message.ToString());
}
}
Howewer, when I click on map it send malformed WMS request:
GET 172.16.6.9:8080/geoserver/amazon/wms?&SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=1.1.1&LAYERS=wgs_1984_PolylineCamera_1
&QUERY_LAYERS=wgs_1984_PolylineCamera_1&STYLES=
&BBOX=-122.313537597656,37.8025817871094,-122.312164306641,37.803955078125
&FEATURE_COUNT=16&WIDTH=256&HEIGHT=256&FORMAT=image/png
&INFO_FORMAT=text/html&SRS=EPSG:4326&X=268&Y=451
As you can see: WIDTH=256&HEIGHT=256 but X=268&Y=451
So, WMS server responce: <ServiceException code="InvalidPoint"> 268, 451 not in dimensions of image: 256, 256
What I am doing wrong ?
Thank you,
MIchael