Commit ae16b9ef authored by Renán Sosa Guillen's avatar Renán Sosa Guillen

product panel view

parents 0dcb0db8 bd3b39c2
import imp
class APISentinel():
def getProducts(this):
GeoSentinel_path = "/home/emmanuelhp/Documentos/GeoSentinel/geosentinel/APISentinel.py"
# area example:
# POLYGON((-89.62543487548828 21.068482340502072,-89.51351165771484 20.918472761430806,
# -89.72705841064453 20.9203969139719,-89.62543487548828 21.068482340502072))
# date example:
# ('20180101', '20180517')
# cloudPercentage axample:
# "[0 TO 10]"
# 95
def getProducts(this, area, initDate, endDate, cloudPercentage):
GeoSentinel_path = "/home/emmanuelhp/Documentos/geo/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"]
products = sentinel.getProducts(area, (initDate, endDate),
{"platformname":"Sentinel-2", "cloudcoverpercentage":cloudPercentage})
return products
......@@ -5,9 +5,8 @@
right:0;
width: 350px;
height: 100%;
border: 1px solid DarkSlateGray;
background-color: rgba(250,250,255,0.8);
color:DarkSlateGray;
background-color: DarkSlateGray;
color:white;
}
.catalog li
......
......@@ -103,14 +103,17 @@ function drawPolygon(element) {
// remove prev polygon
osmap.removePolygon();
// draw wkt polygon
osmap.addWKTPolygon(polygon.wkt_polygon)
// format coords to draw
var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// get the biggest area
var biggest = osmap.getBiggestPolygon(coords);
// var biggest = osmap.getBiggestPolygon(coords);
// draw coordsR
osmap.addPolygon(biggest);
// osmap.addPolygon(biggest);
}
})
}
......
......@@ -102,6 +102,25 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
this.showCoords(feature.getGeometry());
}
//------------------------------------------------------------------------------
/**
* Draw a polygon in the map
* @param wkt coords int wkt format to draw
*/
OpenStreetMapsClass.prototype.addWKTPolygon = function(wkt)
{
var format = new ol.format.WKT();
var feature = format.readFeature(wkt, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
this.map.getView().fit(feature.getGeometry(), {duration: 1000, padding: [0, 0, 70, 0]});
this.vectorLayer.getSource().addFeature(feature);
document.getElementById("id_polygon").value = wkt;
}
//------------------------------------------------------------------------------
/**
* calculate the area of each polygon and return the coords of the biggest polygon
* @param coords polygons coords
......
<!DOCTYPE html>
{% load static %}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{% static 'css/rightPanel.css'%}" type="text/css">
</head>
<body>
PRUEBA
{{ item_data }}
<div class="tt"></div>
<!-- <ul class="catalog">-->
<!-- {% for i in catalog %}-->
<!-- <li>-->
<!-- <div><img src="{{i.thumbnailUrl}}" width="64px"/></div>-->
<!-- <div>-->
<!-- {{i.productName}}<br>-->
<!-- {{i.sceneDate}}-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{% static 'css/rightPanel.css'%}" type="text/css">
<link rel="stylesheet" href="{% static 'adminlte/bower_components/bootstrap/dist/css/bootstrap.min.css' %}">
<!-- Theme style -->
<link rel="stylesheet" href="{% static 'adminlte/dist/css/AdminLTE.css' %}">
<link rel="stylesheet" href="{% static 'adminlte/dist/css/skins/_all-skins.css' %}">
<link rel="stylesheet" href="{% static 'adminlte/bower_components/select2/dist/css/select2.min.css' %}">
</head>
<body style="background-color: #222d32; color: #fff">
<ul class="control-sidebar-menu">
<li>
{% if catalog %}
<p>HI BUDDY</p>
{% endif %}
<a href="javascript:void(0)">
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">first image</h4>
<p>
size: 700 mb
Date: April 11th
</p>
</div>
</a>
</li>
</ul>
<!-- <ul class="catalog">-->
<!-- {% for i in catalog %}-->
<!-- <li>-->
<!-- <div><img src="{{i.thumbnailUrl}}" width="64px"/></div>-->
<!-- <div>-->
<!-- {{i.productName}}<br>-->
<!-- {{i.sceneDate}}-->
<!-- </div>-->
<!-- <div class="buyIcon"></div>-->
<!-- </li>-->
<!-- {% endfor %}-->
<!-- </ul>-->
<!-- </ul>-->
<script>
// var item_data = {
// city_name: "{{ item_data.city_name }}",
......
......@@ -46,6 +46,8 @@ def productList(request):
# print("R2: ", r2.keys());
# url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON"
# response = requests.get(url)
# json = response.json()
## ----------- aqui llamada a api sentinel -----------
......@@ -118,7 +120,8 @@ class SearchSubmitView(View):
'id': str(polygon.id),
'city': polygonInfo['properties']['NOMGEO'],
'state': self.state_parser[polygonInfo['properties']['CVE_ENT']],
'geojson': polygonInfo
'geojson': polygonInfo,
'wkt_polygon': polygon.wkt_polygon
})
# context = {
......
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