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
3aad299f
Commit
3aad299f
authored
May 27, 2018
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try connect with front
parent
280581a2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
38 deletions
+51
-38
sentinel.py
catalog/apis/sentinel.py
+16
-6
base_top.html
catalog/templates/base_top.html
+17
-23
views.py
catalog/views.py
+18
-9
No files found.
catalog/apis/sentinel.py
View file @
3aad299f
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
catalog/templates/base_top.html
View file @
3aad299f
...
...
@@ -104,40 +104,36 @@
<div
class=
"tab-content"
>
<!-- Home tab content -->
<div
class=
"tab-pane"
id=
"control-sidebar-home-tab"
>
<h3
class=
"control-sidebar-heading"
>
Recent Activity
</h3>
<h3
class=
"control-sidebar-heading"
>
Products
</h3>
<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"
>
Langdon's Birthday
</h4>
<p>
Will be 23 on April 24th
</p>
<h4
class=
"control-sidebar-subheading"
>
first image
</h4>
<p>
size: 700 mb
Date: April 11th
</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
<h3
class=
"control-sidebar-heading"
>
Tasks Progress
</h3>
<ul
class=
"control-sidebar-menu"
>
<li>
<a
href=
"javascript:void(0)"
>
<
h4
class=
"control-sidebar-subheading"
>
Custom Template Design
<
span
class=
"label label-danger pull-right"
>
70%
</span
>
</h4
>
<div
class=
"progress progress-xxs"
>
<
div
class=
"progress-bar progress-bar-danger"
style=
"width: 70%"
></div
>
<
i
class=
"menu-icon fa fa-birthday-cake bg-red"
></i
>
<div
class=
"menu-info"
>
<
h4
class=
"control-sidebar-subheading"
>
second image
</h4
>
<p
>
size: 900 mb
Date: April 19th
<
/p
>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
</div>
<!-- /.tab-pane -->
...
...
@@ -161,8 +157,6 @@
</div>
<!-- /.form-group -->
<h3
class=
"control-sidebar-heading"
>
Chat Settings
</h3>
<div
class=
"form-group"
>
...
...
catalog/views.py
View file @
3aad299f
...
...
@@ -37,18 +37,27 @@ def productList(request):
"""
View function for home page of site.
"""
s
=
APISentinel
()
s
.
getProducts
()
queryDict
=
request
.
POST
r2
=
dict
(
request
.
POST
)
r2
.
pop
(
'csrfmiddlewaretoken'
,
None
)
url
=
'https://api.daac.asf.alaska.edu/services/search/param?'
+
urlencode
(
r2
,
'utf-8'
)
+
"&output=JSON"
polygon
=
queryDict
[
"polygon"
]
process
=
queryDict
[
"platform"
]
endDate
=
queryDict
[
"end"
]
initDate
=
queryDict
[
"start"
]
cloudPercentage
=
queryDict
[
"cloudPercentage"
]
sentinel
=
APISentinel
()
products
=
sentinel
.
getProducts
(
polygon
,
initDate
,
endDate
,
cloudPercentage
)
# response = requests.get(url)
# json = response.json()
products_json
=
json
.
dumps
(
products
,
ensure_ascii
=
False
,
default
=
str
)
return
render
(
request
,
'productList.html'
,{})
#"catalog":json[0]})
# r2 = dict(request.POST)
# r2.pop('csrfmiddlewaretoken', None)
# url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON"
# response = requests.get(url)
# json = response.json()
return
render
(
request
,
'base_top.html'
,
{
"catalog"
:
products_json
})
#"catalog":json[0]})
#-------------------------------------------------------------------------------
class
SearchSubmitView
(
View
):
...
...
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