Traffic Incidents

Within this forum we want to offer discussions all around our .NET based Map control including all .Net-language specific questions concerning calls of the xServer-API. Attention: xServer-relevant concepts can be found in further forums such as xRoute or xTour.
Post Reply
GuenterWestphal
Posts: 5
Joined: Thu Jul 28, 2016 11:52 am

Traffic Incidents

Post 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
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Traffic Incidents

Post 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
FLTrafficIncidents.png
Best regards
Oliver
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
GuenterWestphal
Posts: 5
Joined: Thu Jul 28, 2016 11:52 am

Re: Traffic Incidents

Post by GuenterWestphal »

Hi Oliver,

thanks again for your quick and competent help.

Kind Regards,

Günter
Post Reply