Page 2 of 2

Re: Display TruckAttributes with Leaflet and OpenLayers

PostPosted: Mon Apr 09, 2018 2:54 pm
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:

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

Re: Display TruckAttributes with Leaflet and OpenLayers

PostPosted: Mon Apr 09, 2018 3:43 pm
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

Re: Display TruckAttributes with Leaflet and OpenLayers

PostPosted: Tue Apr 10, 2018 9:11 am
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