I am trying to allow users on my app to define a "territory" (as a polygon). Then others can query a point (lat and long), to determine whos territory that point falls in. I have determined from the docs for GeoAlchemy2, that this would likely be a good tool for the job (my app is curently in dev, so I am open to other suggestions. I am using flask, flask-sqlalchemy, and Sqlite in dev... plan on Postgres in prod. AngularJS for frontend).
My search lead me to ng-map, specifically the drawing manager directive seen here. https://ngmap.github.io/#/!drawing-manager.html. In modifying the example, I can get to the google onMapOverlayCompleted object. In there I see a latLng object, but am unsure how to transform it into something I can persist in the database. Assuming I do this in JS, can I dump it to JSON to send to my Flask API?
Can anyone point me in the right direction on how to do this? I am more than willing to listen to better ideas.
Thanks.
Here is some code from that example:
var app = angular.module('myapp', ['ngMap']);
app.controller('DrawingManagerCtrl', function() {
var vm = this;
vm.onMapOverlayCompleted = function(e){
console.log(e);
};
});
How can I get the polygon from 'e'?