Display TruckAttributes with Leaflet and OpenLayers

This forum deals with any kind of web based client technology, whether it is the well known java script based Ajax servlet or the upcoming approaches such as Leaflet, OpenLayers and so on.
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Display TruckAttributes with Leaflet and OpenLayers

Post by Oliver Heilig »

Hello Sebastian,

i've verified the sample with a stock xMapServer 1.24.0 and the Luxemburg demo map. I've simplified the initialization, so in the index.html you can set:

Code: Select all

// setting the urls
var onPremiseUrl = "http://127.0.0.1:50010"; // local xServer Url
var cluster = ''; // when using xServer-internet, set empty for local xServer

POIs and TruckAttributes should work out-of-the box without custom profiles. The TrafficInformation configuration depends on the configuration of the TrafficInfo-Loader. If this doesn't work you should check the CORS configration in \webapps\xmap\WEB-INF\web.xml. It should contain:

Code: Select all

<!-- comment out the following element to deactivate CORS support: -->
<filter-mapping>
	<filter-name>CORS</filter-name>
	<url-pattern>/rs/*</url-pattern>
</filter-mapping>
Some notes about this sample and the JavaScript samples in general (versus productive applications).
  • We don't recommend using 'SMOLayer' for traffic incidents and 'RoadEditorLayer' for truck attributes, since this technology is deprecated. You should use PTV FeatureLayer instead. FeatureLayer is a universal technology for both mapping and routing. And it's supported both for xServer-1 https://ptv-logistics.github.io/fl-labs/ and xServer-2 https://ptv-logistics.github.io/xserver ... xserver-2/
  • Most samples can be started directly by opening the file in a browser (but since last week not with Chrome anymore). We don't recommend this for productive environments. You should run you code as page hosted within a web server.
  • While it is possible to access xServer directly from a web client (if you get Tomcat CORS configration right), we don't recommend this for a productive environment. You should either access it via a middleware or use a proxy line NGINX https://docs.nginx.com/nginx/admin-guid ... rse-proxy/ and supply SSL, CORS, Auth, ... there.
  • You don't have all these problems if you use xServer internet :D .
Oli
Last edited by Oliver Heilig on Mon Apr 09, 2018 5:07 pm, edited 1 time in total.
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Display TruckAttributes with Leaflet and OpenLayers

Post by Bernd Welter »

Hello Oliver,

one important notice about the FeatureLayer:
Though the usage of FeatureLayers is supported in xServer1 and xServer2 we do not offer an administration interface for the content. So this new, future approach still requires some patience. We work on those approaches as far as I know but it is not there yet.

If a customer wants to administrate his own truck attributes he would have to use the traditional combination of Map&Guide RoadEditor + (Binary files / database approach).

So I recommend to get in touch with the local consultants to gather functional and technical requirements for an optimal solution.

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: Display TruckAttributes with Leaflet and OpenLayers

Post by Oliver Heilig »

Hi Bernd,

you are right. One valid use-case for RoadEditor is integration of segment modifications created with map&guide desktop into your xServer.

Oli
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

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