Page 1 of 1
Traffic Incidents
Posted: Wed Aug 03, 2016 2:38 pm
by GuenterWestphal
Hello everybody,
how can I include traffic incidents in an xMap? A code snippet would be very helpful and much appreciated.
Kind Regards,
Günter
Re: Traffic Incidents
Posted: Fri Aug 05, 2016 10:24 am
by Oliver Heilig
Hello Günter,
one way to display traffic incidents with xMapServer is the PTV FeatureLayer for traffic incidents. If you want to display them with the xServer.NET control, there's a sample "FeatureLayers" at
https://github.com/ptv-logistics/xservernet-bin. If you want to display static xMap image with the FL-TrafficIncidents: I've extended the sample
https://github.com/ptv-logistics/SharpMap.Widgets to add additional xMapServer layers to the base map:
Code: Select all
// test for displaying traffic incidents
var customXMapLayers = new List<XMapServiceReference.Layer>
{
new XMapServiceReference.FeatureLayer {name = "PTV_TrafficIncidents", visible = true}
};
// xmap-bg
sharpMap.Layers.Add(new XMapLayer("xmap-bg", "https://api-eu-test.cloud.ptvgroup.com/xmap/ws/XMap", MapMode.Background)
{ User = "xtok", Password = token, CustomXMapLayers = customXMapLayers });
// insert your application layers
// xmap-fg
sharpMap.Layers.Add(new XMapLayer("xmap-fg", "https://api-eu-test.cloud.ptvgroup.com/xmap/ws/XMap", MapMode.Town)
{ User = "xtok", Password = token, CustomXMapLayers = customXMapLayers });
// insert your application layers
Best regards
Oliver
Re: Traffic Incidents
Posted: Fri Aug 05, 2016 11:26 am
by GuenterWestphal
Hi Oliver,
thanks again for your quick and competent help.
Kind Regards,
Günter