Monday, 22 February 2016

Google Maps JS API v3 - Polygon formation


So my big question here is how does the Google Maps API determine the "inner" versus the "outer" for a filled polygon?


Playing around with the polygon creator @ http://www.the-di-lab.com/polygon/ there seems to be a preference to:



  1. wrap the north pole;

  2. take the "smallest" polygon possible?


The big reason I want to know is to assist with answering the question "is point (x,y) in multipolygon z?"



Thoughts?



Answer




The big reason I want to know is to assist with answering the question "is point (x,y) in multipolygon z?"



Using a Ray casting algorithm to solve the point in polygon problem, you don't need to know how the Google Code works.


enter image description here



The number of intersections for a ray passing from the exterior of the polygon to any point, if odd, shows the point lies inside the polygon. If even, the point lies outside the polygon. This test also works in three dimensions.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...