I am developing a web page using Google map API v3. Is there a way to collect the place or city names the route is going through to get from point A to B? I am using javascript in the page.
3528 次
1 に答える
8
Directions APIのドキュメントをご覧ください。DirectionsResult
の配列を含むオブジェクトが提供されているようですDirectionsRoute
。それぞれDirectionsRoute
に の配列が含まれており、この配列はDirectionsLeg
さらに一連の に分解されDirectionsStep
ます。各ステップからstart_location
および/またはend_location
を取得できます。これらはそれぞれ緯度/経度として表されます。そこから、緯度/経度を都市に変換する方法 (リバース ジオコーディング) をこの回答に引き継がせます。
Googleマップ:緯度/経度の値を指定して国、州/州/地域、都市を取得する方法は?
要するに、Google マップが提供する道順は多くのサブセクションに分割されており、ほとんどの粒度レベルで緯度/経度を引き出して、Google のジオコーディング API で都市名への変換を処理できます。
于 2013-01-13T03:03:20.703 に答える