Blog Bug's

bugging blogs

Archive for November, 2010

…on Maps API (Google 1.x, Google 2.x, & OSM) – Javascript with Paths

Google 2.x

	<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA8Hm0UjfAUlzqtm8C4hrYcRRHdNuSbQjBWSHvxpsS-elLV0ZwthR9fApc1xrVNPI-YmmRt62mP-Ifag">
	</script>
	<script type="text/javascript">
		google.load("maps", "2.x");
		function initialize() {
			var map3a = new google.maps.Map2(document.getElementById("map3a"));
			var polyline = new GPolyline(
				[
					new GLatLng(14.647185,121.068959),
					new GLatLng(14.648783,121.069002),
					new GLatLng(14.648638,121.068637)
				], 
				"#ff0000", 
				5
			);
			map3a.addOverlay(polyline);				
			map3a.setCenter(new google.maps.LatLng(14.648552,121.068553), 17);
		}
		google.setOnLoadCallback(initialize);
	</script>
	<div id="map3a" style="height: 400px; width: 400px;"></div>


OSM

	<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
	<script>
		var init = function() {
			var map3b = new OpenLayers.Map("map3b");
			var mapnik = new OpenLayers.Layer.OSM();
			map3b.addLayer(mapnik);
			var geometry = new OpenLayers.Geometry.LineString(
				[
					new OpenLayers.Geometry.Point(121.068959,14.647185).transform(
						new OpenLayers.Projection("EPSG:4326"),
						new OpenLayers.Projection("EPSG:900913")
					),
					new OpenLayers.Geometry.Point(121.069002,14.648783).transform(
						new OpenLayers.Projection("EPSG:4326"),
						new OpenLayers.Projection("EPSG:900913")
					),
					new OpenLayers.Geometry.Point(121.068637,14.648638).transform(
						new OpenLayers.Projection("EPSG:4326"),
						new OpenLayers.Projection("EPSG:900913")
					)
				]
			);
			var feature = new OpenLayers.Feature.Vector(
				geometry, 
				null,
				{
					strokeColor: "#ff0000",
					strokeOpacity: 0.7,
					strokeWidth: 5
				}
			);
			var vectors = new OpenLayers.Layer.Vector("Vectors");
			vectors.addFeatures(feature);
			map3b.addLayer(vectors);
			var lonLat = new OpenLayers.LonLat(121.068553,14.648552).transform(
				new OpenLayers.Projection("EPSG:4326"),
				new OpenLayers.Projection("EPSG:900913")
			);
			map3b.setCenter(lonLat, 17);
		}
		addOnLoadEvent(init);
    </script>
	<div id="map3b" style="height: 400px; width: 400px"></div>


refresh if no map rendered

posted by ninoy in CS 297 and have No Comments

…on Maps API (Google 1.x, Google 2.x, & OSM) – Static with Paths

Google 1.x

	<img src="http://maps.google.com/staticmap?center=14.648552,121.068553&zoom=17&size=400x400&sensor=false&path=rgba:0xff0000ff,weight:5|14.647185,121.068959|14.648783,121.069002|14.648638,121.068637&key=ABQIAAAA8Hm0UjfAUlzqtm8C4hrYcRRHdNuSbQjBWSHvxpsS-elLV0ZwthR9fApc1xrVNPI-YmmRt62mP-Ifag" border="0" alt="Department Computer Science UP Diliman" />

Department Computer Science UP Diliman

Google 2.x

	<img border="0" src="http://maps.google.com/maps/api/staticmap?center=14.648552,121.068553&zoom=17&size=400x400&sensor=false&path=color:0xff0000ff|weight:5|14.647185,121.068959|14.648783,121.069002|14.648638,121.068637" alt="Department Computer Science UP Diliman" />

Department Computer Science UP Diliman

OSM

	<img class="sampleMap" src="http://dev.openstreetmap.org/~pafciu17/?module=map&center=121.068553,14.648552&zoom=17&type=mapnik&width=400&height=400&paths=121.068959,14.647185,121.069002,14.648783,121.068637,14.648638,thickness:5,transparency:0,color:255:0:0" alt="Department Computer Science UP Diliman" />

Department Computer Science UP Diliman

posted by ninoy in CS 297 and have No Comments

…on Maps API (Google 1.x, Google 2.x, & OSM) – Javascript with Markers

Google 2.x

	<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA8Hm0UjfAUlzqtm8C4hrYcRRHdNuSbQjBWSHvxpsS-elLV0ZwthR9fApc1xrVNPI-YmmRt62mP-Ifag">
	</script>
	<script type="text/javascript">
		google.load("maps", "2.x");
		function initialize() {
			var map2a = new google.maps.Map2(document.getElementById("map2a"));
			map2a.setCenter(new google.maps.LatLng(14.648552,121.068553), 17);
			map2a.addOverlay(new GMarker(new GLatLng(14.648552,121.068553)));
		}
		google.setOnLoadCallback(initialize);
	</script>
	<div id="map2a" style="height: 400px; width: 400px;"></div>


