Database Reference
In-Depth Information
Geo library
Amazon has provided us with a library that can help you do geographic operations and use
it in your applications; it's called Geo library. The most common use of Geo libraries hap-
pens for mobile applications. This library helps you build location-aware mobile applica-
tions.
This library can help you store a Point of Interest ( POI ). For example, you have decided
to create an application that shows the fine-dining restaurants within a certain range of your
current location. This library would first let you store some restaurants that are POIs for
you. And then, you can query all restaurants within a 500 metre range of your current geo-
graphical location.
Let's get into the details of this use case to understand this library better. To get started, first
you need to download the source of this library and do a maven build on it. You can down-
load the source from GitHub at https://github.com/awslabs/dynamodb-geo .
You can either clone or directly download the Zip file from GitHub. Once you have the
source code, you can build the jar by running the following Maven command:
mvn clean install -Dgpg.skip=true
Now, let's see how to use this library. To begin with, as usual, you need to create a Dy-
namoDB client with credentials and other things. Once you have the client ready, you need
to create a table, say, geo-table that you will be using to do all geography-related data
storing. You need to give this table's name to GeoDataManagerConfiguration to
create GeoDataManager as shown in the following code:
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
// Set geo table in configuration
GeoDataManagerConfiguration geoDataManagerConfiguration =
new GeoDataManagerConfiguration(
client, "geo-table");
// Create Geo data manager
GeoDataManager geoDataManager = new
GeoDataManager(geoDataManagerConfiguration);
Search WWH ::




Custom Search