Gibt es eine Möglichkeit, Entfernung und Dauer in Google Maps v3 synchron zu berechnen? Ich möchte eine Funktion machen, die 2 Parameter (latLng, latLng) nimmt und die Entfernung (nicht in gerader Linie, sondern durch Straßen) zwischen ihnen (oder die Dauer) zurückgibt.Google Maps API v3 berechnen Entfernung, Dauer Synchron
0
A
Antwort
1
Sie brauchen kein Google. Sie benötigen die Haversine formula:
R = earth’s radius (mean radius = 6,371km)
Δlat = lat2 − lat1
Δlong = long2 − long1
a = sin²(Δlat/2) + cos(lat1) * cos(lat2) * sin²(Δlong/2)
c = 2 * atan2(√a, √(1−a))
d = R * c
+0
Ich weiß über hairsine Formel, aber ich will nicht die Entfernung in gerader Linie berechnen, ich möchte es über Straßen berechnen. – Chris
+0
Macht nichts, dann. Vielleicht möchten Sie das * kleine * Detail zu Ihrer Frage hinzufügen? –
Verwandte Themen
- 1. Google Maps Entfernung/Dauer Marker & Labels
- 2. Google Maps API Geocode synchron
- 3. Google Maps JavaScript API v3
- 4. Google Maps API v3 Markerkoordinaten
- 5. Google Maps API v3 BrowserIsCompatible
- 6. Google Maps API v3: Zeichnungsmanager
- 7. Google Maps API v3 Gemeindegrenze
- 8. Google Maps v3 Fehler
- 9. Google Maps Marker Entfernung?
- 10. jqtouch/google maps api v3 ausgabe
- 11. Google Maps API V3-Methode fitBounds()
- 12. Google Maps Api v3 - getBounds ist undefined
- 13. Google Maps API v3: Kartentyp ändern Ereignis
- 14. Problem mit Google Maps API v3
- 15. Google Maps API v3 Problem mit Firefox
- 16. Google Maps API v3 addDomListener-Methode Fragen?
- 17. Google Maps Api v3, benutzerdefiniertes Cluster-Symbol
- 18. Google Maps v3 API mouseover mit Polygonen?
- 19. Google maps api v3 Suchpolygon ohne Mausereignisse
- 20. Google Maps API V3 - Benutzerdefinierte Fliesen
- 21. google maps api v3 keine etiketten?
- 22. Google Maps API V3 Graue Bereiche
- 23. Google Maps v3 API - Auto Complete (Adresse)
- 24. Erlaubt Google Maps API v3 größere Zoomwerte?
- 25. Google Maps kürzeste Entfernung
- 26. Google Maps v3 OverlayView.getProjection()
- 27. Wie erhält man die Gesamtdistanz mit Google Maps API V3?
- 28. Geocode in Google Maps v3
- 29. Google Earth mit Google Maps API v3 integriert?
- 30. Was ist der API-Schlüssel für Google Maps API V3?
Dies ist synchron nicht möglich. Warum benötigen Sie, dass dies synchron sein muss? – plexer