import sentinel api

parent 7ed2e9af
......@@ -10,14 +10,14 @@ from django.views.generic.base import View
from django.template import loader
from urllib import urlencode
import requests, json, unicodedata
import imp
# Create your views here.
#-------------------------------------------------------------------------------
def login(request):
"""
View function for home page of site.
"""
"""
# Render the HTML template index.html with the data in the context variable
......@@ -37,11 +37,18 @@ def productList(request):
"""
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.pop('csrfmiddlewaretoken', None)
url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON"
print url
# response = requests.get(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