Skip to content

Instantly share code, notes, and snippets.

View hanislovingit's full-sized avatar

Chuck Han hanislovingit

View GitHub Profile
@hanislovingit
hanislovingit / Bing-map-API-reference-advancedShapes.js
Created April 18, 2015 07:01
Bing-map-API-reference-advancedShapes
<script type="text/javascript">
Microsoft.Maps.loadModule('Microsoft.Maps.AdvancedShapes');
</script>
@hanislovingit
hanislovingit / Mapbox-API-reference.js
Last active August 29, 2015 14:19
Mapbox-API-reference
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.css' rel='stylesheet' />
@hanislovingit
hanislovingit / Bing-map-API-using-account-key.js
Last active August 29, 2015 14:19
Bing-map-API-using-account-key
var mapOptions = { credentials: "<yourKeyString>" };
var map = new Microsoft.Maps.Map(document.getElementById("divId"), mapOptions);
@hanislovingit
hanislovingit / Mapbox-using-access-token.js
Created April 19, 2015 20:53
Mapbox-using-access-token
L.mapbox.accessToken = "<yourAccessTokenString>";
@hanislovingit
hanislovingit / Bing-map-API-handling-events.js
Created April 20, 2015 01:38
Bing-map-API-handling-events
// add an event handler to a Pushpin object
var pin = new Microsoft.Maps.Pushpin(<Location> object);
var eventHandlerId = Microsoft.Maps.Events.addHandler(pin, ‘mouseover’, function (event) {
// some code here to handle mouseover event on pin object
});
// remove an event handler by using the previously created handler id
Microsoft.Maps.Events.removeHandler(eventHandlerId);
@hanislovingit
hanislovingit / Mapbox-handling-events.js
Last active August 29, 2015 14:19
Mapbox-handling-events
// add an event handler to a Marker object
var marker = L.marker(<LatLng> object);
marker.on('mouseover', function (event) {
// some code here to handle mouseover event on a marker object
});
// remove an event handler
marker.off('mouseover');
@hanislovingit
hanislovingit / Bing-map-creation-api-map-class.js
Last active August 29, 2015 14:19
Bing-map-creation-api-map-class
var viewOptions = {
credentials: "yourBingMapKeyString",
bounds: <LocationRect> object,
showMapTypeSelector: false,
mapTypeId: Microsoft.Maps.MapTypeId.aerial,
labelOverlay: Microsoft.Maps.LabelOverlay.visible,
showDashboard: false,
enableSearchLogo: false
};
@hanislovingit
hanislovingit / Mapbox-creation-api-map-class.js
Created April 20, 2015 03:47
Mapbox-creation-api-map-class
L.mapbox.accessToken = 'yourMapboxAccountAccessTokenString';
var mapOptions = {
zoomControl: false,
center: initExtent.center().toMapboxLatLng()
maxZoom: 20 // This overrides any maxZoom set on map layers
};
var map = L.mapbox.map(containerDivId, "yourMapboxMapId", mapOptions);
@hanislovingit
hanislovingit / Bing-map-switch-map-view-type.js
Created April 20, 2015 04:01
Bing-map-switch-map-view-type
var MM = Microsoft.Maps;
function (val) {
switch (val) {
case '0':
map.setView({ mapTypeId: MM.MapTypeId.road });
break;
case '1':
map.setView({ mapTypeId: MM.MapTypeId.aerial, labelOverlay: MM.LabelOverlay.hidden });
break;
@hanislovingit
hanislovingit / Mapbox-switch-map-view-types.js
Last active August 29, 2015 14:19
Mapbox-switch-map-view-types
var mapboxSatelliteLayer = L.mapbox.tileLayer('satelliteMapboxMapId'); // default map
var mapboxStreetLayer = L.mapbox.tileLayer('streetMapboxMapId');
function (val) {
switch (val) {
case '0':
if (_map.hasLayer(mapboxSatelliteLayer)) {
_map.removeLayer(mapboxSatelliteLayer);
}
_map.addLayer(mapboxStreetLayer);