In the code below, I’ve been displaying the greyscale of the map using Google Maps v3 with the desired latitude and longitude from the DB. Can someone help me figure out how I can put only one marker at the desired latitude and longitude.
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
var latitude = <?php echo $store_details->latitude; ?>;
var longitude = <?php echo $store_details->longitude; ?>;
var brooklyn = new google.maps.LatLng(latitude, longitude);
var MY_MAPTYPE_ID = 'Greyscale';
function initialize() {
var graystyle = [{
featureType: "all",
elementType: "all",
stylers: [ { saturation: -100 }, { visibility: "on" } ]
}];
var mapOptions = {
zoom: 15,
center: brooklyn,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID]
},
mapTypeId: MY_MAPTYPE_ID
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
var styledMapOptions = {
name: "Greyscale"
};
var grayMapType = new google.maps.StyledMapType(graystyle, styledMapOptions);
map.mapTypes.set(MY_MAPTYPE_ID, grayMapType);
}
</script>
1 Answer