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.

Re: Display TruckAttributes with Leaflet and OpenLayers

Postby Oliver Heilig » Mon Apr 09, 2018 2:54 pm

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:

javascript code
// 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:

xml code
<!-- 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/xserverjs/premium-samples/lrm-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-guide/web-server/reverse-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
PTV GROUP - Germany

https://github.com/oliverheilig/
User avatar
Oliver Heilig
 
Posts: 112
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany

Re: Display TruckAttributes with Leaflet and OpenLayers

Postby Bernd Welter » Mon Apr 09, 2018 3:43 pm

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
Manager Technical Consulting & Requirement Engineering
Senior Technical Consultant Developer Components
PTV GROUP - Germany

Bernd at Youtube
User avatar
Bernd Welter
Site Admin
 
Posts: 1179
Joined: Mon Apr 14, 2014 10:28 am

Re: Display TruckAttributes with Leaflet and OpenLayers

Postby Oliver Heilig » Tue Apr 10, 2018 9:11 am

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
PTV GROUP - Germany

https://github.com/oliverheilig/
User avatar
Oliver Heilig
 
Posts: 112
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany

Previous

Return to PTV Webclients (Ajax, Leaflet, OpenLayers, WMS, ...) (Admin=LNM)