特定の場所の地図を表示し、地図上に重要なポイントをピン留めします。これはすでに達成されています... 私がやろうとしているのは、次の機能を追加することです: ユーザーがこのマップの既存の境界内にいる場合、これらのピンを配置して、ユーザーの現在の場所を 10 倍に拡大して表示します。ユーザーがマップの範囲内にいない場合は、関心のあるピンを含むマップを表示するだけです。
マップの既存の境界に関係なくユーザーの位置を表示するか、ユーザーの位置なしで境界のみを表示するコードの一部を含めました。私が機能をいじっていて、どこにも行き着いていないことがわかります。
GeoMarker = new GeolocationMarker();
GeoMarker.setCircleOptions({fillColor: '#808080',fillOpacity:0.0,strokeOpacity:0.0});
google.maps.event.addListenerOnce(GeoMarker, 'position_changed', function() {
map.setCenter(this.getPosition());
//map.fitBounds(this.getBounds()); //uncomment to show based on user location regardless of the exsisting bounds of the map
//map.fitBounds(bounds); //uncomment to show ALL the listing Markers within the bounds of the map and not location of the user
//if (map.getZoom() > 1) map.setZoom(13); //this zoom is based on user location
// map.setCenter(this.getPosition());
var listener = google.maps.event.addListener(map, "idle", function() {
google.maps.event.removeListener(listener);
});
});
google.maps.event.addListener(GeoMarker, 'geolocation_error', function(e) {
alert('There was an error obtaining your position. Message: ' + e.message);
});
GeoMarker.setMap(map);
}