3

I am drawing a circle on a layer which has a lot of polygons (from Maps Engine) on it and trying to get the area of the intersection between my circle and the polygon.

If i use the intersects method from Maps Engine, i am getting all the coordinates of the polygon, but not exactly getting the points where i cut the polygon with my circle.

There is an example image:

enter image description here

You can get the Radius from drawingManager like circle.getRadius() and the area of it, as everybody knows circleArea=Math.PI*radius*radius

And with the intersects method from Maps Engine intersects=CIRCLE(center_lng center_lat, radius), then we can use the area of the all polygon area with computeArea method.

google.maps.geometry.spherical.computeArea();

At the end actually i want only the intersection between the polygon and the circle. Is there any other method that i can get the Intersection area between them?

xmux
  • 708
  • 2
  • 12
  • 28
  • 1
    A quick google search shows up this: http://stackoverflow.com/questions/6522484/google-maps-v3-check-if-point-exists-in-polygon which brings me to this: https://github.com/tparkin/Google-Maps-Point-in-Polygon I suggest you calculate an array of points around the circle and use the above plugin to see if they're inside the polygon using a forloop. I know it's not an answer but I hope this helps – Jonas Grumann Aug 28 '14 at 13:32
  • 1
    The [intersects geographic restriction](https://developers.google.com/maps-engine/documentation/read#geographic_restrictions) doesn't do what you want. Neither does the [ST_INTERSECTS Relationship function](https://developers.google.com/maps-engine/documentation/read#relationship_functions). – geocodezip Aug 28 '14 at 13:44
  • Actually it is kind of a Weiler–Atherton clipping algorithm. Maybe this can help me more : [link](http://sourceforge.net/projects/jsclipper/) Thanks for the advices! – xmux Aug 28 '14 at 15:37
  • You can [use the JSTS library to generate a polygon](http://stackoverflow.com/questions/26037104/how-to-calculate-intersection-area-in-google-maps-api-with-jsts-library) that represents the intersection area you want. – LinuxDisciple Mar 14 '17 at 16:39

0 Answers0