I am creating a google map with multiple markers. Some of the markers
have the same latitude and longitude. Is there any way to make sure
the marker shows up even if they are the same lat and long?
Here is the code:
<html>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/
libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript"
src="http://maps.google.com/maps/api/
js?sensor=false"></script>
<script type="text/javascript">
$(document).ready(
function(){
//alert("JS YO!");
var marker = [];
//var params = [];
$(".mapblock").each(function (i){
//alert( $(this).html());
marker[i] = [7];
params = ($(this).html()).split("|");
//alert(params);
marker[i][0]= params[0];
marker[i][1] = params[1];
marker[i][2] = params[2];
marker[i][3]= params[3];
marker[i][4] = params[4];
marker[i][5]= params[5];
marker[i][6] = params[6];
marker[i][7]= params[7];
});
//alert(marker);
buildmap(marker);
}
);
//running the map function
function buildmap(spots){
//alert(spots.length);
var myOptions = {
zoom: 11,
center: new google.maps.LatLng(spots[0][0],
spots[0][1]),
//center: new google.maps.LatLng(-33.9, 151.2),
mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new
google.maps.Map(document.getElementById("dealermap"),myOptions);
//var image = '<?=IMAGES?>main-elements/pin.png';
//alert(spots.length);
var markers = [];
for(var i=0; i < spots.length; i++){
//alert(spots[i]);
var dealer = spots[i];
//alert(dealer[0] + dealer[1]);
var dealerLatLong = new
google.maps.LatLng(dealer[0], dealer[1]);
var marker = new google.maps.Marker({
position: dealerLatLong,
map: map,
//icon: image,
zIndex: i
});
markers[i] = marker;
}
}
</script>
</head>
<body>
<div class="mapblock">36.91190|-76.21320|Bay Chevrolet Saab
Kia|6970
N. Military Hwy.|Norfolk|VA|23518|757-855-5555</div>
<div class="mapblock">36.88940|-76.23820|Enterprise|2630
Wyoming Ave|
Norfolk|VA|23513|757-855-6720</div>
<div class="mapblock">36.91190|-76.21320|Green Gifford|2747 N.
Millitary Hwy|Norfolk|VA|23518|757-284-3418</div>
<div class="mapblock">36.75220|-76.21680|Greenbrier Chrysler
Jeep|
1414 South Military Highway|Chesapeake|VA|23320|888-559-6530</div>
<div class="mapblock">36.75220|-76.21680|Greenbrier Pontiac GMC
Kia|
1300 S. Military Highway|Chesapeake|VA|23320|888-598-8968</div>
<div class="mapblock">36.75220|-76.21680|Greenbrier
Volkswagen|1248
S. Military Highway|Chesapeake|VA|23320|888-659-3562</div>
<div class="mapblock">36.75220|-76.21680|Greenbrier Wholesale
Center|
1510 S. Military Highway|Chesapeake|VA|23320|888-876-4139</div>
<div class="mapblock">36.85650|-76.21180|Kimnach Ford|6401 E.
Virginia Beach Blvd.|Norfolk|VA|23502|757-461-6401</div>
<div class="mapblock">36.85650|-76.21180|Perry Buick Pontiac
Subaru|
6633 Virginia Beach Blvd|Norfolk|VA|23502|757-461-8855</div>
<div class="mapblock">36.83760|-76.15100|Phillips Mercedes Land
Rover|4949 Virginia Beach Blvd.|Virginia Beach|VA|23462|800-601-3644</
div>
<div id="dealermap" style="width:770px;height:500px;border:1px
solid
#ddd;"></div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.