Naver, Daum, Google Open API
글 수 52
cyber
http://www.subkorea.com/api/google/MapsAPI/marker-manager.htm1576 마크 (75 red 마크 - 모든 줌레벨, 330 yellow 마크 - 줌레벨 11이상, 474 green 마크 - 줌레벨 12이상, 696 blue 마크 - 줌레벨 13이상)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps</title>
<script src="http://maps.google.com/maps?file=api&v=2.67&key=abc...xyz" type="text/javascript"></script>
<script src="http://www.acme.com/javascript/OverlayMessage.js" type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div id="map" style="width: 550px; height: 450px"></div>
<a href="markermanager.htm">Back to the tutorial page</a>
<noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>
However, it seems JavaScript is either disabled or not supported by your browser.
To view Google Maps, enable JavaScript by changing your browser options, and then
try again.
</noscript>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
// display the loading message
var om = new OverlayMessage(document.getElementById('map'));
om.Set('<b>Loading...</b>');
var n=0;
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
iconblue = new GIcon(icon,"http://labs.google.com/ridefinder/images/mm_20_blue.png");
icongreen = new GIcon(icon,"http://labs.google.com/ridefinder/images/mm_20_green.png");
iconyellow = new GIcon(icon,"http://labs.google.com/ridefinder/images/mm_20_yellow.png");
function createMarker(point,name,html,icon) {
var marker = new GMarker(point, {icon:icon});
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
// new strategy - read the XML first, THEN create the map
// read the markers from the XML
GDownloadUrl("rwanda.xml", function (doc) {
var gmarkersA = [];
var gmarkersB = [];
var gmarkersC = [];
var gmarkersD = [];
var xmlDoc = GXml.parse(doc);
var markers = xmlDoc.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
// obtain the attribues of each marker
var lat = parseFloat(markers[i].getAttribute("lat"));
var lng = parseFloat(markers[i].getAttribute("lng"));
var point = new GLatLng(lat,lng);
var town = markers[i].getAttribute("town");
var pop = markers[i].getAttribute("pop");
// split the markers into four arrays, with different GIcons
if (parseInt(pop) > 70000) {
var marker = createMarker(point,town,town+"<br>Population: "+pop,icon);
gmarkersA.push(marker);
}
else if (parseInt(pop) > 50000) {
var marker = createMarker(point,town,town+"<br>Population: "+pop,iconyellow);
gmarkersB.push(marker);
}
else if (parseInt(pop) > 40000) {
var marker = createMarker(point,town,town+"<br>Population: "+pop,icongreen);
gmarkersC.push(marker);
}
else {
var marker = createMarker(point,town,town+"<br>Population: "+pop,iconblue);
gmarkersD.push(marker);
}
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(-1.6347,29.388), 11, G_SATELLITE_TYPE);
var mm = new GMarkerManager(map, {borderPadding:1});
mm.addMarkers(gmarkersA,0,17);
mm.addMarkers(gmarkersB,11,17);
mm.addMarkers(gmarkersC,12,17);
mm.addMarkers(gmarkersD,13,17);
mm.refresh();
om.Clear(); // Clear the loading message
});
}
// display a warning if the browser was not compatible
else {
alert("Sorry, the Google Maps API is not compatible with this browser");
}
// This Javascript is based on code provided by the
// Blackpool Community Church Javascript Team
// http://www.commchurch.freeserve.co.uk/
// http://econym.googlepages.com/index.htm
//]]>
</script>
</body>
</html>
http://subkorea.com/xe/84629
(*.225.54.140)
|