I have a dataset of lat/long that I would like to match on dynamically generated circle/polygon from specific point with different radius.
I have already completed how to match lat/long with custom defined boundaries in a shapefile using GeoTools.
Now, instead of using boundaries defined in a custom shapefile, I would like to do following steps
-
Find centroid of the boundary (polygon)
-
Using centroid lat/long, create multiple circles/polygon with radius 5, 10 and 15 miles like 5 miles = Polygon1, 10 miles = Polygon2 15 miles = Polygon3
-
Match dataset of lat/long to see how many points lie in
Polygon1, Polygon2 and Polygon3.
Best Answer
To buffer the point the best way is to transform your feature to a projected crs and then use the JTS buffer operation. To create a 10 mile length use
Quantity<Length> dist = Quantities.getQuantity(10.0, USCustomary.MILE);
For a quick and dirty buffer you can use the
GeodeticCalculator
to fudge the X/Y distortion and hope for the best.Here's the results the stripy polygon is the "correct" buffer, the orange one is the simple one using lat/lon.