HTML and CSS Reference
In-Depth Information
var latlngStr = input . split ( ',' , 2 );
var lat = parseFloat ( latlngStr [ 0 ]);
var lng = parseFloat ( latlngStr [ 1 ]);
var latlng = new google . maps . LatLng ( lat , lng );
geocoder . geocode ({ 'latLng' : latlng }, function ( results , status ) {
if ( status == google . maps . GeocoderStatus . OK ) {
if ( results [ 1 ]) {
map . setZoom ( 11 );
marker = new google . maps . Marker ({
position : latlng ,
map : map
});
infowindow . setContent ( results [ 1 ]. formatted_address );
infowindow . open ( map , marker );
} else {
alert ( 'No results found' );
}
} else {
alert ( 'Geocoder failed due to: ' + status );
}
});
}
</script>
</head>
<body onload= "initialize()" >
<div>
<input id= "latlng" type= "textbox" value= "40.714224,-73.961452" >
</div>
<div>
<input type= "button" value= "Reverse Geocode" onclick= "codeLatLng()" >
</div>
<div id= "map_canvas"
style= "height: 90%; top:60px; border: 1px solid black;" ></div>
</body>
</html>
Frameworks
When working with the Geolocation API, you should detect and wrap available Geo‐
location mechanisms that are available across different mobile devices. For example,
you could detect Google Gears, BlackBerry, and the default Geolocation API within one
JavaScript init() method. But why try to code all this yourself, when you could just
use a framework? The Geolocation JavaScript frameworks are relatively small in both
size and selection.
geo-location-javascript
A mobile centric framework using nonstandard BlackBerry and WebOD tricks, geo-
location-javascript ( http://code.google.com/p/geo-location-javascript ) wraps the under‐
Search WWH ::




Custom Search