Hi I've been following this tutorial http://googledevelopers.blogspot.com/2014/12/building-scalable-geofencing-api-on.html , and here's my problem,
I have a list of longitude and latitude coordinates that I've added to a JTS(Java Topology Suite) STR tree as Points.
Now I would like to send an area that is in the shape of a circle to the STR tree to find all of the Points that land in the circle.
Coordinate center = new Coordinate(entity.getLongitude(), entity.getLatitude());
GeometricShapeFactory gsf = new GeometricShapeFactory();
gsf.setCentre(center);
gsf.setNumPoints(20);
**gsf.setSize(320.0);**
Polygon poly = gsf.createCircle();
Coordinate[] coordinates = poly.getCoordinates();
//Create polygon from the coordinates.
GeometryFactory fact = new GeometryFactory();
LinearRing linear_ring = new GeometryFactory().createLinearRing(coordinates);
Polygon polygon = new Polygon(linear_ring, null, fact);
List<STRLeaf> items = strTree.query(polygon.getEnvelopeInternal());
However the result of the search sends back all of the data in the in the tree of longitude and latitude Points. When I lower the size of the circle below 320 then I receive no results from the search of the STR tree. Does anyone have experience with this ideally I would like to create the circle that finds all the points within a circle of ~7miles.
thanks for your time
It turns out that I had a silly mistake in the backend. When I added the items to the tree I mixed up the x and y coords, so that the Lat Longs were reversed. After switching them, I can now set the size of the circle to around 0.1 and it works well.