hi group ,
this is my map and for now it works perfect , i just want to add some
functionality for addresses that is submitted to form from users , if
address is IN polygon - give an OK  message to user , else - not
ok :)) and depend on this to change icon , anybody know what to do ?
my javascript skills are terrible :( so please help
i have found on web this article (http://dawsdesign.com/drupal/
google_maps_point_in_polygon) but not sure what to do to make it work
for my case

Thank you all in advance

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"; xmlns:v="urn:schemas-
microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/
>
    <title>Google Maps API Example: Simple Geocoding</title>
    <script src="poly.js" type="text/javascript"></script>
    <script src="http://maps.google.com/maps?
file=api&v=3&key=ABQIAAAA0IhZjWcjA5TCzf2FZ234fI7hhRjxDuAOlz3zMi2SjorAXY40o2haBRiRil5qVHDQtCLVCZvIMJyROFqLA"
type="text/javascript"></script>
    <script type="text/javascript">

    var map = null;
    var geocoder = null;
    var markers = [];
    var iconIncluded = 'http://maps.google.com/mapfiles/dd-start.png';
    var iconExcluded = 'http://maps.google.com/mapfiles/dd-end.png';

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        var mapCenter = new GLatLng(42.69959515809203,
23.316421508789063)
        map.setCenter(mapCenter, 13);
        map.setUIToDefault();
        map.setMapType(G_HYBRID_MAP);

        geocoder = new GClientGeocoder();

     var polygon = new GPolygon.fromEncoded({
        polylines: [
            {points: "svscguflm...@_gataiptfi~jr@~KlA|ClEnE`KvBlP|ChV|
cxjjebi`gfkvcjftbziz...@nddqxhptlx`@JjSrK|b...@`fd[en|
pejf...@sjauecoyk`kuewjwcoiwbxues@}tqfz...@bdexyg@yM|@iYgCaX",
             levels: "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
             color: "#000fff",
             opacity: 0.7,
             weight: 3,
             numLevels: 4,
             zoomFactor: 32}],
             fill: true,
             color: "#0000ff",
             opacity: 0.4,
             outline: true
            });

        map.addOverlay(polygon);

   }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
    </script>
  </head>

  <body onload="initialize()" onunload="GUnload()">
    <form action="#" onsubmit="showAddress(this.address.value); return
false">
      <p>
        <input type="text" size="60" name="address" value="София, Бул.
Васил Левски N:99, вх. Б" />
        <input type="submit" value="Go!" />
      </p>
      <div id="map_canvas" style="width: 500px; height: 300px"></div>
    </form>

  </body>
</html>

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en.


Reply via email to