Traffic jam updates not refreshing properly in Map

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
nirengp
Posts: 15
Joined: Wed Jun 28, 2017 12:54 pm

Traffic jam updates not refreshing properly in Map

Post by nirengp »

Hello,

We are displaying Traffic updates with PTV_TrafficIncidents layer in xMap.
And on our PTV xServer Content Update Service is configured to update traffic data every 15 minutes.

In our map traffic jam is displayed:
Traffic_display.png
After some time when traffic jam clears away map is displayed:
AfterNoTraffic_display.png
So as you can see, the traffic jam symbols are gone when traffic jam clears up, however red marker is till show in the Map. And this traffic jam marker does not go way from Map. After the Map is closed and opened again then clear map is displayed.

So questions are:
1) Why the traffic jam red marker not going away on it's own. Do we have to do some kind of refresh to remove it?
2) Does the Ptv.XServer.Controls.Map.Map class refresh traffic data automatically or do we have to implement refresh logic on our own?

Any guidance will be appreciated.

Thanks
Regards,
Niren Patel
Core Developer
BRABENDER tech
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Traffic jam updates not refreshing properly in Map

Post by Bernd Welter »

Hello NIren,

I am not sure
- whether this is a bug in the xServer.NET or the FeatureLayer implementation
- an improper application code

I therefore created a task (MPXSRV-4405) for this.

Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Traffic jam updates not refreshing properly in Map

Post by Oliver Heilig »

This looks more like a refresh problem on the client. The background-tiles (lines) are stored in-memory, and it doesn't seem to refresh.

Assuming you are using the implementation for xserver-1 from the sample "FeatureLayers" here https://github.com/ptv-logistics/xserver.net-samples

* Do you call presenter.RefreshMap()?
* Do you set the referenceTime for the FeatureLayer? This is important, because this would also be used to calculate the cache-id.
* Another option would be to disable the in-memory cache at startup of your application with Ptv.XServer.Controls.Map.GlobalOptions.TileCacheSize = 0;

Oli
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
nirengp
Posts: 15
Joined: Wed Jun 28, 2017 12:54 pm

Re: Traffic jam updates not refreshing properly in Map

Post by nirengp »

Hello Oliver / Bernd,

Thanks for the details.

* We are not specifically calling presenter.RefreshMap().
* We have not set the referenceTime for the FeatureLayer.
* After disabling the in-memory cache with Ptv.XServer.Controls.Map.GlobalOptions.TileCacheSize = 0, the map is refreshing traffic details correctly.

So now, question is should we keep in-memory cache disabled permanently or is their better option to configure cache more efficiently, so that in-memory cache can still be used. I am guessing in-memory cache is used to improve efficiency of map tile display.

I was checking FeatureLayers class properties. However, have not understood the correct usage of ReferenceTime, ShowOnlyRelevantByTime and TimeConsiderationScenario. Also, checked Xmap2LayerFactoryTest.

As per what I understood,
1) Value set for TimeConsiderationScenario & TimeSpan will determine at which duration the cache will be refreshed automatically. However how does OptimisticTimeConsideration, SnapshotTimeConsideration and TimeSpanConsideration work is not clear.
2) If we set the ReferenceTime to the time Map was loaded and ShowOnlyRelevantByTime = true the cache will be refreshed automatically at some fixed interval.

Can setting some or all of these properties allow to make cache usage more efficiently and still the map get's refreshed correctly. Please correct my understanding and guide how they should be configured.

Thanks
Regards,
Niren Patel
Core Developer
BRABENDER tech
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Traffic jam updates not refreshing properly in Map

Post by Oliver Heilig »

Hello Niren,

the methods you mention refer on xMapserver-2, your screenshots indicate you are using xMapServer-1.

The reference implementation in https://github.com/ptv-logistics/xserver.net-samples

xserver-1: FeatureLayers
xserver-2: Xmap2LayerFactoryTest

For xmap-1 to update the FeatureLayer for the current time, you have to set referenceTime to DateTime.Now time and call refresh, like here https://github.com/ptv-logistics/xserve ... cs#L53-L61 It doesn't update automatically (you could trigger it by a timer though).

Please verify:

* Which xServer are you using, xserver-1 or xserver-2?
* Do you use xserver on premise or xserver-internet?
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
nirengp
Posts: 15
Joined: Wed Jun 28, 2017 12:54 pm

Re: Traffic jam updates not refreshing properly in Map

Post by nirengp »

Hello Oli,

Thanks for the details.

And you are right, we are using XServer-1 on premise.
So we will implement timer to refresh traffic details as per the reference implementation in sample.

Thanks.
Regards,
Niren Patel
Core Developer
BRABENDER tech
Post Reply