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
2c4ffb0c
Commit
2c4ffb0c
authored
Feb 13, 2019
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of gitlab.geoint.mx:mario.chirinos/GeoInt_SIDT into dev
parents
8dc6efe8
59af888a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
37 deletions
+103
-37
views.py
catalog/views.py
+24
-25
scldata.css
reports/static/reports/css/scldata.css
+14
-0
L2ASCL_data.html
reports/templates/L2ASCL_data.html
+62
-11
views.py
reports/views.py
+3
-1
No files found.
catalog/views.py
View file @
2c4ffb0c
...
@@ -495,23 +495,23 @@ def Pay(request):
...
@@ -495,23 +495,23 @@ def Pay(request):
# ---------------test process----------------------
# ---------------test process----------------------
print
(
"PAGAR!!!!"
)
print
(
"PAGAR!!!!"
)
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
query
=
[]
product_list
=
[]
query
=
Purchase
.
objects
.
values
(
'id'
,
'search__area'
,
'user'
,
'user__username'
,
'user__email'
,
'search_id'
,
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'search__area'
,
'user'
,
'user__username'
,
'user__email'
,
'search_id'
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
)
.
filter
(
user
=
user
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
)
.
filter
(
user
=
user
,
purchased
=
0
)
purchased
=
0
)
for
values
in
query
:
for
product
in
product_list
:
# print(
values
['user__username'])
# print(
product
['user__username'])
# print(
values
['user__email'])
# print(
product
['user__email'])
# print(
values
['search_id'])
# print(
product
['search_id'])
# print(str(
values
['search__startDate'].date()).replace("-", ""))
# print(str(
product
['search__startDate'].date()).replace("-", ""))
# print(str(
values
['search__endDate'].date()).replace("-", ""))
# print(str(
product
['search__endDate'].date()).replace("-", ""))
# print(
values
['search__clouds'])
# print(
product
['search__clouds'])
# print(
values
['search__area'])
# print(
product
['search__area'])
print
(
values
[
'id'
])
print
(
product
[
'id'
])
username
=
values
[
'user__username'
]
username
=
product
[
'user__username'
]
useremail
=
values
[
'user__email'
]
useremail
=
product
[
'user__email'
]
# userdir = NAS_PATH + "repsat_test_dev/"+useremail ##crea el directorio del usuario
# userdir = NAS_PATH + "repsat_test_dev/"+useremail ##crea el directorio del usuario
userdir
=
USERS_PATH
+
useremail
userdir
=
USERS_PATH
+
useremail
...
@@ -519,21 +519,21 @@ def Pay(request):
...
@@ -519,21 +519,21 @@ def Pay(request):
if
not
os
.
path
.
exists
(
userdir
):
if
not
os
.
path
.
exists
(
userdir
):
os
.
makedirs
(
userdir
)
os
.
makedirs
(
userdir
)
search_dir
=
userdir
+
"/"
+
str
(
values
[
'id'
])
purchase_dir
=
userdir
+
"/"
+
str
(
product
[
'id'
])
if
not
os
.
path
.
exists
(
search
_dir
):
if
not
os
.
path
.
exists
(
purchase
_dir
):
os
.
makedirs
(
search
_dir
)
os
.
makedirs
(
purchase
_dir
)
products_dir
=
NAS_PATH
+
"sentinelImages/L2A/"
products_dir
=
NAS_PATH
+
"sentinelImages/L2A/"
linksDir
=
search
_dir
+
"/L2A/"
linksDir
=
purchase
_dir
+
"/L2A/"
# obtiene los datos para el json
# obtiene los datos para el json
data
=
{}
data
=
{}
data
[
'wkt'
]
=
values
[
'search__area'
]
data
[
'wkt'
]
=
product
[
'search__area'
]
data
[
'platform'
]
=
'Sentinel-2'
data
[
'platform'
]
=
'Sentinel-2'
data
[
'productLevel'
]
=
'L2A'
data
[
'productLevel'
]
=
'L2A'
data
[
'startDate'
]
=
str
(
values
[
'search__startDate'
]
.
date
())
.
replace
(
"-"
,
""
)
# quita los guiones de la fecha
data
[
'startDate'
]
=
str
(
product
[
'search__startDate'
]
.
date
())
.
replace
(
"-"
,
""
)
# quita los guiones de la fecha
data
[
'endDate'
]
=
str
(
values
[
'search__endDate'
]
.
date
())
.
replace
(
"-"
,
""
)
# quita los guiones de la fecha
data
[
'endDate'
]
=
str
(
product
[
'search__endDate'
]
.
date
())
.
replace
(
"-"
,
""
)
# quita los guiones de la fecha
data
[
'clouds'
]
=
values
[
'search__clouds'
]
data
[
'clouds'
]
=
product
[
'search__clouds'
]
data
[
'productsDir'
]
=
products_dir
data
[
'productsDir'
]
=
products_dir
data
[
'linksDir'
]
=
linksDir
data
[
'linksDir'
]
=
linksDir
data
[
'username'
]
=
API_SENTINEL_USER
data
[
'username'
]
=
API_SENTINEL_USER
...
@@ -544,12 +544,11 @@ def Pay(request):
...
@@ -544,12 +544,11 @@ def Pay(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
(
search
_dir
+
"/findProducts.json"
,
"w"
)
fidProductsFile
=
open
(
purchase
_dir
+
"/findProducts.json"
,
"w"
)
fidProductsFile
.
write
(
json_data
)
fidProductsFile
.
write
(
json_data
)
fidProductsFile
.
close
()
fidProductsFile
.
close
()
os
.
system
(
os
.
system
(
SENTINEL_PATH
+
"/tools/L2ASCL_AreaProcessing.sh "
+
purchase_dir
+
"/ 1 &> "
+
purchase_dir
+
"/L2ASCL_AreaProcessing.log"
)
###ejecuta el proceso
"L2ASCL_AreaProcessing.sh "
+
search_dir
+
"/ 1 > "
+
search_dir
+
"/L2ASCL_AreaProcessing.log"
)
###ejecuta el proceso
...
@@ -647,4 +646,4 @@ def IPN(request):
...
@@ -647,4 +646,4 @@ def IPN(request):
# pass
# pass
# else:
# else:
# pass
# pass
# return redirect("https://google.com.mx")
# return redirect("https://google.com.mx")
\ No newline at end of file
reports/static/reports/css/scldata.css
View file @
2c4ffb0c
...
@@ -2,3 +2,17 @@ body
...
@@ -2,3 +2,17 @@ body
{
{
background-color
:
White
;
background-color
:
White
;
}
}
.next
{
padding
:
0px
;
padding-top
:
50%
;
cursor
:
pointer
;
font-size
:
20px
;
}
.prev
{
padding-left
:
20px
;
padding-top
:
50%
;
cursor
:
pointer
;
font-size
:
20px
;
}
reports/templates/L2ASCL_data.html
View file @
2c4ffb0c
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/map.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/map.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/body.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/body.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/modal1.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/modal1.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'reports/css/scldata.css' %}"
type=
"text/css"
>
<!-- <link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">-->
<!-- <link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">-->
<link
rel=
"stylesheet"
href=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
>
<link
rel=
"stylesheet"
href=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
>
...
@@ -248,7 +249,7 @@
...
@@ -248,7 +249,7 @@
<!-- AREA CHART -->
<!-- AREA CHART -->
<div
class=
"box box-primary"
>
<div
class=
"box box-primary"
>
<div
class=
"box-header with-border"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
{{ t
ype }} Chart Km²
</h3>
<h3
class=
"box-title"
>
{{ t
itle }} SCL Image Classification Data(Km²)
</h3>
<div
class=
"box-tools pull-right"
>
<div
class=
"box-tools pull-right"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
...
@@ -275,7 +276,7 @@
...
@@ -275,7 +276,7 @@
<!-- DONUT CHART -->
<!-- DONUT CHART -->
<div
class=
"box box-danger"
>
<div
class=
"box box-danger"
>
<div
class=
"box-header with-border"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
Map Image
</h3>
<h3
class=
"box-title"
id=
"titleMap"
>
{{dafaultLabel}} - {{defaultDataSet}}
</h3>
<div
class=
"box-tools pull-right"
>
<div
class=
"box-tools pull-right"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
...
@@ -286,9 +287,19 @@
...
@@ -286,9 +287,19 @@
</div>
</div>
</div>
</div>
<div
class=
"box-body"
>
<div
class=
"box-body"
>
<img
onclick=
"window.open(this.src)"
class=
"img-responsive"
id=
"satImage"
width=
"400"
<div
class=
"row"
>
height=
"400px"
<div
class=
"col-lg-1 prev"
style=
"display: none"
>
style=
"margin-left: auto; margin-right: auto; display: block;"
>
<i
class=
"glyphicon glyphicon-chevron-left"
onclick=
"prev()"
></i>
</div>
<div
class=
"col-lg-10 col-lg-offset-1"
id=
"showImage"
>
<img
onclick=
"window.open(this.src)"
class=
"img-responsive"
id=
"satImage"
width=
"400"
height=
"400px"
src =
"../../static/reports/tmpImages/repsat_test_dev/{{IMAGE_PATH}}/{{dafaultLabel}}_TCI_60m.jpg"
style=
"margin-left: auto; margin-right: auto; display: block;"
>
</div>
<div
class=
"col-lg-1 next"
style=
"display: none"
>
<i
class=
"glyphicon glyphicon-chevron-right"
onclick=
"next()"
></i>
</div>
</div>
</div>
</div>
<!-- /.box-body -->
<!-- /.box-body -->
</div>
</div>
...
@@ -358,8 +369,7 @@
...
@@ -358,8 +369,7 @@
config
.
options
=
{
config
.
options
=
{
responsive
:
true
,
responsive
:
true
,
maintainAspectRatio
:
false
,
maintainAspectRatio
:
false
,
<!--
scales
:
{
xAxes
:
[{
stacked
:
true
}],
yAxes
:
[{
stacked
:
true
}]},
-->
// scales: { xAxes: [{ stacked: true }], yAxes: [{ stacked: true }] },
title
:
{
text
:
"SCL Image Classification Data (Km²)"
,
display
:
true
},
};
};
{
%
endautoescape
%
}
{
%
endautoescape
%
}
// Creamos una gráfica con los datos al macenados en config
// Creamos una gráfica con los datos al macenados en config
...
@@ -367,22 +377,63 @@
...
@@ -367,22 +377,63 @@
//ctx.canvas.width = 256;
//ctx.canvas.width = 256;
//ctx.canvas.height = 512;
//ctx.canvas.height = 512;
var
myChart
=
new
Chart
(
ctx
,
config
);
var
myChart
=
new
Chart
(
ctx
,
config
);
var
activePoints
=
[];
var
imageNumber
=
0
;
//var myChart;
//var myChart;
// mostrar imagen al dar click en los puntos
// mostrar imagen al dar click en los puntos
document
.
getElementById
(
"myChart"
).
onclick
=
function
(
evt
)
{
document
.
getElementById
(
"myChart"
).
onclick
=
function
(
evt
)
{
var
activePoints
=
myChart
.
getElementsAtEvent
(
evt
);
$
(
"#showImage"
).
removeClass
(
'col-lg-offset-1'
);
var
firstPoint
=
activePoints
[
0
];
$
(
".next"
).
show
()
$
(
".prev"
).
show
()
activePoints
=
myChart
.
getElementsAtEvent
(
evt
);
var
activePoint
=
myChart
.
getElementAtEvent
(
evt
);
var
firstPoint
=
activePoint
[
0
];
if
(
!
firstPoint
)
return
;
if
(
!
firstPoint
)
return
;
activePoints
.
forEach
(
function
(
value
,
index
){
if
(
value
==
firstPoint
){
imageNumber
=
index
;
}
});
label
=
myChart
.
data
.
labels
[
firstPoint
.
_index
]
;
updateImage
(
firstPoint
)
;
//alert("{{ IMAGE_PATH }}"+label+"_TCI_60m.jpg");
//alert("{{ IMAGE_PATH }}"+label+"_TCI_60m.jpg");
//document.getElementById("satImage").src = "{{ IMAGE_PATH }}"+label+"_TCI_60m.jpg";
//document.getElementById("satImage").src = "{{ IMAGE_PATH }}"+label+"_TCI_60m.jpg";
document
.
getElementById
(
"satImage"
).
src
=
"../../static/reports/tmpImages/repsat_test_dev/{{IMAGE_PATH}}/"
+
label
+
"_TCI_60m.jpg"
};
};
// cambiar el tipo de gráfica
// cambiar el tipo de gráfica
function
next
(){
if
(
imageNumber
==
(
activePoints
.
length
-
1
)){
imageNumber
=
0
;
}
else
{
imageNumber
++
;
}
var
imagePoint
=
activePoints
[
imageNumber
];
if
(
!
imagePoint
)
return
;
updateImage
(
imagePoint
);
}
function
prev
()
{
if
(
imageNumber
==
0
)
{
imageNumber
=
activePoints
.
length
-
1
;
}
else
{
imageNumber
--
;
}
var
imagePoint
=
activePoints
[
imageNumber
];
if
(
!
imagePoint
)
return
;
updateImage
(
imagePoint
);
}
function
updateImage
(
imagePoint
){
label
=
myChart
.
data
.
labels
[
imagePoint
.
_index
];
datasets
=
myChart
.
data
.
datasets
[
imagePoint
.
_datasetIndex
].
label
;
document
.
getElementById
(
"titleMap"
).
innerHTML
=
label
+
" - "
+
datasets
;
document
.
getElementById
(
"satImage"
).
src
=
"../../static/reports/tmpImages/repsat_test_dev/{{IMAGE_PATH}}/"
+
label
+
"_TCI_60m.jpg"
}
function
change
(
newType
)
{
function
change
(
newType
)
{
var
ctx
=
document
.
getElementById
(
"myChart"
).
getContext
(
"2d"
);
var
ctx
=
document
.
getElementById
(
"myChart"
).
getContext
(
"2d"
);
...
...
reports/views.py
View file @
2c4ffb0c
...
@@ -67,12 +67,14 @@ def report_L2ASCL(request, report,purchase_id):
...
@@ -67,12 +67,14 @@ def report_L2ASCL(request, report,purchase_id):
data
[
'datasets'
]
.
sort
(
key
=
lambda
k
:
max
(
k
[
'data'
]))
data
[
'datasets'
]
.
sort
(
key
=
lambda
k
:
max
(
k
[
'data'
]))
graphData
[
'data'
]
=
data
graphData
[
'data'
]
=
data
defaultLabel
=
graphData
[
'data'
][
'labels'
][
0
]
defaultDataset
=
graphData
[
'data'
][
'datasets'
][
0
][
'label'
]
# print(settings.BASE_URL)
# print(settings.BASE_URL)
# graphData['options']['responsive']=True
# graphData['options']['responsive']=True
# graphData['options']['maintainAspectRatio']=False
# graphData['options']['maintainAspectRatio']=False
# print(json.dumps(graphData).encode("utf-8"))
# print(json.dumps(graphData).encode("utf-8"))
return
render
(
request
,
'L2ASCL_data.html'
,
{
"graphData"
:
json
.
dumps
(
graphData
),
"report_name"
:
report
,
"IMAGE_PATH"
:
image_path
})
return
render
(
request
,
'L2ASCL_data.html'
,
{
"graphData"
:
json
.
dumps
(
graphData
),
"report_name"
:
report
,
"IMAGE_PATH"
:
image_path
,
'dafaultLabel'
:
defaultLabel
,
'defaultDataSet'
:
defaultDataset
})
# -------------------------------------------------------------------------------def Reports(request):
# -------------------------------------------------------------------------------def Reports(request):
...
...
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