Sometimes we need a map based on specified location or dynamically create a map. Then we need to use Latitude & Longitude. Latitude & Longitude provide the perfect location of any place. By finding that we can create a map using it.
Below Gives full code of Creation of map base on Latitude & Longitude.
<html>
<head>
<style type="text/css">
div#map {
width: 100%;
height: 200px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;
var geocoder;
var centerChangedLast;
var reverseGeocodedLast;
var currentReverseGeocodeResponse;
function initialize() {
var latlng = new google.maps.LatLng(-41.2785537,174.778663);
/*FOR PHP CODE: var latlng = new google.maps.LatLng("<?php echo $is_about_physical_address_lat; ?>","<?php echo $is_about_physical_address_lng; ?>"); */
var myOptions = {
zoom: 14,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
geocoder = new google.maps.Geocoder();
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "Hello World!"
/*FOR PHP CODE: title: "<?php echo $is_about_postal_address; ?>, <?php echo $is_about_country_name; ?>" */
});
}
</script>
</head>
<body onLoad="initialize()">
<div id="map">
<div id="map_canvas" style="width:100%; height:200px"></div>
<div id="maparea"></div>
</div>
</body>
</html>
For more Interesting, Useful Article & codes visit IT New Code.
Below Gives full code of Creation of map base on Latitude & Longitude.
<html>
<head>
<style type="text/css">
div#map {
width: 100%;
height: 200px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;
var geocoder;
var centerChangedLast;
var reverseGeocodedLast;
var currentReverseGeocodeResponse;
function initialize() {
var latlng = new google.maps.LatLng(-41.2785537,174.778663);
/*FOR PHP CODE: var latlng = new google.maps.LatLng("<?php echo $is_about_physical_address_lat; ?>","<?php echo $is_about_physical_address_lng; ?>"); */
var myOptions = {
zoom: 14,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
geocoder = new google.maps.Geocoder();
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "Hello World!"
/*FOR PHP CODE: title: "<?php echo $is_about_postal_address; ?>, <?php echo $is_about_country_name; ?>" */
});
}
</script>
</head>
<body onLoad="initialize()">
<div id="map">
<div id="map_canvas" style="width:100%; height:200px"></div>
<div id="maparea"></div>
</div>
</body>
</html>
For more Interesting, Useful Article & codes visit IT New Code.
0 comments:
Post a Comment