Commit 280581a2 authored by Renán Sosa Guillen's avatar Renán Sosa Guillen
parents a4bb4357 01b5f1ea
import imp
class APISentinel():
def getProducts(this):
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"]
...@@ -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 from apis.sentinel import APISentinel
# Create your views here. # Create your views here.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -37,20 +37,12 @@ def productList(request): ...@@ -37,20 +37,12 @@ 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" s = APISentinel()
api = imp.load_source('geosentinel', GeoSentinel_path) s.getProducts()
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
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
# response = requests.get(url) # response = requests.get(url)
......
No preview for this file type
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