OSM

	<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
	<script>
		var init = function() {
			var map2b = new OpenLayers.Map("map2b");
			var mapnik = new OpenLayers.Layer.OSM();
			map2b.addLayer(mapnik);
			var markers = new OpenLayers.Layer.Markers( "Markers" );
			map2b.addLayer(markers);
			var lonLat = new OpenLayers.LonLat(121.068553,14.648552).transform(
				new OpenLayers.Projection("EPSG:4326"),
				new OpenLayers.Projection("EPSG:900913")
			);
			markers.addMarker(new OpenLayers.Marker(lonLat));
			map2b.setCenter(lonLat, 17);
		}
		addOnLoadEvent(init);
    </script>
	<div id="map2b" style="height: 400px; width: 400px"></div>


refresh if no map rendered

posted by ninoy in CS 297 and have No Comments

…on Maps API (Google 1.x, Google 2.x, & OSM) – Static with Markers

Google 1.x

	<img src="http://maps.google.com/staticmap?center=14.648552,121.068553&zoom=17&size=400x400&sensor=false&markers=14.648552,121.068553,reda&key=ABQIAAAA8Hm0UjfAUlzqtm8C4hrYcRRHdNuSbQjBWSHvxpsS-elLV0ZwthR9fApc1xrVNPI-YmmRt62mP-Ifag" border="0" alt="Department Computer Science UP Diliman" />

Department Computer Science UP Diliman

Google 2.x

	<img border="0" src="http://maps.google.com/maps/api/staticmap?center=14.648552,121.068553&zoom=17&size=400x400&sensor=false&markers=color:red|label:A|14.648552,121.068553" alt="Department Computer Science UP Diliman">

Department Computer Science UP Diliman

OSM

	<img class="sampleMap" src="http://dev.openstreetmap.org/~pafciu17/?module=map&center=121.068553,14.648552&zoom=17&type=mapnik&width=400&height=400&points=121.068553,14.648552,pointImagePattern:redA" alt="Department Computer Science UP Diliman">

Department Computer Science UP Diliman

posted by ninoy in CS 297 and have No Comments

…on Maps API (Google 1.x, Google 2.x, & OSM) – Javascript

Google 2.x

	<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA8Hm0UjfAUlzqtm8C4hrYcRRHdNuSbQjBWSHvxpsS-elLV0ZwthR9fApc1xrVNPI-YmmRt62mP-Ifag">
	</script>
	<script type="text/javascript">
		google.load("maps", "2.x");
		function initialize() {
			var map1a = new google.maps.Map2(document.getElementById("map1a"));
			map1a.setCenter(new google.maps.LatLng(14.648552,121.068553), 17);
		}
		google.setOnLoadCallback(initialize);
	</script>
	<div id="map1a" style="height: 400px; width: 400px;"></div>


OSM

	<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
	<script>
		var init = function() {
			var map1b = new OpenLayers.Map("map1b");
			var mapnik = new OpenLayers.Layer.OSM();
			map1b.addLayer(mapnik);
			var lonLat = new OpenLayers.LonLat(121.068553,14.648552).transform(
				new OpenLayers.Projection("EPSG:4326"),
				new OpenLayers.Projection("EPSG:900913")
			);
			map1b.setCenter(lonLat, 17);
		}
		addOnLoadEvent(init);
    </script>
	<div id="map1b" style="height: 400px; width: 400px"></div>


refresh if no map rendered

posted by ninoy in CS 297 and have No Comments

…on Maps API (Google 1.x, Google 2.x, & OSM) – Static

Google 1.x

	<img src="http://maps.google.com/staticmap?center=14.648552,121.068553&zoom=17&size=400x400&sensor=false&key=ABQIAAAA8Hm0UjfAUlzqtm8C4hrYcRRHdNuSbQjBWSHvxpsS-elLV0ZwthR9fApc1xrVNPI-YmmRt62mP-Ifag" border="0" alt="Department Computer Science UP Diliman" />

Department Computer Science UP Diliman

Google 2.x

	<img border="0" src="http://maps.google.com/maps/api/staticmap?center=14.648552,121.068553&zoom=17&size=400x400&sensor=false" alt="Department Computer Science UP Diliman">

Department Computer Science UP Diliman

OSM

	<img class="sampleMap" src="http://dev.openstreetmap.org/~pafciu17/?module=map&center=121.068553,14.648552&zoom=17&type=mapnik&width=400&height=400" alt="Department Computer Science UP Diliman">

Department Computer Science UP Diliman

posted by ninoy in CS 297 and have No Comments