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
f8931e6d
Commit
f8931e6d
authored
Mar 29, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.geoint.mx/mario.chirinos/GeoInt_SIDT
into modificaciones
parents
8a95213e
cf3484d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
75 deletions
+58
-75
minimap.js
reports/static/reports/js/minimap.js
+12
-10
Reports.html
reports/templates/Reports.html
+1
-1
sclData.html
reports/templates/sclData.html
+28
-57
views.py
reports/views.py
+17
-7
No files found.
reports/static/reports/js/minimap.js
View file @
f8931e6d
MAPBOX_ACCESS_TOKEN
=
'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
;
// create wkt polygon
const
format
=
new
ol
.
format
.
WKT
();
const
feature
=
format
.
readFeature
(
polygon
,
{
dataProjection
:
'EPSG:4326'
,
featureProjection
:
'EPSG:3857'
});
// Create layers
const
mapbox
=
new
ol
.
layer
.
Tile
({
name
:
'mapbox'
,
...
...
@@ -8,13 +16,7 @@ const mapbox = new ol.layer.Tile({
})
});
// add wkt polygon
const
format
=
new
ol
.
format
.
WKT
();
const
feature
=
format
.
readFeature
(
polygon
,
{
dataProjection
:
'EPSG:4326'
,
featureProjection
:
'EPSG:3857'
});
var
vector
=
new
ol
.
layer
.
Vector
({
const
vector
=
new
ol
.
layer
.
Vector
({
name
:
'polygon'
,
source
:
new
ol
.
source
.
Vector
({
features
:
[
feature
]
...
...
@@ -32,6 +34,9 @@ const map = new ol.Map({
})
});
// fit to polygon
map
.
getView
().
fit
(
feature
.
getGeometry
());
// show first date and current date
let
currentDate
;
...
...
@@ -76,10 +81,7 @@ function addImageLayer(labelDate) {
map
.
addLayer
(
xyz
);
})
let
currentZoom
=
map
.
getView
().
getZoom
();
// fit and zoom
// map.getView().fit(ol.proj.transformExtent(data.boundingBox, 'EPSG:4326', 'EPSG:3857'))
map
.
getView
().
setZoom
(
currentZoom
);
map
.
getView
().
setMinZoom
(
data
.
zoom
.
min
);
map
.
getView
().
setMaxZoom
(
data
.
zoom
.
max
);
}
...
...
reports/templates/Reports.html
View file @
f8931e6d
...
...
@@ -150,7 +150,7 @@
<table
data-toggle=
"table"
id=
"example"
class=
"table table-striped table-bordered"
style=
"width:100%"
>
<thead>
<th>
Zon
e
</th>
<th>
Titl
e
</th>
<th>
Process
</th>
<th>
Purchase date
</th>
<th>
Start Date
</th>
...
...
reports/templates/sclData.html
View file @
f8931e6d
...
...
@@ -139,26 +139,24 @@
<div
class=
"row col-lg-11 title"
>
<div
class=
"box box-success box-solid info"
>
<div
class=
"box-header with-border"
>
<h3
sytle=
"font-size: 30px !important;"
>
{{ report_name }}
</h3>
<h3>
{{ searchInfo.title }} {{ searchInfo.startDate }} to {{ searchInfo.endDate}}
</h3>
<h6>
{{ searchInfo.report_name }}
</h6>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div
class=
"box-body"
>
<div
class=
"row"
>
<div
class=
"col-lg-
2 text-center col-lg-offset-1
"
>
<h4>
Platform: {{ platform }}
</h4>
<div
class=
"col-lg-
3 text-center
"
>
<h4>
Platform: {{
searchInfo.
platform }}
</h4>
</div>
<div
class=
"col-lg-
2
text-center"
>
<h4>
Product level: {{ productLevel }}
</h4>
<div
class=
"col-lg-
3
text-center"
>
<h4>
Product level: {{
searchInfo.
productLevel }}
</h4>
</div>
<div
class=
"col-lg-
2
text-center"
>
<h4>
Start date: {{ startDate
}}
</h4>
<div
class=
"col-lg-
3
text-center"
>
<h4>
Process: {{ searchInfo.process
}}
</h4>
</div>
<div
class=
"col-lg-2 text-center"
>
<h4>
End date: {{ endDate }}
</h4>
</div>
<div
class=
"col-lg-2 text-center"
>
<h4>
Clouds: {{ clouds }} %
</h4>
<div
class=
"col-lg-3 text-center"
>
<h4>
Clouds: {{ searchInfo.clouds }} %
</h4>
</div>
</div>
</div>
...
...
@@ -322,49 +320,22 @@
</script>
<!-- page script -->
<script>
var
defaultLegendClickHandler
=
Chart
.
defaults
.
global
.
legend
.
onClick
;
var
newLegendClickHandler
=
function
(
e
,
legendItem
)
{
var
legendOnClickHandler
=
function
(
e
,
legendItem
)
{
var
index
=
legendItem
.
datasetIndex
;
var
ch
=
this
.
chart
;
var
meta
=
ch
.
getDatasetMeta
(
index
);
var
layer
=
legendItem
.
text
.
toLowerCase
().
replace
(
/
\s
/g
,
'-'
);
let
checkbox_id
=
'#sclcheck-'
+
layer
;
var
activePoint
=
ch
.
getElementAtEvent
(
e
);
let
checkbox_id
=
'#sclcheck-'
+
legendItem
.
text
.
toLowerCase
().
replace
(
/
\s
/g
,
'-'
);
// isDatasetVisible return the opposite status?
// change checkbox in imagelayer
if
(
ch
.
getDatasetMeta
(
index
).
hidden
===
null
)
{
ch
.
getDatasetMeta
(
index
).
hidden
=
false
;
}
else
{
ch
.
getDatasetMeta
(
index
).
hidden
=
!
ch
.
getDatasetMeta
(
index
).
hidden
;
}
ch
.
update
();
$
(
checkbox_id
+
" :input"
).
prop
(
"checked"
,
!
ch
.
isDatasetVisible
(
index
)
);
$
(
checkbox_id
+
" :input"
).
prop
(
"checked"
,
!
ch
.
getDatasetMeta
(
index
).
hidden
);
addImageLayer
(
currentDate
);
// myChart.config.data.datasets
// myChart.getDatasetMeta(4).hidden=true
//console.log(document.getElementById("titleMap").textContent)
// var label = document.getElementById("titleMap").textContent; //obtiene la fecha que se está viendo
// label = label.replace(/\//g,''); // reemplaza los diagonales por nada
// console.log(label)
// if(meta.hidden){
// console.log("Mostrar!!!")
// SCLlayers.push(layer)
// document.getElementById("scl_"+layer).src = "../../static/reports/tmpImages/repsat_test_dev/{{ SCL_PATH }}"+label+"_SCL_60m_"+layer+".png"
// }
// else{
// console.log("Ocultar!!")
// SCLlayers.splice(SCLlayers.indexOf(layer), 1);
// document.getElementById("scl_"+layer).src = ""
// }
//if (index > 1) {
// Do the original logic
//console.log("wooooo")
//defaultLegendClickHandler(e, legendItem);
defaultLegendClickHandler
.
call
(
this
,
e
,
legendItem
);
//} else {
// console.log("holaaaa")
//}
};
var
showSCLcheckboxes
=
function
(
datasets
)
{
...
...
@@ -386,23 +357,23 @@
let
scl_path
=
"{{SCL_PATH}}"
;
let
zone
=
"{{ zone }}"
let
purchase_id
=
"{{ purchaseID }}"
let
platform
=
"{{ platform }}"
;
let
productLevel
=
"{{ productLevel }}"
;
let
startDate
=
"{{ startDate }}"
;
let
endDate
=
"{{ endDate }}"
;
let
clouds
=
"{{ clouds }}"
;
let
platform
=
"{{
searchInfo.
platform }}"
;
let
productLevel
=
"{{
searchInfo.
productLevel }}"
;
let
startDate
=
"{{ s
earchInfo.s
tartDate }}"
;
let
endDate
=
"{{
searchInfo.
endDate }}"
;
let
clouds
=
"{{
searchInfo.
clouds }}"
;
let
oldLabel
=
"{{defaultDataSet}}"
;
let
labels
=
{{
labels
}};
var
config
=
{{
graphData
}};
let
polygon
=
"{{polygon}}"
let
polygon
=
"{{
searchInfo.
polygon}}"
config
.
options
=
{
responsive
:
true
,
maintainAspectRatio
:
false
,
// scales: { xAxes: [{ stacked: true }], yAxes: [{ stacked: true }] },
legend
:
{
display
:
true
,
onClick
:
newLegend
ClickHandler
,
display
:
true
,
onClick
:
legendOn
ClickHandler
,
}
};
...
...
reports/views.py
View file @
f8931e6d
...
...
@@ -46,8 +46,9 @@ def report_L2ASCL(request, purchase_id):
template
=
"sclData.html"
reporteDir
=
'mask'
folders
=
""
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
)
.
filter
(
pk
=
purchase_id
)
email
=
purchase
[
0
][
'user__email'
]
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
,
'search__search_name'
,
'search__process_id__name'
)
.
get
(
pk
=
purchase_id
)
email
=
purchase
[
'user__email'
]
path
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/scl_data.json"
...
...
@@ -68,16 +69,25 @@ def report_L2ASCL(request, purchase_id):
else
:
PDFGenerator
(
request
,
path
,
reporteDir
,
datasets
)
searchInfo
=
{
"title"
:
purchase
[
'search__search_name'
],
"process"
:
purchase
[
'search__process_id__name'
],
"startDate"
:
startDate
,
"endDate"
:
endDate
,
"clouds"
:
dataProduct
[
'clouds'
],
"platform"
:
dataProduct
[
'platform'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"polygon"
:
dataProduct
[
'wkt'
],
"report_name"
:
"SCL Image Classification Data(Km²)"
}
return
render
(
request
,
template
,
{
"graphData"
:
json
.
dumps
(
graphData
),
"report_name"
:
"SCL Image Classification Data(Km²)"
,
"startDate"
:
startDate
,
"endDate"
:
endDate
,
"clouds"
:
dataProduct
[
'clouds'
],
"platform"
:
dataProduct
[
'platform'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"IMAGE_PATH"
:
image_path
,
"searchInfo"
:
searchInfo
,
"IMAGE_PATH"
:
image_path
,
"SCL_PATH"
:
SCL_path
,
'dafaultLabel'
:
defaultLabel
,
'defaultDataSet'
:
defaultDataset
,
"folders"
:
folders
,
"zone"
:
reporteDir
,
"purchaseID"
:
purchase_id
,
"labels"
:
graphData
[
'data'
][
'labels'
],
"
polygon"
:
dataProduct
[
'wkt'
],
"
email"
:
email
})
"email"
:
email
})
# -------------------------------------------------------------------------------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