Displaying a simple line with OpenStreetMap

Hello,

I’m very new to OpenStreetMap (less than a week). I’m trying to display a map, and to show on it:

  • 2 markers at (startlat, startlong) and (endlat, endlong).
  • 1 segment that links the 2 markers.

Display of the 2 markers works fine, and is as expected. But I was not able so far to display the segment linking the 2 points.

Here is my HTML file. In this code, %1, %2, %3, %4, %5, %6 correspond to values that are replaced at runtime by actual lat/long positions. The replacement works fine since I can indeed visualize the 2 markers on the map. The code for adding the segment is located in the add_line function.

Sorry for this simple question, and thanks for your assistance.

Regards.

Franck

OpenStreetMap & OpenLayers - Marker Example

Hi Welcome to OSM but your question is about openlayers.com and not about the osm (osm is just the database that openlayers is using)
So better ask your questions here https://openlayers.org/
Regards Sandal man