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
f5991429
Commit
f5991429
authored
Feb 06, 2019
by
Sergio Adrian Gongora Euan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.geoint.mx/mario.chirinos/GeoInt_SIDT
into dev
parents
af79f7bd
cbf128fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
8 deletions
+31
-8
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+4
-3
map.html
catalog/templates/map.html
+1
-0
views.py
catalog/views.py
+26
-5
No files found.
catalog/static/catalog/js/dataRetrieval.js
View file @
f5991429
...
@@ -490,9 +490,10 @@ $(document).ready(function () {
...
@@ -490,9 +490,10 @@ $(document).ready(function () {
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'product_objects'
:
JSON
.
stringify
(
productObject
),
'product_objects'
:
JSON
.
stringify
(
productObject
),
'wkt'
:
$
(
"#product-form input[name=polygon]"
).
val
(),
'wkt'
:
$
(
"#product-form input[name=polygon]"
).
val
(),
'startDate'
:
$
(
"#product-form input[name=start]"
).
val
(),
'startDate'
:
$
(
"#product-form input[name=start]"
).
val
(),
'endDate'
:
$
(
"#product-form input[name=end]"
).
val
(),
'endDate'
:
$
(
"#product-form input[name=end]"
).
val
(),
'clouds'
:
$
(
"#product-form input[name=cloudPercentage]"
).
val
(),
'clouds'
:
$
(
"#product-form input[name=cloudPercentage]"
).
val
(),
'usuario'
:
$
(
"#product-form input[name=user_name]"
).
val
()
},
},
dataType
:
'json'
dataType
:
'json'
});
});
...
...
catalog/templates/map.html
View file @
f5991429
...
@@ -137,6 +137,7 @@
...
@@ -137,6 +137,7 @@
<!-- <form role="form" target="catalogFrame" action="{% url 'productList' %}" method="post"> -->
<!-- <form role="form" target="catalogFrame" action="{% url 'productList' %}" method="post"> -->
<form
id=
'product-form'
role=
"form"
method=
"post"
>
<form
id=
'product-form'
role=
"form"
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
<input
type=
"hidden"
id=
"user_name"
name=
"user_name"
value=
{{user.get_username}}
>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<li
class=
"treeview"
>
<li
class=
"treeview"
>
<a
href=
"#"
>
<a
href=
"#"
>
...
...
catalog/views.py
View file @
f5991429
...
@@ -12,12 +12,14 @@ from django.core import management
...
@@ -12,12 +12,14 @@ from django.core import management
#from urllib import urlencode
#from urllib import urlencode
#from collections import OrderedDict
#from collections import OrderedDict
import
requests
,
json
,
unicodedata
,
sys
,
base64
import
requests
,
json
,
unicodedata
,
sys
,
base64
import
os
import
sys
import
sys
sys
.
path
.
append
(
'../GeoSentinel/'
)
sys
.
path
.
append
(
'../GeoSentinel/'
)
from
geosentinel
import
APISentinel
,
polygonToBox
from
geosentinel
import
APISentinel
,
polygonToBox
sentinel
=
APISentinel
.
APISentinel
(
'emmhp'
,
'geoemm29'
)
sentinel
=
APISentinel
.
APISentinel
(
'emmhp'
,
'geoemm29'
)
NAS_PATH
=
'/home/david/NAS/'
# Create your views here.
# Create your views here.
...
@@ -268,17 +270,36 @@ def purchaseProduct(request):
...
@@ -268,17 +270,36 @@ def purchaseProduct(request):
print
(
request
.
POST
[
'startDate'
])
print
(
request
.
POST
[
'startDate'
])
print
(
request
.
POST
[
'endDate'
])
print
(
request
.
POST
[
'endDate'
])
print
(
request
.
POST
[
'clouds'
])
print
(
request
.
POST
[
'clouds'
])
print
(
request
.
POST
[
'usuario'
])
username
=
request
.
POST
[
'usuario'
]
fecha_inicio
=
request
.
POST
[
'startDate'
]
fecha_fin
=
request
.
POST
[
'endDate'
]
print
(
fecha_inicio
.
replace
(
"-"
,
""
))
print
(
fecha_fin
.
replace
(
"-"
,
""
))
userdir
=
NAS_PATH
+
"repsat_test_dev/"
+
username
##crea el directorio del usuario
if
not
os
.
path
.
exists
(
userdir
):
os
.
makedirs
(
userdir
)
products_dir
=
NAS_PATH
+
"sentinelImages/L2A/"
linksDir
=
userdir
+
"/L2A/"
#obtiene los datos para el json
#obtiene los datos para el json
data
=
{}
data
=
{}
data
[
'wkt'
]
=
request
.
POST
[
'wkt'
]
data
[
'wkt'
]
=
request
.
POST
[
'wkt'
]
data
[
'platform'
]
=
'Sentinel-2'
data
[
'platform'
]
=
'Sentinel-2'
data
[
'productLevel'
]
=
'L2A'
data
[
'productLevel'
]
=
'L2A'
data
[
'startDate'
]
=
request
.
POST
[
'startDate'
]
data
[
'startDate'
]
=
fecha_inicio
.
replace
(
"-"
,
""
)
#quita los guiones de la fecha
data
[
'endDate'
]
=
request
.
POST
[
'endDate'
]
data
[
'endDate'
]
=
fecha_fin
.
replace
(
"-"
,
""
)
#quita los guiones de la fecha
#~ data['startDate'] = request.POST['startDate']
#~ data['endDate'] = request.POST['endDate']
data
[
'clouds'
]
=
request
.
POST
[
'clouds'
]
data
[
'clouds'
]
=
request
.
POST
[
'clouds'
]
data
[
'productsDir'
]
=
'/home/david/NAS/sentinelImages/L2A/'
#~ data['productsDir'] = '/home/david/NAS/sentinelImages/L2A/'
data
[
'linksDir'
]
=
'/home/david/centroGEO/repsat/tests/L2A/'
#~ data['linksDir'] = '/home/david/centroGEO/repsat/tests/L2A/'
data
[
'productsDir'
]
=
products_dir
data
[
'linksDir'
]
=
linksDir
data
[
'username'
]
=
'mario-chirinos'
data
[
'username'
]
=
'mario-chirinos'
data
[
'password'
]
=
'r4nc0r4u'
data
[
'password'
]
=
'r4nc0r4u'
...
@@ -287,7 +308,7 @@ def purchaseProduct(request):
...
@@ -287,7 +308,7 @@ def purchaseProduct(request):
json_data
=
json
.
dumps
(
data
,
indent
=
4
)
json_data
=
json
.
dumps
(
data
,
indent
=
4
)
print
(
json_data
)
print
(
json_data
)
#escribe el json en el archivo
#escribe el json en el archivo
fidProductsFile
=
open
(
"/home/david/centroGEO/repsat/GeoInt_SIDT
/findProducts.json"
,
"w"
)
fidProductsFile
=
open
(
userdir
+
"
/findProducts.json"
,
"w"
)
fidProductsFile
.
write
(
json_data
)
fidProductsFile
.
write
(
json_data
)
fidProductsFile
.
close
()
fidProductsFile
.
close
()
...
...
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