import com.vividsolutions.jts.index.strtree.STRtree;
STRtree index = new STRtree();
index.insert(envelope, spatialObject);
Envelope searchEnvelope = new Envelope(x1, x2, y1, y2);
List result = index.query(searchEnvelope);
import com.vividsolutions.jts.index.strtree.STRtree;
public class SpatialIndexDemo {
public static void main(String[] args) {
STRtree index = new STRtree();
Envelope envelope = new Envelope(x, y, width, height);
SpatialObject spatialObject = new SpatialObject(geometry);
index.insert(envelope, spatialObject);
Envelope searchEnvelope = new Envelope(x1, x2, y1, y2);
List result = index.query(searchEnvelope);
for (Object obj : result) {
SpatialObject spatialResult = (SpatialObject) obj;
}
}
}