CodeAve.com(Basic Google Map (v3) Sourced from KML File - Print View)

Basic Google Map (v3) Sourced from KML File

KML (Keyhole Markup Language) files can be used as the source for your Google Maps. You can simply link your KML (or KMZ) file through Google Maps directly via a URL like this http://maps.google.com/maps?q=http://codeave.com/maps/state_capitols.kml or the KML can be embedded into your web page. Below is an example that utilizes a KML file that has the locations and icons for all 50 US state Capitols and all of the basic code needed to embed it within your page. The KML file is available to view within Google Earth or download from this location http://codeave.com/maps/state_capitols.kml
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>
CodeAve.com/Maps - Google Map with KML Source</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<!-- Reference to the map control -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<!-- A sensor value is required. True indicates that your application is using a sensor (such as a GPS locator) to determine the user's location. False indicates that you are not-->
<script type="text/javascript">
function initialize() { var myOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP
// sets the type of map to be displayed
// HYBRID - displays a transparent layer of major streets on satellite images
// ROADMAP - displays a normal street map
// SATELLITE - displays satellite images
// TERRAIN - displays maps with physical features such as terrain }; var
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var KML_Layer = new google.maps.KmlLayer('http://codeave.com/maps/state_capitols.kml'); KML_Layer.setMap(map); } </script>
</head>
<body onload="initialize()">
<div id="map_canvas">
</div>
</body>
</html>
<!-- http://maps.google.com/maps?q=http://codeave.com/maps/state_capitols.kml -->


http://www.codeave.com/maps/code.asp?u_log=9014