Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Google Maps Display COUNTRY CODE (but not as alert)

Status
Not open for further replies.

t5amec

Programmer
Aug 14, 2003
112
GB
I have been tweaking codes and searching high and low for days now, but am looking for something like this but for it to also display in the results the country code that GoogleMaps has an element.

Here is the coding of the map i have on my site (fairly simple i'll have you agree) and i'm wondering if theres anything I have missed

Code:
<script type="text/javascript">  //<![CDATA[ 
 
 
    var map = null; 
    var geocoder = null; 


    function load() { 
      if (GBrowserIsCompatible()) { 
        map = new GMap2(document.getElementById("map")); 
        map.setCenter(new GLatLng(51.43, 0), 1); 
        map.addControl(new GLargeMapControl());  
 
        geocoder = new GClientGeocoder(); 
        
        GEvent.addListener(map, 'click', function(overlay, point) { 
     	 if (point) { 
     	   document.getElementById("show_x").innerHTML = point.x; 
    	    document.getElementById("show_y").innerHTML = point.y; 
     	 } 
  		 });	
  		 
  		GEvent.addListener(map, 'zoomend', 
                       function(oldZoomLevel, newZoomLevel) { 
  		   document.getElementById("zoom_old").innerHTML = oldZoomLevel; 
  		   document.getElementById("zoom_new").innerHTML = newZoomLevel; 
	    }); 
    
     } 
    } 

 
    function showAddress(address) { 
      if (geocoder) { 
        geocoder.getLatLng( 
          address, 
          function(point) { 
            if (!point) { 
              alert(address + " not found"); 
            } else { 
              map.setCenter(point, 14); 
              var marker = new GMarker(point); 
              map.addOverlay(marker); 


      		  document.getElementById("zoom_new").innerHTML = 14;
      		  document.getElementById("long").value=point.x;
      		  document.getElementById("lat").value=point.y;

            }
          }
        );

      }
    }


 
    //]]>
  </script>
					
					
									
								
<div class="noshow" id="long">long</div>
<div class="noshow" id="lat">lat</div>
<div class="noshow" id="country">country</div>

I look forward to hearing from you all soon

Make Sense? I hope so (-:
 
Hello Mate,

This is a Javascript challenge and a very specialist one at that as its dealing with the maps API and not just DOM manipulation.

I would suggest asking your questions here:


One things to keep in mind with the google group is DONT post inline in your questions as they get all complainy and moany about it, upload any code you have and just send them a link to it.

You'll get an answer pretty quick there I'm sure, I always have done.

Heston
 
If not you can always try the forum216 forum here on Tek-Tips

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top