1

I'm just playing around with Here and this is my escenario for an idea.

Now, if the distance from point 1 and 2 is 3000 meters I want to set a marker ( You are here ) based on a arbitrary distance value, let say I want to add a marker at the 1750 meters point, the market should appears in the half route way.

Is this posible with the actual API?

Thanks in advance!

Enrique Chavez
  • 1,409
  • 1
  • 12
  • 21

1 Answers1

1

Yes it is possible to do with HERE javascript API.

Once you get routing response and create H.geo.LineString out of it, you can calculate distance between each two geo points from that line string using H.geo.Point#distance method. This will help to determine between which two points (lat, lng) is your desired arbitrary distance.

After that you need to calculate angle between these two geo points and use it in method H.geo.Point#walk in order to get exact position of the geo point you need.

Here you can find jsfiddle example which places marker on the simple LineString based on desired arbitrary distance.

Tomas
  • 1,849
  • 1
  • 13
  • 13