www.webdeveloper.com
Results 1 to 8 of 8

Thread: Google Map question

  1. #1
    Join Date
    Aug 2011
    Posts
    5

    Question Google Map question

    Hi everyone, its great to find a place like this. Congratulations

    I'm looking for some help as I'm trying to make a link to a map using this:


    var buceriasHTML = '<img src="images/rn-bucerias.jpg" height="80" width="80" style="float: left; margin-right: 20px" /><strong>Bucer&iacute;as,<br />Nayarit</strong>';

    <li><a onclick="findAddress('Bucerias, Nayarit, MX',buceriasHTML)" style="color: #009; text-decoration: underline; cursorointer">Bucer&iacute;as, Nayarit</a></li>

    Everything works fine BUT, I'm looking to get a zoom value to the map when the user clicks on the link.

    Is that possible?

    Will you share with me the code I need to get the proper zoom value for the link? (probably street view will be the best option)

    Thanks in advance for your help and/or pointing me to the right direction.

    Jesus

  2. #2
    Join Date
    Aug 2011
    Posts
    5
    Sorry, I should had used the code tag

    Code:
    var buceriasHTML = '<img src="images/rn-bucerias.jpg" height="80" width="80" style="float: left; margin-right: 20px" /><strong>Bucerias,<br />Nayarit</strong>';
    
    <li><a onclick="findAddress('Bucerias, Nayarit, MX',buceriasHTML)" style="color: #009; text-decoration: underline; cursorointer">Bucerias, Nayarit</a></li>

  3. #3
    Join Date
    Apr 2006
    Location
    Perth
    Posts
    154
    GoogleMaps uses z=1 to z=19 for zoom.

    Yes, I know, this does not contain any useful information from which you can easily
    incorporate into your own script. But that's the point. You have given us so little
    information that it is almost impossible to figure out what you are trying to do.
    Colin Fiat Simple Solutions To Complex Problems

  4. #4
    Join Date
    Aug 2011
    Posts
    5
    Thanks for your answer DracoMerest.

    I'll try to explain it better.

    I'm trying to add to the onclick function the zoom value I need for that specific place. Do you think that possible?

    (to add the zoom value to this line of code:
    Code:
    <li><a onclick="findAddress('Bucerias, Nayarit, MX',buceriasHTML)" style="color: #009; text-decoration: underline; cursorointer">Bucerias, Nayarit</a></li>
    Thanks for your help!

    Jesus

  5. #5
    Join Date
    Apr 2006
    Location
    Perth
    Posts
    154
    One line of HTML is not enough.

    What does the function findAddress() do?
    Colin Fiat Simple Solutions To Complex Problems

  6. #6
    Join Date
    Aug 2011
    Posts
    5
    Here's the code:

    Code:
    function findAddress(address, HTML) {
      if (HTML === undefined) {
        HTML = "<strong>" + address + "</strong>";
      }
      markerHTML = HTML;
      
      	var geocoder = new google.maps.Geocoder();
        geocoder.geocode( { 'address': address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);
       		addressSet = 1;
    		startAddress = address;
    		searchCenter = results[0].geometry.location;
    		createMarker(searchCenter, 0, markerHTML, "pin");
    		var trafficLayer = new google.maps.TrafficLayer();
    		trafficLayer.setMap(map);
    		    getCategories(0);
    		if (mapExtra === true) {
    			mapPost();
    		}
    
    	} else {
            alert("Geocode was not successful for the following reason: " + status);
          }
        });
    	
    }
    Thanks again for your help!

  7. #7
    Join Date
    Aug 2011
    Posts
    5
    I must say here, that I'm using the onclick code to get different links to different places.

    So, what I'm trying to do with the zoom its to give individual zoom value per place as, in some cases, smaller cities needs more zoom than big cities. I hope this make this more clear.

    Different zoom value per onclick link and each onclick link will open a new map.

    Jesus

  8. #8
    Join Date
    Apr 2006
    Location
    Perth
    Posts
    154
    Ah, now I understand.

    http://code.google.com/apis/maps/doc...ion/index.html

    There is even a discussion forum devoted to google maps.
    Colin Fiat Simple Solutions To Complex Problems

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles