Hi GEE,
Am creating an app which uses rectangle, polygon, circle etc to draw of
interest on Google Map.
var drawingManager = new google.maps.drawing.DrawingManager({
drawingMode: google.maps.drawing.OverlayType.POLYGON,
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: ['rectangle', 'circle', 'polygon', 'polyline',
'marker']
I created a created a function to unpack the coordinates of the Polygon as
var getCoordinates = function(rect) {
var points = rect.getPath().getArray();
return points.map(function(point){
return [point.lng(), point.lat()];
});
I get the JSON of the coordinates as
$.getJSON(
'/getmapdata',
{
polygon: getCoordinates(polygon),
pickerStartDate: getStartDate(),
pickerEndDate: getEndDate(),
},
At the backend I read the coordinates as:
if self.request.get('polygon'):
coords = [float(i) for i in self.request.get('polygon')]
geometry = ee.FeatureCollection([ee.Feature(
ee.Geometry.Polygon(coords=coords),
{'system:index': '0'}
)])
else:
However the backend script seems not to be reading the coordinates right
and is not able creating the geometry. What am I doing wrong at the back
end?
thank you for help
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/fa1ad923-dbbc-488e-9394-d1b2cbe22093%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.