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-creation-api-entityCollection.js
Created April 22, 2015 02:33
Bing-map-creation-api-entityCollection
// create an EntityCollection object for collecting pushpins and make them visible on the map
var pushpinsLayer = new Microsoft.Maps.EntityCollection({
visible: true,
zIndex: 2
});
// add some pushpins to the collection
pushpinsLayer.push(pushpin1);
pushpinsLayer.push(pushpin2);
@hanislovingit
hanislovingit / Mapbox-creation-api-color.js
Created April 22, 2015 02:23
Mapbox-creation-api-color
// The range of values for opacity is 0-1.0
var mouseoverPolyOptions = {
fillColor: '#00f',
fillOpacity: 0.4,
color: '#00f',
opacity: 0.4,
weight: 2
};
@hanislovingit
hanislovingit / Bing-map-creation-api-color.js
Created April 22, 2015 02:22
Bing-map-creation-api-color
// The range of values for alpha, red, green and blue is 0-255.
var mouseoverPolyOptions = {
fillColor: new Microsoft.Maps.Color(100, 0, 0, 255),
strokeColor: new Microsoft.Maps.Color(100, 0, 0, 255),
strokeThickness: 2
};
@hanislovingit
hanislovingit / Mapbox-creation-api-polygon.js
Last active August 29, 2015 14:19
Mapbox-creation-api-polygon
// Create the locations
var location1 = L.latLng(20,-20);
var location2 = L.latLng(20,20);
var location3 = L.latLng(-20,20);
var location4 = L.latLng(-20,-20);
// Create an array of locations. Notice the last one in the locations array is NOT the same as the first one, as this is not required in Mapbox API
var vertices = new Array(location1, location2, location3, location4);
// Create a PolylineOptions object that has some color value
@hanislovingit
hanislovingit / Bing-map-creation-api-polygon.js
Created April 22, 2015 02:10
Bing-map-creation-api-polygon
// Create the locations
var location1 = new Microsoft.Maps.Location(20,-20);
var location2 = new Microsoft.Maps.Location(20,20);
var location3 = new Microsoft.Maps.Location(-20,20);
var location4 = new Microsoft.Maps.Location(-20,-20);
// Create an array of locations. Notice the last one in the locations array is the same as the first one
var vertices = new Array(location1, location2, location3, location4, location1);
// Create a Color object for use in PolygonOptions
@hanislovingit
hanislovingit / Mapbox-creation-api-popup.js
Created April 22, 2015 02:06
Mapbox-creation-api-popup
var popup = L.popup()
.setLatLng(latlng)
.setContent('<p>Hello world!<br />This is a nice popup.</p>')
.openOn(map);
@hanislovingit
hanislovingit / Bing-map-creation-api-infobox.js
Created April 22, 2015 02:04
Bing-map-creation-api-infobox
var pinInfobox = new Microsoft.Maps.Infobox(pinLocation, {
title: 'My Pushpin',
visible: true
});
@hanislovingit
hanislovingit / Mapbox-creation-api-marker.js
Created April 22, 2015 01:59
Mapbox-creation-api-marker
var pushpin = L.marker(location, {
icon: L.icon({
iconUrl: pushpinIcon,
iconSize: [20, 34],
popupAnchor: [0, -30]
}),
zIndexOffset: 1
});
@hanislovingit
hanislovingit / Bing-map-creation-api-pushpin.js
Created April 22, 2015 01:58
Bing-map-creation-api-pushpin
var pushpin = new Microsoft.Maps.Pushpin(location, {
icon: pushpinIcon,
height: 34,
width: 20,
anchor: new Microsoft.Maps.Point(10, 34),
zIndex: 1
});
@hanislovingit
hanislovingit / Mapbox-creation-api-point.js
Created April 22, 2015 01:54
Mapbox-creation-api-point
var point = L.point(x, y);