Reputation: 358
I have simple google map with markers. When I create marker for example for Viet Nam I see two markers on Map (in the beginning and in the end, see screenshot).
Is there any way to show only one marker? I cannot change size or zoom of map.
Code:
function loadMap() {
var mapOptions = {
zoom: 1,
disableDefaultUI: true,
zoomControl: false,
scrollwheel: false,
center: new google.maps.LatLng(10.0, -97.2070),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
MAP = new google.maps.Map(document.getElementById("map"), mapOptions);
}
function addMarker(address) {
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var marker = new google.maps.Marker({
map: MAP,
position: results[0].geometry.location
});
MARKERS.push(marker);
}});
}
Upvotes: 0
Views: 377
Reputation: 358
My problem is solved, I needed to add option "optimized: false" for markers. After this I have one marker for one place.
Upvotes: 0
Reputation: 41099
The short answer is: No
, You basically see the same icon, in the same location. because you zoomed out the map that way that you see the same land twice. it's a normal behavior. there is no logic that in one round there will be a marker and in the second there wouldn't.
Upvotes: 2
Reputation: 1428
You can set the minimum zoom to a larger number so you won't be able to zoom out that far. But that comes with some issues, your map will have to have a fixed width.
Look at minZoom
https://developers.google.com/maps/documentation/javascript/reference#MapOptions
Otherwise I don't see how you can do that.
Upvotes: 0