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
09f9f798
Commit
09f9f798
authored
Mar 20, 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 graph
parents
b6db372e
900e7c34
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
30 deletions
+114
-30
minimap.js
reports/static/reports/js/minimap.js
+58
-24
reportImg.js
reports/static/reports/js/reportImg.js
+0
-2
aside.html
reports/templates/aside.html
+25
-0
sclData.html
reports/templates/sclData.html
+27
-0
urls.py
reports/urls.py
+1
-1
views.py
reports/views.py
+3
-3
No files found.
reports/static/reports/js/minimap.js
View file @
09f9f798
// set defaults http://localhost:8000/reports/tiles/2z68/T14QMG/20190127/10/230/569.png
MAPBOX_ACCESS_TOKEN
=
'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
;
MAPBOX_ACCESS_TOKEN
=
'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
;
// Create layers
// Create layers
var
imagelayer
;
const
mapbox
=
new
ol
.
layer
.
Tile
({
var
mapbox
=
new
ol
.
layer
.
Tile
({
name
:
'mapbox'
,
source
:
new
ol
.
source
.
XYZ
({
source
:
new
ol
.
source
.
XYZ
({
url
:
'https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token='
+
MAPBOX_ACCESS_TOKEN
url
:
'https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token='
+
MAPBOX_ACCESS_TOKEN
})
})
});
});
// create map
// create map
var
map
=
new
ol
.
Map
({
const
map
=
new
ol
.
Map
({
target
:
'minimap'
,
target
:
'minimap'
,
layers
:
[
mapbox
],
layers
:
[
mapbox
],
view
:
new
ol
.
View
({
view
:
new
ol
.
View
({
...
@@ -20,11 +19,15 @@ var map = new ol.Map({
...
@@ -20,11 +19,15 @@ var map = new ol.Map({
})
})
});
});
// show first date and current date
let
currentDate
;
if
(
labels
&&
labels
.
length
>
0
)
{
if
(
labels
&&
labels
.
length
>
0
)
{
addImageLayer
(
labels
[
0
])
currentDate
=
labels
[
0
];
addImageLayer
(
currentDate
)
}
}
//addLayer
function
addImageLayer
(
labelDate
)
{
function
addImageLayer
(
labelDate
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
...
@@ -32,26 +35,57 @@ function addImageLayer(labelDate) {
...
@@ -32,26 +35,57 @@ function addImageLayer(labelDate) {
data
:
{
'purchase_id'
:
purchase_id
,
'report'
:
zone
,
'date'
:
labelDate
},
data
:
{
'purchase_id'
:
purchase_id
,
'report'
:
zone
,
'date'
:
labelDate
},
url
:
'/reports/tiles/tileinfo'
,
url
:
'/reports/tiles/tileinfo'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
map
.
removeLayer
(
imagelayer
)
const
layer_types
=
getSelectedCheckbox
();
currentDate
=
labelDate
;
var
xyz
=
new
ol
.
layer
.
Tile
({
removeImageLayers
()
// add layer
layer_types
.
forEach
(
layer_type
=>
{
const
xyz
=
new
ol
.
layer
.
Tile
({
opacity
:
1
,
opacity
:
1
,
name
:
layer_type
,
source
:
new
ol
.
source
.
XYZ
({
source
:
new
ol
.
source
.
XYZ
({
projection
:
'EPSG:3857'
,
projection
:
'EPSG:3857'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zon
e
+
'/'
+
labelDate
+
'/{z}/{x}/{-y}.png'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layer_typ
e
+
'/'
+
labelDate
+
'/{z}/{x}/{-y}.png'
,
tilePixelRatio
:
2
,
tilePixelRatio
:
2
,
minZoom
:
data
.
zoom
.
min
,
minZoom
:
data
.
zoom
.
min
,
maxZoom
:
data
.
zoom
.
max
maxZoom
:
data
.
zoom
.
max
})
})
});
});
imagelayer
=
xyz
;
map
.
addLayer
(
xyz
);
map
.
addLayer
(
xyz
);
})
var
extent
=
ol
.
proj
.
transformExtent
(
data
.
boundingBox
,
'EPSG:4326'
,
'EPSG:3857'
);
// fit and zoom
map
.
getView
().
fit
(
extent
,
{
duration
:
800
})
map
.
getView
().
fit
(
ol
.
proj
.
transformExtent
(
data
.
boundingBox
,
'EPSG:4326'
,
'EPSG:3857'
)
,
{
duration
:
800
})
map
.
getView
().
setMinZoom
(
data
.
zoom
.
min
);
map
.
getView
().
setMinZoom
(
data
.
zoom
.
min
);
map
.
getView
().
setMaxZoom
(
data
.
zoom
.
max
);
map
.
getView
().
setMaxZoom
(
data
.
zoom
.
max
);
}
}
});
});
}
}
function
removeImageLayers
()
{
var
imageLayers
=
map
.
getLayers
().
getArray
().
slice
();
imageLayers
.
forEach
(
layer
=>
{
if
(
layer
.
get
(
'name'
)
!=
'mapbox'
)
{
map
.
removeLayer
(
layer
)
}
})
}
function
getSelectedCheckbox
()
{
const
inputs
=
$
(
"input[name=layer_type]:checked"
);
let
values
=
[]
Object
.
keys
(
inputs
).
forEach
(
key
=>
{
let
value
=
inputs
[
key
].
value
;
if
(
value
)
{
values
.
push
(
value
)}
})
return
values
;
}
$
(
"input[name=layer_type]"
).
on
(
"click"
,
()
=>
{
addImageLayer
(
currentDate
);
});
reports/static/reports/js/reportImg.js
View file @
09f9f798
...
@@ -34,8 +34,6 @@ document.getElementById("myChart").onclick = function (evt) {
...
@@ -34,8 +34,6 @@ document.getElementById("myChart").onclick = function (evt) {
//console.log(firstPoint._datasetIndex) //indice de la clase a la que pertenece (vegetación, agua, etc.)
//console.log(firstPoint._datasetIndex) //indice de la clase a la que pertenece (vegetación, agua, etc.)
var
label
=
myChart
.
data
.
labels
[
firstPoint
.
_index
];
var
label
=
myChart
.
data
.
labels
[
firstPoint
.
_index
];
addImageLayer
(
label
)
addImageLayer
(
label
)
console
.
log
(
"label: "
)
console
.
log
(
label
)
//console.log(myChart.legend.legendItems[firstPoint._datasetIndex].text) //nombre de la capa a la que pertenece (vegetación, agua, etc.)
//console.log(myChart.legend.legendItems[firstPoint._datasetIndex].text) //nombre de la capa a la que pertenece (vegetación, agua, etc.)
//if (!firstPoint) return;
//if (!firstPoint) return;
activePoints
.
forEach
(
function
(
value
,
index
)
{
activePoints
.
forEach
(
function
(
value
,
index
)
{
...
...
reports/templates/aside.html
View file @
09f9f798
...
@@ -159,6 +159,31 @@
...
@@ -159,6 +159,31 @@
</li>
</li>
</ul>
</ul>
</li>
</li>
<li
class=
"treeview"
>
<a
href=
"#"
>
<i
class=
"fa fa-map"
></i>
<span>
Image Layers
</span>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
</a>
<ul
class=
"treeview-menu sidebar-form text-center"
>
<span>
<div
class=
"form-check"
>
<input
class=
"form-check-input"
type=
"checkbox"
name=
"layer_type"
value=
"TCI"
id=
"tcicheck"
checked
>
<label
class=
"form-check-label"
for=
"tcicheck"
>
TCI
</label>
</div>
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox" name="layer_type" value="SCL" id="sclcheck">
<label class="form-check-label" for="sclcheck">
SCL
</label>
</div> -->
</span>
</ul>
</li>
<li>
<li>
<a
class=
"treeview "
href=
"#"
onclick=
"window.history.back();"
>
<a
class=
"treeview "
href=
"#"
onclick=
"window.history.back();"
>
<i
class=
"fa fa-backward"
></i>
<i
class=
"fa fa-backward"
></i>
...
...
reports/templates/sclData.html
View file @
09f9f798
...
@@ -172,6 +172,33 @@
...
@@ -172,6 +172,33 @@
</div>
</div>
</div>
</div>
<!-- <div class="col-md-2 info">
<div class="box box-success">
<div class="box-body with-border">
<div class="text center">
<h5>Image Layers</h5>
</div>
<div >
<div class="form-check">
<input class="form-check-input" type="radio" name="layerRadios" id="tciradio" value="tci" checked>
<label class="form-check-label" for="tciradio">
TCI
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="layerRadios" id="sclradio" value="scl">
<label class="form-check-label" for="sclradio">
SCL
</label>
</div>
</div>
<div>
<button type="button" class="btn btn-outline-secondary">Remove Layer</button>
</div>
</div>
</div>
</div> -->
<div
class=
"col-md-6 draggable"
id=
"draggableChart"
>
<div
class=
"col-md-6 draggable"
id=
"draggableChart"
>
<!-- AREA CHART -->
<!-- AREA CHART -->
<div
class=
"box box-primary"
>
<div
class=
"box box-primary"
>
...
...
reports/urls.py
View file @
09f9f798
...
@@ -7,7 +7,7 @@ urlpatterns = [
...
@@ -7,7 +7,7 @@ urlpatterns = [
url
(
r'^(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^$'
,
views
.
Reports
,
name
=
'reports'
),
url
(
r'^$'
,
views
.
Reports
,
name
=
'reports'
),
url
(
r'^ws/process_progress$'
,
views
.
wsProcessProgress
,
name
=
'wsProcessProgress'
),
url
(
r'^ws/process_progress$'
,
views
.
wsProcessProgress
,
name
=
'wsProcessProgress'
),
url
(
r'^tiles/(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)/(?P<date>[0-9]+)/(?P<z>[0-9]+)/(?P<x>[0-9]+)/(?P<y>[0-9]+).png$'
,
url
(
r'^tiles/(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)/(?P<
layer_type>[\w\-]+)/(?P<
date>[0-9]+)/(?P<z>[0-9]+)/(?P<x>[0-9]+)/(?P<y>[0-9]+).png$'
,
views
.
tiles
,
name
=
'tile'
),
views
.
tiles
,
name
=
'tile'
),
url
(
r'^tiles/tileinfo$'
,
views
.
tileinfo
,
name
=
'tileinfo'
),
url
(
r'^tiles/tileinfo$'
,
views
.
tileinfo
,
name
=
'tileinfo'
),
]
]
reports/views.py
View file @
09f9f798
...
@@ -264,9 +264,9 @@ def wsProcessProgress(request):
...
@@ -264,9 +264,9 @@ def wsProcessProgress(request):
raise
Http404
raise
Http404
# tiles
# tiles
def
tiles
(
request
,
purchase_id
,
report
,
date
,
z
,
x
,
y
):
def
tiles
(
request
,
purchase_id
,
report
,
layer_type
,
date
,
z
,
x
,
y
):
image_path
=
"{}{}/{}/out/{}/
TCI
/tiles/{}_TCI_60m/{}/{}/{}.png"
.
format
(
image_path
=
"{}{}/{}/out/{}/
{}
/tiles/{}_TCI_60m/{}/{}/{}.png"
.
format
(
USERS_PATH
,
request
.
user
.
email
,
purchase_id
,
report
,
date
,
z
,
x
,
y
USERS_PATH
,
request
.
user
.
email
,
purchase_id
,
report
,
layer_type
,
date
,
z
,
x
,
y
)
)
if
not
os
.
path
.
exists
(
image_path
):
if
not
os
.
path
.
exists
(
image_path
):
...
...
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