TIMEX
TIMEX

Reputation: 272374

How do I build something like this in Google Maps V3 API?

http://gmaps-samples-v3.googlecode.com/svn/trunk/localsearch/places.html

In this example, I get many results returned when I perform a search. Because that's using the local search API. But in V3, I only get one result returned. My code is:

var address = $("#id_address_input").val();
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
    $("#badlocation_holder").hide();
    $("#map_canvas").show();
    $("#map_canvas_holder").show().css("background-color", "#E6E6FA").animate({"background-color":"#f5f5f5"}, 800);
    var myOptions = {
        zoom: 15,
        center: results[0].geometry.location,
        streetViewControl:false,
        mapTypeControl:false,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        scrollwheel:false,
    };

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);  
    var marker = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location,
            draggable:true
    });

Upvotes: 0

Views: 272

Answers (1)

Chris Broadfoot
Chris Broadfoot

Reputation: 5112

The Local Search API is deprecated. Take a look at the Places API, which may suit your requirements.

Upvotes: 1

Related Questions