Commit f8931e6d authored by Ulises Morales Ramírez's avatar Ulises Morales Ramírez

Merge branch 'dev' of http://gitlab.geoint.mx/mario.chirinos/GeoInt_SIDT into modificaciones

parents 8a95213e cf3484d5
MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'; 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 // Create layers
const mapbox = new ol.layer.Tile({ const mapbox = new ol.layer.Tile({
name: 'mapbox', name: 'mapbox',
...@@ -8,13 +16,7 @@ const mapbox = new ol.layer.Tile({ ...@@ -8,13 +16,7 @@ const mapbox = new ol.layer.Tile({
}) })
}); });
// add wkt polygon const vector = new ol.layer.Vector({
const format = new ol.format.WKT();
const feature = format.readFeature(polygon, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
var vector = new ol.layer.Vector({
name: 'polygon', name: 'polygon',
source: new ol.source.Vector({ source: new ol.source.Vector({
features: [feature] features: [feature]
...@@ -32,6 +34,9 @@ const map = new ol.Map({ ...@@ -32,6 +34,9 @@ const map = new ol.Map({
}) })
}); });
// fit to polygon
map.getView().fit(feature.getGeometry());
// show first date and current date // show first date and current date
let currentDate; let currentDate;
...@@ -76,10 +81,7 @@ function addImageLayer(labelDate) { ...@@ -76,10 +81,7 @@ function addImageLayer(labelDate) {
map.addLayer(xyz); map.addLayer(xyz);
}) })
let currentZoom = map.getView().getZoom();
// fit and zoom // 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().setMinZoom(data.zoom.min);
map.getView().setMaxZoom(data.zoom.max); map.getView().setMaxZoom(data.zoom.max);
} }
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<table data-toggle="table" id="example" class="table table-striped table-bordered" <table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%"> style="width:100%">
<thead> <thead>
<th>Zone</th> <th>Title</th>
<th>Process</th> <th>Process</th>
<th>Purchase date</th> <th>Purchase date</th>
<th>Start Date</th> <th>Start Date</th>
......
...@@ -139,26 +139,24 @@ ...@@ -139,26 +139,24 @@
<div class="row col-lg-11 title"> <div class="row col-lg-11 title">
<div class="box box-success box-solid info"> <div class="box box-success box-solid info">
<div class="box-header with-border"> <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 --> <!-- /.box-tools -->
</div> </div>
<!-- /.box-header --> <!-- /.box-header -->
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<div class="col-lg-2 text-center col-lg-offset-1"> <div class="col-lg-3 text-center">
<h4>Platform: {{ platform }}</h4> <h4>Platform: {{ searchInfo.platform }}</h4>
</div> </div>
<div class="col-lg-2 text-center"> <div class="col-lg-3 text-center">
<h4>Product level: {{ productLevel }}</h4> <h4>Product level: {{ searchInfo.productLevel }}</h4>
</div> </div>
<div class="col-lg-2 text-center"> <div class="col-lg-3 text-center">
<h4>Start date: {{ startDate }}</h4> <h4>Process: {{ searchInfo.process }}</h4>
</div> </div>
<div class="col-lg-2 text-center"> <div class="col-lg-3 text-center">
<h4>End date: {{ endDate }}</h4> <h4>Clouds: {{ searchInfo.clouds }} %</h4>
</div>
<div class="col-lg-2 text-center">
<h4>Clouds: {{ clouds }} %</h4>
</div> </div>
</div> </div>
</div> </div>
...@@ -322,49 +320,22 @@ ...@@ -322,49 +320,22 @@
</script> </script>
<!-- page script --> <!-- page script -->
<script> <script>
var defaultLegendClickHandler = Chart.defaults.global.legend.onClick; var legendOnClickHandler = function (e, legendItem) {
var newLegendClickHandler = function (e, legendItem) {
var index = legendItem.datasetIndex; var index = legendItem.datasetIndex;
var ch = this.chart; var ch = this.chart;
var meta = ch.getDatasetMeta(index); let checkbox_id = '#sclcheck-'+legendItem.text.toLowerCase().replace(/\s/g, '-');
var layer = legendItem.text.toLowerCase().replace(/\s/g, '-');
let checkbox_id = '#sclcheck-'+layer;
var activePoint = ch.getElementAtEvent(e);
// isDatasetVisible return the opposite status? // 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); 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) { var showSCLcheckboxes = function(datasets) {
...@@ -386,23 +357,23 @@ ...@@ -386,23 +357,23 @@
let scl_path = "{{SCL_PATH}}"; let scl_path = "{{SCL_PATH}}";
let zone = "{{ zone }}" let zone = "{{ zone }}"
let purchase_id = "{{ purchaseID }}" let purchase_id = "{{ purchaseID }}"
let platform = "{{ platform }}"; let platform = "{{ searchInfo.platform }}";
let productLevel = "{{ productLevel }}"; let productLevel = "{{ searchInfo.productLevel }}";
let startDate = "{{ startDate }}"; let startDate = "{{ searchInfo.startDate }}";
let endDate = "{{ endDate }}"; let endDate = "{{ searchInfo.endDate }}";
let clouds = "{{ clouds }}"; let clouds = "{{ searchInfo.clouds }}";
let oldLabel = "{{defaultDataSet}}"; let oldLabel = "{{defaultDataSet}}";
let labels = {{labels}}; let labels = {{labels}};
var config = {{graphData}}; var config = {{graphData}};
let polygon = "{{polygon}}" let polygon = "{{searchInfo.polygon}}"
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 }] },
legend: { legend: {
display: true, display: true,
onClick: newLegendClickHandler, onClick: legendOnClickHandler,
} }
}; };
......
...@@ -46,8 +46,9 @@ def report_L2ASCL(request, purchase_id): ...@@ -46,8 +46,9 @@ def report_L2ASCL(request, purchase_id):
template = "sclData.html" template = "sclData.html"
reporteDir = 'mask' reporteDir = 'mask'
folders = "" folders = ""
purchase = Purchase.objects.values('user__email', 'is_public').filter(pk=purchase_id) purchase = Purchase.objects.values('user__email', 'is_public', 'search__search_name',
email = purchase[0]['user__email'] 'search__process_id__name').get(pk=purchase_id)
email = purchase['user__email']
path = USERS_PATH + email + '/' + purchase_id + '/' path = USERS_PATH + email + '/' + purchase_id + '/'
scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json" scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json"
...@@ -68,16 +69,25 @@ def report_L2ASCL(request, purchase_id): ...@@ -68,16 +69,25 @@ def report_L2ASCL(request, purchase_id):
else: else:
PDFGenerator(request, path, reporteDir, datasets) 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), return render(request, template, {"graphData": json.dumps(graphData),
"report_name": "SCL Image Classification Data(Km²)", "searchInfo": searchInfo, "IMAGE_PATH": image_path,
"startDate": startDate, "endDate": endDate,
"clouds": dataProduct['clouds'], "platform": dataProduct['platform'],
"productLevel": dataProduct['productLevel'], "IMAGE_PATH": image_path,
"SCL_PATH": SCL_path, 'dafaultLabel': defaultLabel, "SCL_PATH": SCL_path, 'dafaultLabel': defaultLabel,
'defaultDataSet': defaultDataset, "folders": folders, 'defaultDataSet': defaultDataset, "folders": folders,
"zone": reporteDir, "purchaseID": purchase_id, "zone": reporteDir, "purchaseID": purchase_id,
"labels": graphData['data']['labels'], "labels": graphData['data']['labels'],
"polygon": dataProduct['wkt'], "email": email}) "email": email})
# -------------------------------------------------------------------------------def Reports(request): # -------------------------------------------------------------------------------def Reports(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment