How Can I do to display a polygon and a Geocoding on the same map ?

I just don't see my error
Here's my javascript code


// JavaScript Document

//Google Maps API fonctions V3

function initialize() {
  var latlng = new google.maps.LatLng(43.58854, 1.45982);
  var myOptions = {
        zoom: 12,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById("map_canvas"),
          myOptions);

// Fonction d'affichage de la zone héracles

  var zoneHeracles;

  var HeraclesCoords = [
    new google.maps.LatLng(43.64288, 1.42817),
    new google.maps.LatLng(43.64137, 1.43240),
    new google.maps.LatLng(43.63564, 1.43845),
    new google.maps.LatLng(43.62889, 1.44375),
    new google.maps.LatLng(43.62691, 1.44523),
    new google.maps.LatLng(43.62518, 1.44583),
    new google.maps.LatLng(43.62298, 1.44588),
    new google.maps.LatLng(43.62242, 1.44581),
    new google.maps.LatLng(43.62134, 1.44592),
    new google.maps.LatLng(43.62281, 1.44944),
    new google.maps.LatLng(43.62455, 1.45472),
    new google.maps.LatLng(43.62657, 1.45931),
    new google.maps.LatLng(43.626, 1.45929),
    new google.maps.LatLng(43.62492, 1.45888),
    new google.maps.LatLng(43.62371, 1.4592),
    new google.maps.LatLng(43.61968, 1.45736),
    new google.maps.LatLng(43.61914, 1.4591),
    new google.maps.LatLng(43.61838, 1.46058),
    new google.maps.LatLng(43.61788, 1.46094),
    new google.maps.LatLng(43.61713, 1.45965),
    new google.maps.LatLng(43.61423, 1.46107),
    new google.maps.LatLng(43.61399, 1.46133),
    new google.maps.LatLng(43.61153, 1.45787),
    new google.maps.LatLng(43.61108, 1.45781),
    new google.maps.LatLng(43.60978, 1.45607),
    new google.maps.LatLng(43.60969, 1.45549),
    new google.maps.LatLng(43.60978, 1.45513),
    new google.maps.LatLng(43.60942, 1.45463),
    new google.maps.LatLng(43.60899, 1.45517),
    new google.maps.LatLng(43.60661, 1.45658),
    new google.maps.LatLng(43.60515, 1.45736),
    new google.maps.LatLng(43.6024, 1.45742),
    new google.maps.LatLng(43.60067, 1.45686),
    new google.maps.LatLng(43.59769, 1.45693),
    new google.maps.LatLng(43.59497, 1.45689),
    new google.maps.LatLng(43.59371, 1.45776),
    new google.maps.LatLng(43.59082, 1.46066),
    new google.maps.LatLng(43.58769, 1.46116),
    new google.maps.LatLng(43.58353, 1.45071),
    new google.maps.LatLng(43.58428, 1.44794),
    new google.maps.LatLng(43.58377, 1.44414),
    new google.maps.LatLng(43.58436, 1.43116),
    new google.maps.LatLng(43.58467, 1.42935),
    new google.maps.LatLng(43.58131, 1.42770),
    new google.maps.LatLng(43.57843, 1.42753),
    new google.maps.LatLng(43.57906, 1.42356),
    new google.maps.LatLng(43.58104, 1.42468),
    new google.maps.LatLng(43.58294, 1.41906),
    new google.maps.LatLng(43.5822, 1.41867),
    new google.maps.LatLng(43.58315, 1.41459),
    new google.maps.LatLng(43.5847, 1.41109),
    new google.maps.LatLng(43.5851, 1.40979),
    new google.maps.LatLng(43.58753, 1.40901),
    new google.maps.LatLng(43.58956, 1.40886),
    new google.maps.LatLng(43.59147, 1.40326),
    new google.maps.LatLng(43.59422, 1.40903),
    new google.maps.LatLng(43.60423, 1.40511),
    new google.maps.LatLng(43.6078, 1.39755),
    new google.maps.LatLng(43.61436, 1.40049),
    new google.maps.LatLng(43.61495, 1.40453),
    new google.maps.LatLng(43.62187, 1.40208),
    new google.maps.LatLng(43.62479, 1.40204),
    new google.maps.LatLng(43.62468, 1.40414),
    new google.maps.LatLng(43.62555, 1.40796),
    new google.maps.LatLng(43.62625, 1.41036),
    new google.maps.LatLng(43.62608, 1.41174),
    new google.maps.LatLng(43.62546, 1.41178),
    new google.maps.LatLng(43.62391, 1.41993),
    new google.maps.LatLng(43.64161, 1.42238),
    new google.maps.LatLng(43.64288, 1.42817)
  ];

  // Construct the polygon
  // Note that we don't specify an array or arrays, but instead just
  // a simple array of LatLngs in the paths property
  zoneHeracles = new google.maps.Polygon({
    paths: HeraclesCoords,
    strokeColor: "#FF0000",
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: "#FF0000",
    fillOpacity: 0.35
  });

  zoneHeracles.setMap(map); //end Zone héracles


//Fonction de Géolocalisation d'adresse (geocoding)
  var geocoder;
  var map;
  function initialize() {geocoder = new google.maps.Geocoder();}

function codeAddress() {
  var address = document.getElementById("address").value;
  geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          map.setCenter(results[0].geometry.location);
          var marker = new google.maps.Marker({
                  map: map,
                  position: results[0].geometry.location
          });
        } else {
          alert("Votre localisation ne peux pas fonctionner pour les raisons
suivantes: " + status);
        }
  });
}//end geocoding

} //end function initialize


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to