Database Reference
In-Depth Information
Once you are ready with the geo data manager, you have to create geo points to save in
the table, which can be retrieved later. A geo point is a data model created to store geo-
graphic points. It contains attributes such as latitude and longitude. You need to also give
one unique ID for this geo point as the range key attribute. To store further information,
you can keep on adding other attributes. Consider the following example:
// Set geo table in configuration
GeoDataManagerConfiguration geoDataManagerConfiguration =
new GeoDataManagerConfiguration(
client, "geo-table");
// Create Geo data manager
GeoDataManager geoDataManager = new
GeoDataManager(geoDataManagerConfiguration);
// Create geo point
GeoPoint geoPoint = new GeoPoint(18.518229,73.85705);
// Create unique range key attribute
AttributeValue rangekey = new
AttributeValue().withS("POI_000001");
// Create attribute for storing restaurant name
AttributeValue resName = new AttributeValue().withS("Hotel
TAJ");
// Create put point request for storing data in dynamodb
table
PutPointRequest request = new PutPointRequest(geoPoint,
rangekey);
// Add attribute name
request.getPutItemRequest().getItem().put("name", resName);
// Invoke put point method
geoDataManager.putPoint(request);
You can keep on adding such items to increase your database and support for various cit-
ies. As shown in the previous example, you can also add additional attributes (in this case
Search WWH ::




Custom Search