Created
April 23, 2015 06:47
-
-
Save gormus/12b81fd3b7b00bbce120 to your computer and use it in GitHub Desktop.
Simple Map // source http://jsbin.com/nabexu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simple Map</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<style> | |
html, body, #map-canvas { | |
height: 100%; | |
margin: 0px; | |
padding: 0px | |
} | |
</style> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script> | |
<script src="https://raw.githubusercontent.com/googlemaps/js-marker-clusterer/gh-pages/src/markerclusterer.js"></script> | |
</head> | |
<body> | |
<div id="map-canvas"></div> | |
<script id="jsbin-javascript"> | |
var map; | |
var MY_MAPTYPE_ID = 'custom_style'; | |
function initialize() { | |
var featureOpts = [ | |
{ | |
stylers: [ | |
{ hue: '#890000' }, | |
{ visibility: 'simplified' }, | |
{ gamma: 0.5 }, | |
{ weight: 0.5 } | |
] | |
}, | |
{ | |
elementType: 'labels', | |
stylers: [ | |
{ visibility: 'off' } | |
] | |
}, | |
{ | |
featureType: 'water', | |
stylers: [ | |
{ color: '#890000' } | |
] | |
} | |
]; | |
var mapOptions = { | |
zoom: 8 | |
, disableDefaultUI: true | |
, center: new google.maps.LatLng(-34.397, 150.644) | |
, keyboardShortcuts : false | |
, maxZoom : 100 | |
, minZoom : 0 | |
, overviewMapControl : false | |
, styles : {} | |
, zoom : 10 | |
, mapTypeControl : true | |
, mapTypeControlOptions: { | |
//style: google.maps.MapTypeControlStyle.DEFAULT, | |
mapTypeIds: [ | |
google.maps.MapTypeId.ROADMAP, | |
MY_MAPTYPE_ID | |
] | |
} | |
, mapTypeId: MY_MAPTYPE_ID | |
, zoomControl: true | |
, zoomControlOptions: { | |
style: google.maps.ZoomControlStyle.LARGE, | |
position: google.maps.ControlPosition.LEFT_TOP | |
} | |
, streetViewControl: true | |
, streetViewControlOptions: { | |
position: google.maps.ControlPosition.LEFT_TOP | |
} | |
, scaleControl: false | |
}; | |
map = new google.maps.Map(document.getElementById('map-canvas'), | |
mapOptions); | |
var styledMapOptions = { | |
name: 'Custom Style' | |
}; | |
var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions); | |
map.mapTypes.set(MY_MAPTYPE_ID, customMapType); | |
var georssLayer = new google.maps.KmlLayer({ | |
url: 'http://api.flickr.com/services/feeds/geo/?g=322338@N20&lang=en-us&format=feed-georss' | |
}); | |
georssLayer.setMap(map); | |
var mcOptions = {gridSize: 50, maxZoom: 15}; | |
var mc = new MarkerClusterer(map); | |
//var mc = new MarkerClusterer(map, markers, mcOptions); | |
// https://googlemaps.github.io/js-marker-clusterer/examples/speed_test_example.html? | |
// Try HTML5 geolocation | |
if(navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
var pos = new google.maps.LatLng(position.coords.latitude, | |
position.coords.longitude); | |
var infowindow = new google.maps.InfoWindow({ | |
map: map, | |
position: pos, | |
content: 'Location found using HTML5.' | |
}); | |
map.setCenter(pos); | |
}, function() { | |
handleNoGeolocation(true); | |
}); | |
} | |
} | |
google.maps.event.addDomListener(window, 'load', initialize); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var map; | |
var MY_MAPTYPE_ID = 'custom_style'; | |
function initialize() { | |
var featureOpts = [ | |
{ | |
stylers: [ | |
{ hue: '#890000' }, | |
{ visibility: 'simplified' }, | |
{ gamma: 0.5 }, | |
{ weight: 0.5 } | |
] | |
}, | |
{ | |
elementType: 'labels', | |
stylers: [ | |
{ visibility: 'off' } | |
] | |
}, | |
{ | |
featureType: 'water', | |
stylers: [ | |
{ color: '#890000' } | |
] | |
} | |
]; | |
var mapOptions = { | |
zoom: 8 | |
, disableDefaultUI: true | |
, center: new google.maps.LatLng(-34.397, 150.644) | |
, keyboardShortcuts : false | |
, maxZoom : 100 | |
, minZoom : 0 | |
, overviewMapControl : false | |
, styles : {} | |
, zoom : 10 | |
, mapTypeControl : true | |
, mapTypeControlOptions: { | |
//style: google.maps.MapTypeControlStyle.DEFAULT, | |
mapTypeIds: [ | |
google.maps.MapTypeId.ROADMAP, | |
MY_MAPTYPE_ID | |
] | |
} | |
, mapTypeId: MY_MAPTYPE_ID | |
, zoomControl: true | |
, zoomControlOptions: { | |
style: google.maps.ZoomControlStyle.LARGE, | |
position: google.maps.ControlPosition.LEFT_TOP | |
} | |
, streetViewControl: true | |
, streetViewControlOptions: { | |
position: google.maps.ControlPosition.LEFT_TOP | |
} | |
, scaleControl: false | |
}; | |
map = new google.maps.Map(document.getElementById('map-canvas'), | |
mapOptions); | |
var styledMapOptions = { | |
name: 'Custom Style' | |
}; | |
var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions); | |
map.mapTypes.set(MY_MAPTYPE_ID, customMapType); | |
var georssLayer = new google.maps.KmlLayer({ | |
url: 'http://api.flickr.com/services/feeds/geo/?g=322338@N20&lang=en-us&format=feed-georss' | |
}); | |
georssLayer.setMap(map); | |
var mcOptions = {gridSize: 50, maxZoom: 15}; | |
var mc = new MarkerClusterer(map); | |
//var mc = new MarkerClusterer(map, markers, mcOptions); | |
// https://googlemaps.github.io/js-marker-clusterer/examples/speed_test_example.html? | |
// Try HTML5 geolocation | |
if(navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
var pos = new google.maps.LatLng(position.coords.latitude, | |
position.coords.longitude); | |
var infowindow = new google.maps.InfoWindow({ | |
map: map, | |
position: pos, | |
content: 'Location found using HTML5.' | |
}); | |
map.setCenter(pos); | |
}, function() { | |
handleNoGeolocation(true); | |
}); | |
} | |
} | |
google.maps.event.addDomListener(window, 'load', initialize); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map; | |
var MY_MAPTYPE_ID = 'custom_style'; | |
function initialize() { | |
var featureOpts = [ | |
{ | |
stylers: [ | |
{ hue: '#890000' }, | |
{ visibility: 'simplified' }, | |
{ gamma: 0.5 }, | |
{ weight: 0.5 } | |
] | |
}, | |
{ | |
elementType: 'labels', | |
stylers: [ | |
{ visibility: 'off' } | |
] | |
}, | |
{ | |
featureType: 'water', | |
stylers: [ | |
{ color: '#890000' } | |
] | |
} | |
]; | |
var mapOptions = { | |
zoom: 8 | |
, disableDefaultUI: true | |
, center: new google.maps.LatLng(-34.397, 150.644) | |
, keyboardShortcuts : false | |
, maxZoom : 100 | |
, minZoom : 0 | |
, overviewMapControl : false | |
, styles : {} | |
, zoom : 10 | |
, mapTypeControl : true | |
, mapTypeControlOptions: { | |
//style: google.maps.MapTypeControlStyle.DEFAULT, | |
mapTypeIds: [ | |
google.maps.MapTypeId.ROADMAP, | |
MY_MAPTYPE_ID | |
] | |
} | |
, mapTypeId: MY_MAPTYPE_ID | |
, zoomControl: true | |
, zoomControlOptions: { | |
style: google.maps.ZoomControlStyle.LARGE, | |
position: google.maps.ControlPosition.LEFT_TOP | |
} | |
, streetViewControl: true | |
, streetViewControlOptions: { | |
position: google.maps.ControlPosition.LEFT_TOP | |
} | |
, scaleControl: false | |
}; | |
map = new google.maps.Map(document.getElementById('map-canvas'), | |
mapOptions); | |
var styledMapOptions = { | |
name: 'Custom Style' | |
}; | |
var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions); | |
map.mapTypes.set(MY_MAPTYPE_ID, customMapType); | |
var georssLayer = new google.maps.KmlLayer({ | |
url: 'http://api.flickr.com/services/feeds/geo/?g=322338@N20&lang=en-us&format=feed-georss' | |
}); | |
georssLayer.setMap(map); | |
var mcOptions = {gridSize: 50, maxZoom: 15}; | |
var mc = new MarkerClusterer(map); | |
//var mc = new MarkerClusterer(map, markers, mcOptions); | |
// https://googlemaps.github.io/js-marker-clusterer/examples/speed_test_example.html? | |
// Try HTML5 geolocation | |
if(navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
var pos = new google.maps.LatLng(position.coords.latitude, | |
position.coords.longitude); | |
var infowindow = new google.maps.InfoWindow({ | |
map: map, | |
position: pos, | |
content: 'Location found using HTML5.' | |
}); | |
map.setCenter(pos); | |
}, function() { | |
handleNoGeolocation(true); | |
}); | |
} | |
} | |
google.maps.event.addDomListener(window, 'load', initialize); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment