Saturday, August 10, 2013

how to display address in google map

how to display address in google map

I am displaying google map on my asp.net page using jquery.I have Nation
name,company name,Address and Longitude and latitude.
Right now i have add all addresses in dropdown,on the basis of dropdown
selection i have passed longitude and latitude in code.this part is
working as it display map on the basis of latitude and longitude.But i
have no longitude and latitude for some comapnies.So i want to use
directly address of comapnies to display map.
Here is the code that i have used:
<script src="js/jquery/jquery-1.9.0.min.js"></script>
<!-- <msdropdown> -->
<link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" />
<script src="js/msdropdown/jquery.dd.js"></script>
<link
href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC6v5-2uaq_wusHDktM9ILcqIrlPtnZgEk&sensor=false">
</script>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places">
</script>
</head>
<body onload="initialize()">
<select id="countries" style="width:300px;"
onchange="updateMap(this.options[this.selectedIndex].value)">
<option value='TVSH - Rruga Ismail Quemali 11>TVSH - Rruga
Ismail Quemali 11, Tirana</option></select>
function updateMap(selectControl) {
alert(selectControl);
switch (selectControl) {
case 'TVSH - Rruga Ismail Quemali 11, Tirana':
var polyline = new google.maps.Polyline({
path: [
new google.maps.LatLng(41.321102, 19.823112)],
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
var latLng = new google.maps.LatLng(41.321102, 19.823112)
break;
default:
break;
}
initialize(polyline, latLng);
}
function initialize(polyline, schoolLatLng) {
var myLatLng = schoolLatLng;
var myOptions = {
zoom: 13,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new
google.maps.Map(document.getElementById("map_canvas"),
myOptions);
polyline.setMap(map);
}
Now map is displaying on the basis of latitude and longitude.Is there any
way so i can directly show map on the basis address.I have address of all
comapnies like this:EURONEWS - 60, chemin des Mouilles - 69130
Lyon-Écully, France
Can i show map on the base of this address.Please ask me more description
if you need.

No comments:

Post a Comment