Skip to content

Instantly share code, notes, and snippets.

@joeldom
Last active August 29, 2015 14:07
Show Gist options
  • Save joeldom/cc81e4535a53a5171340 to your computer and use it in GitHub Desktop.
Save joeldom/cc81e4535a53a5171340 to your computer and use it in GitHub Desktop.
Need help adding a marker to the map.
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<div id="sitkobrunomap" style="overflow:hidden;height:200px;width:100%;"></div>
<script>
window.onload = function () {
var styles = [
{
featureType: 'water', // set the water color
elementType: 'geometry.fill', // apply the color only to the fill
stylers: [
{ color: '#bababa' }
]
},{
featureType: 'landscape.natural', // set the natural landscape
elementType: 'all',
stylers: [
{ hue: '#809f80' },
{ lightness: -35 }
]
}
,{
featureType: 'poi', // set the point of interest
elementType: 'geometry',
stylers: [
{ hue: '#444444' },
{ lightness: 30 }
]
},{
featureType: 'road', // set the road
elementType: 'geometry',
stylers: [
{ hue: '#d5c18c' },
{ lightness: 14 }
]
},{
featureType: 'road.local', // set the local road
elementType: 'all',
stylers: [
{ hue: '#ffd7a6' },
{ saturation: 100 },
{ lightness: -12 }
]
}
];
var options = {
mapTypeControlOptions: {
mapTypeIds: ['Styled']
},
center: new google.maps.LatLng(<?php echo $adds['lat']; ?>, <?php echo $adds['lng']; ?>),
zoom: 14,
disableDefaultUI: true,
mapTypeId: 'Styled'
};
var marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(<?php echo $adds['lat']; ?>, <?php echo $adds['lng']; ?>)});
var div = document.getElementById('sitkobrunomap');
var map = new google.maps.Map(div, options, marker);
var styledMapType = new google.maps.StyledMapType(styles, { name: 'Styled' });
map.mapTypes.set('Styled', styledMapType);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment