Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
Google Maps Directions API in some cases returns polylines that looks like walk on water, across buildings etc

I am using the following library: googlemaps/google-maps-services-js

I am generating routes by inserting start/end point, waypoints, mode etc.

I am using the "overviewPolyline" that is returned from calling to directions() call to get the route's polyline. When viewing the line on a map it shows (in some cases) routes that goes on water\through buildings\road etc. what I need of course is a line that is coherent with the commute method selected (e.g driving).
enter image description here

now, I made a research online, read documentation, read lots of answers here on SO. I saw t2 options:

  1. replace "\\" (double backslash) with "\"
  2. create some algorithm to calculate it by myself by the "steps" returned from directions() call

My results are:
After trying #1 - It fixed some of the cases. but I still see lot of them. (not sure exactly when it happens and when it isn't) I have some idea that I wanted to check that may be the number of points on the polyline is limited and therefore is happens only in long distance routes. but I couldnt find anything about length-limit of polyline in the documentation

After trying #2 - it didn't make sense to me. and it really didnt work well..

Anyone has a suggestion of a solution for that? (or an approval the polyline route distance, or number of points is limited)

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda