locked
Mutliple Geocodes on Google Map RRS feed

  • Question

  • User-1129594362 posted

    Hi,

    How to set Multiple Geocodes on google map.

    I have a search page, in result will come as locations.

    If i get 10 results, each result has geocode.

    i have show all those on the map

    Friday, April 29, 2011 7:20 AM

All replies

  • User1682618242 posted
    I'm using this code to show a marker on the map when the user writes an address in a text box:
    $("#Location").live("blur", function () { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ address: $("#Location").val(), bounds: bounding }, function (results, status) { if (status == google.maps.GeocoderStatus.ZERO_RESULTS || $("#Location").val() == "") { return; } if (status != google.maps.GeocoderStatus.OK) { alert("We're having difficulties, could you please try again in a moment?"); return; } // Make a new map with the location and append it after the field minimap(results[0].geometry.location, false); }); });
    As you can see I'm using another function to display a minimap by sending the first results' location (which is a LatLng object). You can use a for loop to iterate through the results array and add a marker on the map for each result.location.
    Friday, April 29, 2011 7:35 AM
  • User-1129594362 posted

    Hi raduenuca,

    Can you post the complete code you are using now?

    Friday, April 29, 2011 7:47 AM
  • User1682618242 posted

    Here is the minimap function:

     

    function minimap(latLng) {
                var newminimap = new google.maps.Map(document.getElementById("add_problem_form_map"), {
                    zoom: 18,
                    center: latLng,
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    mapTypeControl: false,
                    navigationControl: false,
                    navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL },
                    scaleControl: false,
                    keyboardShortcuts: false,
                    streetViewControl: false,
                    scrollwheel: true
                });
                var marker = new google.maps.Marker({
                    map: newminimap,
                    ,
                    draggable: true,
                    animation: google.maps.Animation.DROP
                });
            }
    
    Saturday, April 30, 2011 12:30 PM
  • User-1129594362 posted

    Hi raduenca,

    Will you post complete code With

    Aspx and cs page

    And could you mention how u are using?

    Monday, May 2, 2011 1:34 AM
  • User1682618242 posted

    I used ASP.NET MVC 3. I gave you all the code needed to do what you want.

    Monday, May 2, 2011 2:56 AM
  • User-1129594362 posted

    Hi raduenuca,

    I need a page with Google map that will display multiple locations with code

    Monday, May 2, 2011 4:53 AM