Feature Layer

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
dstest
Posts: 6
Joined: Mon Aug 06, 2018 11:11 am

Feature Layer

Post by dstest »

Hallo,
ich wir möchten FeatureLayers auf der Karte dynamisch zur Laufzeit ein und ausblenden. U.a. PTV_TruckAttributes,PTV_SpeedPatterns und PTV_TrafficIncidents (soll immer dann immer angezeigt werden unabhängig von routenplanung/xroute). Gibt es hierfür ein Beispiel in .NET wie dies einfach geschehen kann?
MfG
Frank
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Feature Layer

Post by Bernd Welter »

Hello Frank,

please check whether this post gives answers...

https://xserver.ptvgroup.com/forum/view ... layer#p900

The colleagues usually provide samples via GITHUB and if a sample is missing they can check whether they can add one.

Best regards from LINZ AIRPORT / Austria,
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:
dstest
Posts: 6
Joined: Mon Aug 06, 2018 11:11 am

Re: Feature Layer

Post by dstest »

Hello Bernd,
thank you for the answer.
i have seen the example. Thats exact what we need. But it doesn't work in my project with the .net mapcontrol we use.

Feature Layer Classes are the same. Call of the Procedure is the same. Only other thing is the kind of the Mapcontrol:

Private flPresenter As dsoft.logit.mgxsharp.FeatureLayer.FeatureLayerPresenter

Private Sub InitFeatureLayers()
flPresenter = New mgxsharp.FeatureLayer.FeatureLayerPresenter(pxFormsMap.WrappedMap)
flPresenter.ReferenceTime = Now
flPresenter.UseTrafficIncidents = True
flPresenter.UseRestrictionZones = False
flPresenter.UseTruckAttributes = False
flPresenter.UseSpeedPatterns = False
flPresenter.RefreshMap()
End Sub

Is there a problem with the mapcontrol we use? What do i have to change?

BR
Frank
Attachments
2018-10-26 16_00_33-(Debugging) - Microsoft Visual Studio.png
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Feature Layer

Post by Oliver Heilig »

Hello Frank,

i guess you are referring to thesample "FeatureLayers" here:

https://github.com/ptv-logistics/xserver.net-bin

We have changed the sample to fit to the latest version (1.6) of the control. This has some internal interface changes regarding xMapServe-access. To make this code work you can either revert to a pre-October version

https://github.com/ptv-logistics/xserve ... rovider.cs

or use the latest version 1.6.0 (inside the lib folder) in your project. I would recommend this anyways, because this will also be next supported version, and also abailable on GitHub

https://github.com/ptv-logistics/xserver.net

Oli
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
dstest
Posts: 6
Joined: Mon Aug 06, 2018 11:11 am

Re: Feature Layer

Post by dstest »

Hallo Oliver,
leider konnte das Problem mit Komponentenupdate und Verwendung des neuen Feature-Layer Beispiels nicht behoben werden.
Die Fehlermeldung bleibt gleich. Ich habe ein Testprojekt hierzu hinzugefügt, damit Sie das Problem sehen könne.
Gruß
Frank
Attachments
Maptest.zip
(1.23 MiB) Downloaded 374 times
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Feature Layer

Post by Oliver Heilig »

Hello Frank,

i've reviewed the sample and found the problem is that you must initialize the map with specific providers, and not just by setting xMapUrl.

I must admit this is a bit cumbersome, but was required because the default didn't support the ReferenceTime property, which is required for FeatureLayer. I've added this property to the basic xmap-1 provider. Now the special implementation isn't needed, and you can change ReferenceTime with the standard inplementation. Take a look at the new sample.

But this requires the latest revision of the control, which is available here: https://github.com/ptv-logistics/xserve ... master/Lib

Oli
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
dstest
Posts: 6
Joined: Mon Aug 06, 2018 11:11 am

Re: Feature Layer

Post by dstest »

Hello Oliver,

thank you for the example. Now Feature Layers Work fine in our Aplication.

But i have found another issue. The Function of Map MouseToGeo now raises an error caused by Ptv.Components.Projections. Please find attached the Screenshot. I think i need the latest Projection Component too. Can you help me with that.

BR
Frank
Attachments
2018-11-19 13_19_07-Debugging.png
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Feature Layer

Post by Oliver Heilig »

Hi Franke,

if you are using the transform functions with a specific coordinate system, you need to make sure you have the Ptv.Components.Projections.dll. But if you are just using standard WGS84 coordinates, you can also omit the parameter, because this is the standard format of the control.

Code: Select all

var geo = map.MouseToGeo(e);
https://github.com/ptv-logistics/xserve ... ips.cs#L39

My recommendation is to always use WGS84 (x=lng,y=lat) coordinates in you project, so

[*] Omit the coordinate format for the map control, the default is WGS
[*] For xServer-1 requests use "OG_GEODECIMAL" to use WGS
[*] For xServer-2 requests, omit the, the default is WGS

Edit by JCL: fixed spelling error in xServer-1 coordinate format
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
Post Reply