Commit a4bb4357 authored by Renán Sosa Guillen's avatar Renán Sosa Guillen
parents c65082e0 a9333f8a
...@@ -99,7 +99,7 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords) ...@@ -99,7 +99,7 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
this.vectorLayer.getSource().addFeature(feature); this.vectorLayer.getSource().addFeature(feature);
// show coords // show coords
document.getElementById("id_polygon").value = feature.getGeometry().clone().transform( 'EPSG:3857', 'EPSG:4326').getCoordinates(); this.showCoords(feature.getGeometry());
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
...@@ -153,14 +153,15 @@ OpenStreetMapsClass.prototype.formatCoords = function(coords) ...@@ -153,14 +153,15 @@ OpenStreetMapsClass.prototype.formatCoords = function(coords)
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* set value in input with wkt format * show values of a polygon with wkt format
* POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)) * POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
* MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20))) * MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)))
* @param coords to draw * @param geometry the geometry to show e.g. a polygon
*/ */
OpenStreetMapsClass.prototype.setPolygonInputValue = function(coords) OpenStreetMapsClass.prototype.showCoords = function(geometry)
{ {
// todo var wkt = new ol.format.WKT();
document.getElementById("id_polygon").value = wkt.writeGeometry(geometry.clone().transform( 'EPSG:3857', 'EPSG:4326'));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
......
...@@ -118,11 +118,11 @@ sidtMap.prototype.addInteraction = function() ...@@ -118,11 +118,11 @@ sidtMap.prototype.addInteraction = function()
}); });
this.interaction.on("drawend",function(e){ this.interaction.on("drawend",function(e){
document.getElementById("id_polygon").value =e.feature.getGeometry().clone().transform( 'EPSG:3857', 'EPSG:4326').getCoordinates(); self.showCoords(e.feature.getGeometry());
}); });
this.interaction.on("drawstart",function(e){ this.interaction.on("drawstart",function(e){
self.vectorLayer.getSource().clear(); self.removePolygon();
}); });
this.map.addInteraction(this.interaction); this.map.addInteraction(this.interaction);
......
...@@ -10,7 +10,7 @@ from django.views.generic.base import View ...@@ -10,7 +10,7 @@ from django.views.generic.base import View
from django.template import loader from django.template import loader
from urllib import urlencode from urllib import urlencode
import requests, json, unicodedata import requests, json, unicodedata
import imp
# Create your views here. # Create your views here.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -37,10 +37,18 @@ def productList(request): ...@@ -37,10 +37,18 @@ def productList(request):
""" """
View function for home page of site. View function for home page of site.
""" """
GeoSentinel_path = "/home/emmanuelhp/Documentos/GeoSentinel/geosentinel/APISentinel.py"
api = imp.load_source('geosentinel', GeoSentinel_path)
sentinel = api.APISentinel('emmhp', 'geoemm29')
area = "POLYGON((-89.62543487548828 21.068482340502072,-89.51351165771484 20.918472761430806,-89.72705841064453 20.9203969139719,-89.62543487548828 21.068482340502072))"
products = sentinel.getProducts(area, ('20180101', '20180517'), {"platformname":"Sentinel-2", "cloudcoverpercentage":"[0 TO 10]"})
for p in products:
print products[p]["size"]
r2 = dict(request.POST) r2 = dict(request.POST)
print r2 print r2
r2.pop('csrfmiddlewaretoken', None) r2.pop('csrfmiddlewaretoken', None)
url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON" url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON"
# print url # print url
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment