Hi there,

First off thank you for reading.

I got a question regarding breaking down the address that google returns.
It now shows the full address but I would like to extract the city name 
only.

Thanks again.

Jeroen

--- Code I use --- Part of this example -> http://wptuts.net/newgeotest.html

    $(function() {

    $("#auto-address").autocomplete({

      //This bit uses the geocoder to fetch address values

      source: function(request, response) {

        geocoder.geocode( {'address': request.term }, function(results, 
status) {

          response($.map(results, function(item) {

            return {

              label:  item.formatted_address,

              value: item.formatted_address,

              latitude: item.geometry.location.lat(),

              longitude: item.geometry.location.lng()

            }

          }));

        })

      },

      //This bit is executed upon selection of an address

      select: function(event, ui) {



        var location = new google.maps.LatLng(ui.item.latitude, 
ui.item.longitude);

        marker.setPosition(location);

searchedLocation = marker.getPosition();

        map.setCenter(location);

updateMarkerPosition(location);

geocodePosition(location); 

$("#address").text(location);

$("#formattedAddress").text('Address search result:');

        $("#info").text(searchedLocation);

      }

    });

  });

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/SNSuIJQ5mUEJ.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to