My team needs a DBMS like DynamoDB to store large amount of data, principally places and coordinates. I\'ve considered to use some GIS-based DBMS (like PostGIS) with an index on
I'm currently researching this subject myself. I'm using MongoDb (I know you asked for DynamoDb, but you also asked for general NoSql usage) and my code looks like this:
record structure:
public class FrameDocument
{
[BsonId]
public Guid Id { get; set; }
[BsonElement("coordinates")]
public Point[] Polygon { get; set; }
}
public class Point
{
[BsonElement("name")]
public string Orientation { get; set; }
[BsonElement("loc")]
public double[] Location { get; set; }
}
connecting and ensuring index:
MongoServer server = MongoServer.Create(connectionString);
MongoDatabase database = server.GetDatabase(databaseName);
database.GetCollection(collectionName).EnsureIndex(IndexKeys.GeoSpatial("coordinates.loc"));
writing:
var items = database.GetCollection(collectionName);
items.InsertBatch(itemsToInsert);
searching:
double[,] points; // define you search coordinates
var items = database.GetCollection(collectionName);
var query = Query.WithinPolygon("coordinates.loc", points);
var cursor = items.Find(query);