Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

321
Views
Dibujar polilínea con GPS en google map por Javascript

Estoy creando un sitio web con google-map donde configuro un destino entre mi ubicación y mi ubicación de destino. Después de configurar la distancia, obtuve con éxito la ruta para el destino de Google Maps. Ahora, empiezo a ir desde mi ubicación hasta el destino. Pero aquí está el problema, porque necesito dibujar polilíneas en Google Maps donde quiera que me mueva, pero mi GPS no me dio la latitud y longitud exactas, y el GPS también se actualiza/se mueve ligeramente aunque mi dispositivo no se mueve.

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tienes dos preguntas aquí en una. Uno es para dibujar una polilínea, otro es para lo que se llama "deriva GPS". La deriva del GPS está relacionada con el dibujo de polilíneas: puede investigar eso por separado (respuesta corta: no puede hacer nada al respecto, el GPS no es tan preciso).

Para las polilíneas, Google tiene muy buena documentación: https://developers.google.com/maps/documentation/javascript/examples/polyline-simple

Aquí hay un ejemplo de sus documentos.

 // This example creates a 2-pixel-wide red polyline showing the path of // the first trans-Pacific flight between Oakland, CA, and Brisbane, // Australia which was made by Charles Kingsford Smith. function initMap() { const map = new google.maps.Map(document.getElementById("map"), { zoom: 3, center: { lat: 0, lng: -180 }, mapTypeId: "terrain", }); const flightPlanCoordinates = [{ lat: 37.772, lng: -122.214 }, { lat: 21.291, lng: -157.821 }, { lat: -18.142, lng: 178.431 }, { lat: -27.467, lng: 153.027 }, ]; const flightPath = new google.maps.Polyline({ path: flightPlanCoordinates, geodesic: true, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2, }); flightPath.setMap(map); }
 <div id="map" style="height: 300px"></div> <script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap&v=weekly&channel=2" async></script>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!