c# - how to display address in google map -


i displaying google map on asp.net page using jquery.i have nation name,company name,address , longitude , latitude.

right have add addresses in dropdown,on basis of dropdown selection have passed longitude , latitude in code.this part working display map on basis of latitude , longitude.but have no longitude , latitude comapnies.so want use directly address of comapnies display map.

here code 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 displaying on basis of latitude , longitude.is there way can directly show map on basis address.i have address of comapnies this:euronews - 60, chemin des mouilles - 69130 lyon-Écully, france

can show map on base of address.please ask me more description if need.

you can like:

var geocoder = new google.maps.geocoder(); geocoder.geocode( { 'address': 'chemin des mouilles - 69130 lyon-Écully, france'}, function(results, status) {   if (status == google.maps.geocoderstatus.ok) {     map.setcenter(results[0].geometry.location);     var marker = new google.maps.marker({         map: map,         position: results[0].geometry.location     });   } else {     alert("geocode not successful following reason: " + status);   } }); 

but watch out cause geocoder asynchronous.

https://developers.google.com/maps/documentation/javascript/geocoding


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -