Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
ae16b9ef
Commit
ae16b9ef
authored
May 28, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Plain Diff
product panel view
parents
0dcb0db8
bd3b39c2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
29 deletions
+82
-29
sentinel.py
catalog/apis/sentinel.py
+16
-6
rightPanel.css
catalog/static/css/rightPanel.css
+2
-3
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+6
-3
openLayers4.js
catalog/static/js/openLayers4.js
+19
-0
productList.html
catalog/templates/productList.html
+35
-16
views.py
catalog/views.py
+4
-1
No files found.
catalog/apis/sentinel.py
View file @
ae16b9ef
import
imp
import
imp
class
APISentinel
():
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
)
api
=
imp
.
load_source
(
'geosentinel'
,
GeoSentinel_path
)
sentinel
=
api
.
APISentinel
(
'emmhp'
,
'geoemm29'
)
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
:
products
=
sentinel
.
getProducts
(
area
,
(
initDate
,
endDate
),
print
products
[
p
][
"size"
]
{
"platformname"
:
"Sentinel-2"
,
"cloudcoverpercentage"
:
cloudPercentage
})
return
products
catalog/static/css/rightPanel.css
View file @
ae16b9ef
...
@@ -5,9 +5,8 @@
...
@@ -5,9 +5,8 @@
right
:
0
;
right
:
0
;
width
:
350px
;
width
:
350px
;
height
:
100%
;
height
:
100%
;
border
:
1px
solid
DarkSlateGray
;
background-color
:
DarkSlateGray
;
background-color
:
rgba
(
250
,
250
,
255
,
0.8
);
color
:
white
;
color
:
DarkSlateGray
;
}
}
.catalog
li
.catalog
li
...
...
catalog/static/js/dataRetrieval.js
View file @
ae16b9ef
...
@@ -103,14 +103,17 @@ function drawPolygon(element) {
...
@@ -103,14 +103,17 @@ function drawPolygon(element) {
// remove prev polygon
// remove prev polygon
osmap
.
removePolygon
();
osmap
.
removePolygon
();
// draw wkt polygon
osmap
.
addWKTPolygon
(
polygon
.
wkt_polygon
)
// format coords to draw
// format coords to draw
var
coords
=
osmap
.
formatCoords
(
polygon
.
geojson
.
geometry
.
coordinates
);
//
var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// get the biggest area
// get the biggest area
var
biggest
=
osmap
.
getBiggestPolygon
(
coords
);
//
var biggest = osmap.getBiggestPolygon(coords);
// draw coordsR
// draw coordsR
osmap
.
addPolygon
(
biggest
);
//
osmap.addPolygon(biggest);
}
}
})
})
}
}
...
...
catalog/static/js/openLayers4.js
View file @
ae16b9ef
...
@@ -102,6 +102,25 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
...
@@ -102,6 +102,25 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
this
.
showCoords
(
feature
.
getGeometry
());
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
* calculate the area of each polygon and return the coords of the biggest polygon
* @param coords polygons coords
* @param coords polygons coords
...
...
catalog/templates/productList.html
View file @
ae16b9ef
...
@@ -4,11 +4,30 @@
...
@@ -4,11 +4,30 @@
<head>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<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 '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>
</head>
<body>
<body
style=
"background-color: #222d32; color: #fff"
>
PRUEBA
<ul
class=
"control-sidebar-menu"
>
{{ item_data }}
<li>
<div
class=
"tt"
></div>
{% 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">-->
<!-- <ul class="catalog">-->
<!-- {% for i in catalog %}-->
<!-- {% for i in catalog %}-->
<!-- <li>-->
<!-- <li>-->
...
...
catalog/views.py
View file @
ae16b9ef
...
@@ -46,6 +46,8 @@ def productList(request):
...
@@ -46,6 +46,8 @@ def productList(request):
# print("R2: ", r2.keys());
# print("R2: ", r2.keys());
# 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"
# response = requests.get(url)
# json = response.json()
## ----------- aqui llamada a api sentinel -----------
## ----------- aqui llamada a api sentinel -----------
...
@@ -118,7 +120,8 @@ class SearchSubmitView(View):
...
@@ -118,7 +120,8 @@ class SearchSubmitView(View):
'id'
:
str
(
polygon
.
id
),
'id'
:
str
(
polygon
.
id
),
'city'
:
polygonInfo
[
'properties'
][
'NOMGEO'
],
'city'
:
polygonInfo
[
'properties'
][
'NOMGEO'
],
'state'
:
self
.
state_parser
[
polygonInfo
[
'properties'
][
'CVE_ENT'
]],
'state'
:
self
.
state_parser
[
polygonInfo
[
'properties'
][
'CVE_ENT'
]],
'geojson'
:
polygonInfo
'geojson'
:
polygonInfo
,
'wkt_polygon'
:
polygon
.
wkt_polygon
})
})
# context = {
# context = {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment