Database Reference
In-Depth Information
name ). The library encodes this geo point into the GeoJSON format. You can read more
about GeoJSON at http://geojson.org/ .
Now that you have stored the restaurant data into DynamoDB, you can simply start query-
ing that data using methods provided by the library.
Query rectangle
The Geo library allows us to find all geo points falling between a pair of geo points. This
searches all the items which are part of the rectangle when drawn using the given geo
points. By giving these kinds of input, you can run the query rectangle, which would give
you back all items falling in that rectangle. The following is the syntax for this operation:
// Min geo point
GeoPoint minGeoPoint = new GeoPoint(18.514973, 73.850698);
// Max geo point
GeoPoint maxGeoPoint = new GeoPoint(18.522624, 73.864088);
// Create query rectangle request
QueryRectangleRequest rectangleRequest = new
QueryRectangleRequest(
minGeoPoint, maxGeoPoint);
// Invoke query rectangle method
QueryRectangleResult rectangleResult = geoDataManager
.queryRectangle(rectangleRequest);
// Get items from the result
for (Map<String, AttributeValue> item :
rectangleResult.getItem()) {
System.out.println("Item :" + item);
}
This would result in listing all items inside that rectangle.
Search WWH ::




Custom Search