tofuninjah / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

Problem with gpolygons[i].Contains(addressPoint) #96

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am trying to use geoxml3 to display 2 boundaries that are stored in an XML 
(kml) file. Then when user enters their address locate that address, and 
determine if it is inside (or outside) of each boundary.

I am basing it on the example found here: 
http://www.geocodezip.com/geoxml3_test/votemap_address2.html

everything is working fine, except for the method that displays the address.....

geoLocating the address works fine. Displaying the marker works fine, however, 
the following snippet fails:

// Loop through all boundaries and check if Inside/Outside the boundary
for (var i=0; i<geoXml.docs[0].gpolygons.length; i++)
{
  var is_in_boundary = geoXml.docs[0].gpolygons[i].Contains(addressPoint);

  if (is_in_boundary)
  {
     // If Point is inside this boundary
     contentString += "<br> inside " geoXml.docs[0].placemarks[i].name;
     break;
  }
  else {
     contentString += "<br> outside " + geoXml.docs[0].placemarks[i].name;
  }
}

specifically, it appears that the line: var is_in_boundary = 
geoXml.docs[0].gpolygons[i].Contains(addressPoint);
fails because "Contains()" is not a valid method.

My question is, why not? it works fine in the example given......any idea why 
it would fail?

I've attached the XML and HTML file so you can see entire thing.

Thanks for any help

Paul

Original issue reported on code.google.com by paul.her...@gmail.com on 10 Dec 2013 at 5:11

GoogleCodeExporter commented 8 years ago
Apologies, it works fine....i had a bad path for the additional .js 
file....once i fixed that it works as expected. Thanks

Original comment by paul.her...@gmail.com on 10 Dec 2013 at 5:16

GoogleCodeExporter commented 8 years ago

Original comment by geocodezip on 10 Dec 2013 at 6:43