Results 1 to 6 of 6

Thread: google map needed

  1. #1
    sarahashwell is offline Registered User
    Join Date
    May 2008
    Posts
    11

    Default google map needed

    i need a simple map adding to listing that centers a small map on a custom field "postcode"

    any takers please

  2. #2
    Bruceper is offline Active Member
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    postcode, would this be for the UK? It may help if users knew.

  3. #3
    sarahashwell is offline Registered User
    Join Date
    May 2008
    Posts
    11

    Default hi

    yes uk

    i just want to use a custom field to center the map nothing flash

  4. #4
    echo@'s Avatar
    echo@ is offline Active Member
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    Hi Sarah

    This is what ive been using, im in the uk too, let me know how acurate it is as mine for some reason has become very in acurate, i think its a google uk thing


    PHP Code:
    <label>Google Map Directions</label>
    <
    span class="text">
    <
    div id="map" style="width: 370px; height: 270px">
    <
    script src="http://maps.google.co.uk/maps?file=api&amp;v=2&amp;key=yourkeyhere"
          
    type="text/javascript"></script>

        <!-- fail nicely if the browser has no Javascript -->
        <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b> 
          However, it seems JavaScript is either disabled or not supported by your browser. 
          To view Google Maps, enable JavaScript by changing your browser options, and then 
          try again.
        </noscript>
          
    <script type="text/javascript">

        //<![CDATA[

       var geocoder;
       var map;
       var address = "<%$postcode%>";
       var html = "<%$postcode%>"

       function load()
       {
          map = new GMap2(document.getElementById("map"));
          map.addControl(new GSmallMapControl());
          geocoder = new GClientGeocoder();
          geocoder.getLocations(address, addToMap);
       }


       function addToMap(response)
       {
          place = response.Placemark[0];
          point = new GLatLng(place.Point.coordinates[1],
                              place.Point.coordinates[0]);

          map.setCenter(point, 15);
          marker = new GMarker(point);
          
          html = html + '<p>Get directions to here from:' +
          '<form action="http://maps.google.com/maps" method="get" target="_blank">' +
          '<input type="text" SIZE=30 MAXLENGTH=40 name="saddr" id="saddr" value="" />' +
          '<INPUT value="Get Directions" TYPE="SUBMIT">' +
          '<input type="hidden" name="daddr" value="' + address + '"/></p>' +
          '<br/><br/>';
          
          map.addOverlay(marker);
          marker.openInfoWindowHtml(html);
          GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
       }

        //]]>
        </script>

    <body onload="load()" onunload="GUnload()">
    </span>
    </div> 

  5. #5
    Mitchell's Avatar
    Mitchell is offline Active Member
    Join Date
    Oct 2007
    Location
    Sydney
    Posts
    652

    Default

    You may have to give more information to the geocoder

    rather than
    var address = "<%$postcode%>";
    perhaps something like this;
    var address = "<%$address%> <%$city%> <%$state%> <%$postcode%>";

  6. #6
    saypee is offline Registered User
    Join Date
    Dec 2007
    Posts
    2

    Default

    Thx it work !!!

Similar Threads

  1. Help Needed
    By jrusso543 in forum INDEXU DELUXE v1.x
    Replies: 9
    Last Post: 05-07-2008, 05:39 PM
  2. Help needed with MOD
    By cantspeakgeek in forum INDEXU DELUXE v1.x
    Replies: 4
    Last Post: 05-04-2008, 02:24 PM
  3. Help needed
    By fish4carp in forum v5.x
    Replies: 10
    Last Post: 02-21-2008, 12:25 PM
  4. Help needed
    By 0870711 in forum v5.x
    Replies: 0
    Last Post: 09-06-2005, 06:37 PM
  5. No Url Needed?
    By ezykiwi in forum v5.x
    Replies: 1
    Last Post: 08-07-2004, 05:24 AM

Posting Permissions

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