国境を強調表示し、州または都市をジオコーディングした後 (言語と緯度を取得したときに) 影を付ける必要があるシナリオがあります。
都市をポリラインで囲むには、都市の完全な情報が必要ですか? または、マップ API でこれを行う方法はありますか。
国境を強調表示し、州または都市をジオコーディングした後 (言語と緯度を取得したときに) 影を付ける必要があるシナリオがあります。
都市をポリラインで囲むには、都市の完全な情報が必要ですか? または、マップ API でこれを行う方法はありますか。
真実。Google はこの機能を提供していません。それで、私たちができることは... 州の国境の緯度/経度を取得できます。また、ポリゴンを自分で描画する必要があります。
このJSオブジェクトを使用しました。そして、それを Google マップ オブジェクト ( google.maps.LatLng
) に変更しました。
例えば:
var statesobj = {"AK": [new google.maps.LatLng(70.0187, -141.0205),
new google.maps.LatLng(70.1292, -141.7291),
new google.maps.LatLng(70.4515, -144.8163)]}
だから、今は簡単です。これらの緯度/経度をループします。また、米国のすべての州でポリゴンを描画できます。
これが私が思いついた解決策です。あなたがそれを行うためのより良いアイデアを知っているなら。共有してください。
Google Geo Charts を試すこともできます。
http://code.google.com/apis/chart/interactive/docs/gallery/geochart.html
Google Maps API では、都市の境界を取得できません。ただし、座標を取得できる場所が他にもいくつかあります。
Flickr API
人がタグ付けした写真に基づく Flickr API がありますが、写真にタグ付けした人ほど正確ではありません。したがって、ブートストラップには十分ですが、おそらく本番環境には適していません: http://karya-blog.blogspot.com/2012/ 12/fetching-city-polygons-with-flickr-api.html
ナチュラル アース データ
正確な代替手段は www.naturalearthdata.com です。そこからデータを取得するには、2 つのリクエストを作成する必要があります。1 つは都市名を指定し、もう 1 つは ID を指定してパラメーターを取得します。
unlock.edina.ac.uk/ws/search?name=berlin&gazetteer=naturalearth&format=json
その後
unlock.edina.ac.uk/ws/footprintLookup?format=json&identifier=14126951
そして、あなたは設定されています:)
マプゼン
データをプリフェッチできる場合は、Mapzen を使用してください。完全でかなり正確なデータベースがあります: https://mapzen.com/data/borders/
残念ながら、Google マップ API は地域 (国、州、都市など) の形状にアクセスする手段を提供していません。
領域を強調したい場合は、他の場所で取得したデータに基づいてカスタム オーバーレイを作成する必要があります。
Now the basic map example includes a "mashup" of data. When identifying data is fed to the web service, the resulting output can pinpoint locations on the map. It shows how a geographic Map Marker is placed on the map to identify a specific location. Map Markers can use the default icon (shown) or a custom image, gauge, or even a chart. Optionally, the map can be configured to display a Map Marker Info window, containing additional location-specific data, when the marker is clicked.
It includes data-driven, colored regions (in this case, representing postal codes) overlaid a map of eg Washington, DC. Logi Info can work with GIS boundary data to produce region overlays for states, counties, cities, school districts, and other areas. Like the Map Marker, regions can be clicked to display a pop-up information window with detail data.