Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
96 lines (72 sloc) 2.209 kb
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mapstraction Examples - Google v3</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="../source/mxn.js?(googlev3,[geocoder])" type="text/javascript"></script>
<style type="text/css">
#mapdiv {
height: 400px;
}
</style>
<script type="text/javascript">
//<![CDATA[
var mapstraction;
var geocoder;
function geocode_return(geocoded_location) {
// display the map centered on a latitude and longitude (Google zoom levels)
mapstraction.setCenterAndZoom(geocoded_location.point, 15);
// create a marker positioned at a lat/lon
var geocode_marker = new mxn.Marker(geocoded_location.point);
var address = geocoded_location.locality + ", " + geocoded_location.region;
geocode_marker.setInfoBubble(address);
// display marker
mapstraction.addMarker(geocode_marker);
// open the marker
geocode_marker.openBubble();
}
function initialize() {
// create mxn object
mapstraction = new mxn.Mapstraction('mapdiv','googlev3');
mapstraction.addControls({
pan: true,
zoom: 'small',
map_type: true
});
var latlon = new mxn.LatLonPoint(18.47, -69.9);
mapstraction.setMapType(mxn.Mapstraction.SATELLITE);
mapstraction.setCenterAndZoom(latlon, 10);
mapstraction.mousePosition('position');
geocoder = new mxn.Geocoder('googlev3',geocode_return);
// add a marker
var marker = new mxn.Marker(latlon);
mapstraction.addMarker(marker,true);
}
function user_submit() {
var address = {};
address = document.getElementById('address').value;
geocoder.geocode(address);
}
function changetohybrid(){
mapstraction.setMapType(mxn.Mapstraction.HYBRID);
}
//]]>
</script>
</head>
<body onload="initialize();">
<center>
<table border='1' width='50%'>
<tr>
<td><div id="mapdiv"></div></td>
</tr>
<tr>
<td>
<input type="text" id="address" name="address" value="" size="35"/>
<a href="#" onclick="user_submit(); return false;">Geocode</a>
</td>
</tr>
</table>
<a href='#' onclick='changetohybrid();'>change to hybrid</a>
<div id="position"></div>
</center>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.