geotools icon indicating copy to clipboard operation
geotools copied to clipboard

calculate center and radius of polygon?

Open wivaku opened this issue 4 years ago • 2 comments

Is it possible / are there plans to keep track of the center and radius of a polygon?

My use case:

  1. first: keep adding coordinates to end of polygon until certain radius is exceeded
  2. then: keep removing coordinates from start of polygon until radius is within defined limit

For this I need to calculate the weighted center of the current polygon (not: average of the bounding box) and the radius of the coordinates.

Bonus points when average is calculated by keeping track of the sums of x/y/z (and dividing by number of coordinates) instead of calculating/adding all x/y/z's when center is calculated.

wivaku avatar May 24 '21 15:05 wivaku

Would be useful to have a drawRadiusByDistance([48.9675969, 1.7440796], 200) defaults to meters and draws a circle with a radius of 200 meters around the coordinates. Then could check if any coordinates are within that radius.

Kerrialn avatar Aug 26 '21 13:08 Kerrialn

Would be useful to have a drawRadiusByDistance([48.9675969, 1.7440796], 200) defaults to meters and draws a circle with a radius of 200 meters around the coordinates. Then could check if any coordinates are within that radius.

Is this ever implemented or how did you solve this? I am searching for similar solution i think, i need to know if a car is inside the geofence/radius of an address?

jansor avatar Jul 10 '22 06:07 jansor