Page 1 of 1

How to use "Integration Samples" in stand-alone page?

Posted: Tue Jul 09, 2024 1:45 pm
by Bernd Welter
Hi there,

one of my partners is a fan of the built-in integration samples available through the standard xServer2. Now he wants to know how what surrounding, "invisible" code he needs to wrap around the given code blocks to make them work outside the xServer - also in combination with PTV xServer Internet 2.

Can we get some guidance?
integration samples xS2.png
Sample "Calculating A Route"

Bernd

PS: as I am not developing in JavaScript by myself, I assume he needs some
  • include statements
  • Token handling

Re: How to use "Integration Samples" in stand-alone page?

Posted: Wed Jul 10, 2024 7:25 am
by Bernd Welter
Here's the feedback from DEV:
Please check the following content of the documentation: Furthermore you need
  • Leaflet (very mighty 3rd party mapping framework)
  • leaflet-xserver (PTV originated leaflet add on, download via github)
Some of the samples may use further third party components such as
  • proj4js : JavaScript library to transform coordinates from one coordinate system to another, including datum transformations
  • OpenLayers (instead of leaflet)
In any case you need to "speak" JavaScript fluently to build your own sample.

Re: How to use "Integration Samples" in stand-alone page?

Posted: Wed Jul 10, 2024 9:29 am
by MISTERX
Hello Bernd!

Your original question spontaneously triggered in me the desire to try out the described scenario myself.

Leaflet itself is a well-documented framework. You can use it to quickly create an HTML page that generates a map with POIs, routes, etc. As always with web development, knowledge of JS and HTML is helpful. With the information from https://leafletjs.com/reference.html it was easy to achieve the goal. :!: However, this solution uses the OSM map and no operations of an xServer.
In the second step, I wanted to replace the OSM map with the PTV, HERE map. This also worked, but with the restriction that the xServer did NOT require authentication. :idea: The attempt to address the xServer Internet with the usual construct

Code: Select all

https://xtok:[PASSCODE]@[xserverURL]/services/rest/XMap/tile/{z}/{x}/{y}
failed. I found the solution in the xS2-PTV-Developer's-Guide in a sub-item to a sub-item titled "Using xServer internet with JavaScript" - a link you had received from DEV.

If I could give up to five stars, you would get 4.5. I'm keeping the half star because I think that hardly anyone will find the reference to the JS required for authentication on their own in the depths of the developer thread. Since I "speak" JS fluently, this would prevent me from doing a deep search in the PTV-xS2-Developer's-Guide.

In my opinion, it would be better to put the instructions for using xServer Internet on the same level as using xServer OnPrem (hence the links in DEV's feedback):
  • Using xServer with Java
  • Using xServer Internet with Java