String urLat = request.getParameter("urLat");
String urLon = request.getParameter("urLon");
if (llLat != null && llLon != null && urLat != null && urLon != null) {
try {
Envelope2D bbox = new Envelope2D(new DirectPosition2D(
Double.parseDouble(llLon), Double.parseDouble(llLat)),
new DirectPosition2D(Double.parseDouble(urLon), Double.parseDouble(urLat)));
beforeTime = System.currentTimeMillis();
results = tree.queryByBoundingBox(bbox);
afterTime = System.currentTimeMillis();
// get the polygon that approximates the region
Rectangle2D[] rects = bbox.toRectangles();
for (int i = 0; i < rects.length; i++) {
final Rectangle2D r = rects[i];
String regionStr = (r.getMinY()) + "," + (r.getMinX()) + ",";
regionStr += (r.getMaxY()) + "," + (r.getMinX()) + ",";
regionStr += (r.getMaxY()) + "," + (r.getMaxX()) + ",";