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
0b05b628
Commit
0b05b628
authored
Feb 05, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reportes, primera etapa
parent
fc0e7818
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1156 additions
and
660 deletions
+1156
-660
Chart.min.js
catalog/static/catalog/js/Chart.min.js
+10
-0
L2ASCL_data (copy).html
catalog/templates/L2ASCL_data (copy).html
+184
-176
base_top.html
catalog/templates/base_top.html
+145
-130
map.html
catalog/templates/map.html
+254
-211
urls.py
catalog/urls.py
+0
-1
views.py
catalog/views.py
+5
-5
db.sqlite3
db.sqlite3
+0
-0
geosentinel
geosentinel
+1
-1
L2ASCL_data.html
reports/templates/L2ASCL_data.html
+507
-99
urls.py
reports/urls.py
+2
-4
views.py
reports/views.py
+48
-33
No files found.
catalog/static/catalog/js/Chart.min.js
0 → 100644
View file @
0b05b628
This source diff could not be displayed because it is too large. You can
view the blob
instead.
catalog/templates/L2ASCL_data (copy).html
View file @
0b05b628
{% extends "data_top.html" %}
{% load static %}
{% block content %}
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
<!-- Content Wrapper. Contains page content -->
...
...
@@ -18,9 +17,11 @@
<h3
class=
"box-title"
>
Area Km²
</h3>
<div
class=
"box-tools pull-right"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
class=
"fa fa-minus"
></i>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
class=
"fa fa-minus"
></i>
</button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
</div>
</div>
<div
class=
"box-body"
>
...
...
@@ -38,9 +39,11 @@
<h3
class=
"box-title"
>
Donut Chart
</h3>
<div
class=
"box-tools pull-right"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
class=
"fa fa-minus"
></i>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
class=
"fa fa-minus"
></i>
</button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
</div>
</div>
<div
class=
"box-body"
>
...
...
@@ -62,9 +65,11 @@
<h3
class=
"box-title"
>
Bar Chart
</h3>
<div
class=
"box-tools pull-right"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
class=
"fa fa-minus"
></i>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
><i
class=
"fa fa-minus"
></i>
</button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
</div>
</div>
<div
class=
"box-body"
>
...
...
@@ -75,14 +80,16 @@
<!-- /.box-body -->
</div>
<!-- /.box -->
<div
class=
"box box-info"
>
<div
class=
"box box-info"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
MAP
</h3>
<div
class=
"box-tools pull-right"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapsexite"
><i
class=
"fa fa-minus"
></i>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapsexite"
><i
class=
"fa fa-minus"
></i>
</button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"remove"
><i
class=
"fa fa-times"
></i></button>
</div>
</div>
<div
class=
"box-body"
>
...
...
@@ -114,11 +121,11 @@
{% endblock %}
{% block scripts %}
<!-- page script -->
<script>
var
ctx
=
document
.
getElementById
(
"areaChart"
).
getContext
(
'2d'
);
var
myChart
=
new
Chart
(
ctx
,
{
type
:
'l
ine'
,
<!-- page script -->
<script>
var
ctx
=
document
.
getElementById
(
"areaChart"
).
getContext
(
'2d'
);
var
myChart
=
new
Chart
(
ctx
,
{
type
:
'L
ine'
,
data
:
{
labels
:
[{{
labels
}}],
datasets
:
[{
...
...
@@ -170,20 +177,21 @@ var myChart = new Chart(ctx, {
scales
:
{
yAxes
:
[{
ticks
:
{
beginAtZero
:
true
beginAtZero
:
true
}
}]
}
}
});
function
areaChartonClick
(
e
,
element
){
console
.
log
(
e
);
console
.
log
(
element
);
console
.
log
(
element
[
0
].
_index
);
console
.
log
(
myChart
);
console
.
log
(
myChart
.
config
.
data
.
labels
[
element
[
0
].
_index
]);
document
.
getElementById
(
"satImage"
).
src
=
"../../static/tmpImages/"
+
myChart
.
config
.
data
.
labels
[
element
[
0
].
_index
]
+
"_TCI_60m.jpg"
};
</script>
});
function
areaChartonClick
(
e
,
element
)
{
console
.
log
(
e
);
console
.
log
(
element
);
console
.
log
(
element
[
0
].
_index
);
console
.
log
(
myChart
);
console
.
log
(
myChart
.
config
.
data
.
labels
[
element
[
0
].
_index
]);
document
.
getElementById
(
"satImage"
).
src
=
"../../static/tmpImages/"
+
myChart
.
config
.
data
.
labels
[
element
[
0
].
_index
]
+
"_TCI_60m.jpg"
};
</script>
{% endblock %}
catalog/templates/base_top.html
View file @
0b05b628
<!DOCTYPE html>
{% load static %}
<html>
<head>
<head>
<title>
Repositorio de Imágenes Satelitales
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<meta
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
name=
"viewport"
>
<link
rel=
"icon"
href=
"{% static 'catalog/images/satellite.png' %}"
>
<!-- Bootstrap 3.3.7 -->
<link
rel=
"stylesheet"
href=
"{% static 'catalog/adminlte/bower_components/bootstrap/dist/css/bootstrap.min.css' %}"
>
<!-- Font Awesome -->
<link
rel=
"stylesheet"
href=
"{% static 'catalog/adminlte/bower_components/font-awesome/css/font-awesome.min.css' %}"
>
<link
rel=
"stylesheet"
href=
"https://use.fontawesome.com/releases/v5.0.13/css/all.css"
integrity=
"sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/adminlte/bower_components/font-awesome/css/font-awesome.min.css' %}"
>
<link
rel=
"stylesheet"
href=
"https://use.fontawesome.com/releases/v5.0.13/css/all.css"
integrity=
"sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
crossorigin=
"anonymous"
>
<!-- Theme style -->
<link
rel=
"stylesheet"
href=
"{% static 'catalog/adminlte/dist/css/AdminLTE.css' %}"
>
<!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
<link
rel=
"stylesheet"
href=
"{% static 'catalog/adminlte/dist/css/skins/_all-skins.css' %}"
>
<!-- Select2 -->
<link
rel=
"stylesheet"
href=
"{% static 'catalog/adminlte/bower_components/select2/dist/css/select2.min.css' %}"
>
<!-- jsPDF -->
<script
src=
'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.debug.js'
></script>
{% block headMedia %}{% endblock %}
</head>
<body
class=
"hold-transition skin-yellow sidebar-mini"
>
<!-- <div id="map" class="map" tabindex="0"> </div>-->
<!-- <iframe id="catalogFrame" name="catalogFrame">my frame</iframe>-->
</head>
<body
class=
"hold-transition skin-yellow sidebar-mini"
>
<!-- <div id="map" class="map" tabindex="0"> </div>-->
<!-- <iframe id="catalogFrame" name="catalogFrame">my frame</iframe>-->
<div
class=
"wrmapper"
>
<div
class=
"wrmapper"
>
<header
class=
"main-header"
>
<!-- Logo -->
<a
class=
"logo"
>
...
...
@@ -38,7 +43,6 @@
<a
href=
"#"
class=
"sidebar-toggle"
data-toggle=
"push-menu"
role=
"button"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
</a>
<div
class=
"navbar-custom-menu"
>
<ul
class=
"nav navbar-nav"
>
<!-- Messages: style can be found in dropdown.less-->
...
...
@@ -53,13 +57,20 @@
<!-- <li class="dropdown tasks-menu"> -->
{#% block tasks %}{% endblock %#}
<!-- </li> -->
<!-- History -->
<li
class=
"dropdown user user-menu"
>
{% block history %}
{% endblock %}
</li>
<!-- History -->
<!-- User Account: style can be found in dropdown.less -->
<li
class=
"dropdown user user-menu"
>
{% block user %}{% endblock %}
</li>
<!-- Control Sidebar Toggle Button -->
<li>
<a
id=
"product-list-toggle"
href=
"#"
data-toggle=
"control-sidebar"
><i
class=
"fa fa-shopping-cart"
></i></a>
<a
id=
"product-list-toggle"
href=
"#"
data-toggle=
"control-sidebar"
><i
class=
"fa fa-shopping-cart"
></i></a>
</li>
</ul>
</div>
...
...
@@ -75,6 +86,7 @@
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div
class=
"content-wrapper"
style=
"border:0px solid blue;"
>
{% block content %}{% endblock %}
...
...
@@ -92,7 +104,8 @@
<!-- Create the tabs -->
<ul
class=
"nav nav-tabs nav-justified control-sidebar-tabs"
>
<li
id=
"globe"
><a
href=
"#control-sidebar-home-tab"
data-toggle=
"tab"
><i
class=
"fa fa-globe"
></i></a></li>
<li
id=
"cart"
><a
href=
"#control-sidebar-settings-tab"
data-toggle=
"tab"
><i
class=
"fa fa-shopping-cart"
></i></a></li>
<li
id=
"cart"
><a
href=
"#control-sidebar-settings-tab"
data-toggle=
"tab"
><i
class=
"fa fa-shopping-cart"
></i></a>
</li>
</ul>
<!-- Tab panes -->
<div
class=
"tab-content"
>
...
...
@@ -143,28 +156,30 @@
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed immediately after the control sidebar -->
<div
class=
"control-sidebar-bg"
></div>
</div>
<!-- ./wrapper -->
</div>
<!-- ./wrapper -->
<!-- T E M P L A T E S -->
{% block templates %}{% endblock %}
<!-- T E M P L A T E S -->
<!-- MODAL 1 -->
{% block modal1 %}{% endblock %}
<!-- MODAL 1 -->
<!-- T E M P L A T E S -->
{% block templates %}{% endblock %}
<!-- T E M P L A T E S -->
<!-- MODAL 1 -->
{% block modal1 %}{% endblock %}
<!-- MODAL 1 -->
<!-- jQuery 3 -->
<script
src=
"{% static 'catalog/adminlte/bower_components/jquery/dist/jquery.min.js' %}"
></script>
<!-- jQuery UI 1.11.4 -->
<script
src=
"{% static 'catalog/adminlte/bower_components/jquery-ui/jquery-ui.min.js' %}"
></script>
<!-- Bootstrap 3.3.7 -->
<script
src=
"{% static 'catalog/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"
></script>
<!-- AdminLTE App -->
<script
src=
"{% static 'catalog/adminlte/dist/js/adminlte.min.js' %}"
></script>
<!-- Data management file -->
<script
src=
"{% static 'catalog/js/dataRetrieval.js' %}"
type=
"text/javascript"
></script>
<!-- jQuery 3 -->
<script
src=
"{% static 'catalog/adminlte/bower_components/jquery/dist/jquery.min.js' %}"
></script>
<!-- jQuery UI 1.11.4 -->
<script
src=
"{% static 'catalog/adminlte/bower_components/jquery-ui/jquery-ui.min.js' %}"
></script>
<!-- Bootstrap 3.3.7 -->
<script
src=
"{% static 'catalog/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"
></script>
<!-- AdminLTE App -->
<script
src=
"{% static 'catalog/adminlte/dist/js/adminlte.min.js' %}"
></script>
<!-- Data management file -->
<script
src=
"{% static 'catalog/js/dataRetrieval.js' %}"
type=
"text/javascript"
></script>
<!-- Chartsjs -->
<script
src=
"{% static 'catalog/js/Chart.min.js' %}"
type=
"text/javascript"
></script>
{% block scripts %}{% endblock %}
</body>
{% block scripts %}{% endblock %}
</body>
</html>
catalog/templates/map.html
View file @
0b05b628
...
...
@@ -2,19 +2,19 @@
{% load staticfiles %}
{% block headMedia %}
<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/modal1.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=
"{% 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/modal1.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"
>
<script
src=
"https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"
></script>
<!-- <script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>-->
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
<!-- <script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>-->
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
<script
src=
"{% static 'catalog/js/openLayers4.js'
%}"
></script>
<script
src=
"{% static 'catalog/js/sidtMap.js'
%}"
></script>
<script
src=
"{% static 'catalog/js/openLayers4.js'
%}"
></script>
<script
src=
"{% static 'catalog/js/sidtMap.js'
%}"
></script>
{% endblock %}
{% block messages %}
...
...
@@ -98,7 +98,8 @@
<small
class=
"pull-right"
>
20%
</small>
</h3>
<div
class=
"progress xs"
>
<div
class=
"progress-bar progress-bar-aqua"
style=
"width: 20%"
role=
"progressbar"
aria-valuenow=
"20"
aria-valuemin=
"0"
aria-valuemax=
"100"
>
<div
class=
"progress-bar progress-bar-aqua"
style=
"width: 20%"
role=
"progressbar"
aria-valuenow=
"20"
aria-valuemin=
"0"
aria-valuemax=
"100"
>
<span
class=
"sr-only"
>
20% Complete
</span>
</div>
</div>
...
...
@@ -118,7 +119,7 @@
<!-- search form -->
<form
role=
"form"
action=
"#"
method=
"get"
class=
"sidebar-form"
>
<div
class=
"input-group"
>
<input
type=
"text"
id=
"ajax-input"
name=
"value"
autocomplete=
"off
"
class=
"form-control"
placeholder=
"Search region..."
>
<input
type=
"text"
id=
"ajax-input"
name=
"value
"
class=
"form-control"
placeholder=
"Search region..."
>
<span
class=
"input-group-btn"
>
<button
type=
"button"
name=
"search"
id=
"search-btn"
class=
"btn btn-flat"
onclick=
"erase_input()"
>
<i
class=
"fa fa-eraser"
></i>
...
...
@@ -146,7 +147,7 @@
</span>
</a>
<ul
class=
"treeview-menu sidebar-form"
>
<li
class=
"col-xs-12"
>
{{searchForm.platform
}}
</li>
<li
class=
"col-xs-12"
>
{{ searchForm.platform
}}
</li>
</ul>
</li>
<li
class=
"treeview"
>
...
...
@@ -158,8 +159,8 @@
</span>
</a>
<ul
class=
"treeview-menu sidebar-form"
>
<li>
{{searchForm.start
}}
</li>
<li>
{{searchForm.end
}}
</li>
<li>
{{ searchForm.start
}}
</li>
<li>
{{ searchForm.end
}}
</li>
</ul>
</li>
<li
class=
"treeview "
>
...
...
@@ -171,7 +172,7 @@
</span>
</a>
<ul
class=
"treeview-menu sidebar-form"
>
<li>
{{searchForm.polygon
}}
</li>
<li>
{{ searchForm.polygon
}}
</li>
</ul>
</li>
<li
class=
"treeview "
>
...
...
@@ -230,17 +231,59 @@
<a
href=
"#"
class=
"btn btn-default btn-flat"
>
Profile
</a>
</div>
<div
class=
"pull-right"
>
<a
href=
"{% url 'logout'%}?next={{request.path
}}"
class=
"btn btn-default btn-flat"
>
Sign out
</a>
<a
href=
"{% url 'logout' %}?next={{ request.path
}}"
class=
"btn btn-default btn-flat"
>
Sign out
</a>
</div>
</li>
</ul>
{% endblock %}
{% block history %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-history"
></i>
</a>
<ul
class=
"dropdown-menu"
>
<!-- User image -->
<li
class=
"user-header"
>
<p>
Historial de compras
</p>
</li>
<div
class=
"form-group"
>
<br>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<!-- History element -->
<li>
<a
class=
"treeview "
href=
"../reports/T15QZD_sclData"
>
<i
class=
"fa fa-line-chart"
></i>
<span>
Report #
</span>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
</a>
</li>
<!-- End History element -->
<!-- History element -->
<li>
<a
class=
"treeview "
href=
"../reports/T16QBJ_sclData"
>
<i
class=
"fa fa-line-chart"
></i>
<span>
Report #
</span>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
</a>
</li>
<!-- End History element -->
</ul>
</div>
</ul>
{% endblock %}
{% block content %}
<div
id=
"map"
class=
"map"
tabindex=
"0"
>
</div>
<div
id=
"map"
class=
"map"
tabindex=
"0"
>
</div>
<footer
class=
"my-footer"
>
<strong>
<a
href=
"http://www.centrogeo.org.mx/"
>
© 2018 Centro de Investigación en Ciencias de Información Geoespacial
</a>
<a
href=
"http://www.centrogeo.org.mx/"
>
© 2018 Centro de Investigación en Ciencias de Información
Geoespacial
</a>
</strong>
</footer>
{% endblock %}
...
...
@@ -251,7 +294,7 @@
{% block scripts %}
<script>
//var osmap = new OpenStreetMapsClass("map", -99.145556,19.419444, 10);
var
osmap
=
new
sidtMap
(
"map"
,
-
89.63873079999999
,
21.0404457
,
7
);
var
osmap
=
new
sidtMap
(
"map"
,
-
89.63873079999999
,
21.0404457
,
7
);
osmap
.
geolocation
();
osmap
.
addInteraction
();
...
...
catalog/urls.py
View file @
0b05b628
...
...
@@ -12,5 +12,4 @@ urlpatterns = [
url
(
r'^cartrequest/$'
,
views
.
saveInCart
,
name
=
'cart-rqst'
),
url
(
r'^fromcartrqst/$'
,
views
.
getFromCart
,
name
=
'from-cart-rqst'
),
url
(
r'^purchcartrqst/$'
,
views
.
purchaseProduct
,
name
=
'purch-prod-rqst'
),
url
(
r'^scl/$'
,
views
.
L2ASCL_data
,
name
=
'L2ASCL-data'
)
]
catalog/views.py
View file @
0b05b628
...
...
@@ -267,11 +267,11 @@ def purchaseProduct(request):
## TODO: Add product L1C to Cart DB after product download. ##
#-------------------------------------------------------------------------------
def
L2ASCL_data
(
request
):
with
open
(
"/home/mchc/d
ata.json"
)
as
f
:
json_data
=
json
.
load
(
f
)
print
(
json_data
)
return
render
(
request
,
'L2ASCL_data.html'
,
{
"labels"
:
","
.
join
([
k
for
k
in
json_data
]),
"vegetation"
:[
v
[
"4"
]
for
k
,
v
in
json_data
.
items
()]
})
#
def L2ASCL_data(request):
# with open("/home/ulises/REPSAT_NAS/mario_repsat_test/T15QZD_sclD
ata.json") as f:
#
json_data = json.load(f)
#
print(json_data)
#
return render(request, 'L2ASCL_data.html', {"labels":",".join([k for k in json_data]), "vegetation":[v["4"] for k,v in json_data.items()] })
#-------------------------------------------------------------------------------
# def purchaseProduct(request):
# """
...
...
db.sqlite3
View file @
0b05b628
No preview for this file type
geosentinel
View file @
0b05b628
/home/emmanuelhp/Documentos/GeoSentinel/geosentinel
\ No newline at end of file
/home/ulises/django-apps/GeoSentinel/geosentinel
\ No newline at end of file
reports/templates/L2ASCL_data.html
View file @
0b05b628
This diff is collapsed.
Click to expand it.
reports/urls.py
View file @
0b05b628
from
django.conf.urls
import
url
from
.
import
views
from
reports
import
views
urlpatterns
=
[
url
(
r'^$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^(?P<report>\w+)$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^(?P<report>[\w\-]+)/$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
]
reports/views.py
View file @
0b05b628
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
import
io
from
django.http
import
FileResponse
from
reportlab.pdfgen
import
canvas
from
django.shortcuts
import
render
# Create your views here.
from
collections
import
OrderedDict
import
json
#-------------------------------------------------------------------------------
def
report_L2ASCL
(
request
,
report
=
0
):
with
open
(
"/home/mario/NAS_MarioCh/mario_repsat_test/T15QZD_sclData.json"
)
as
f
:
# -------------------------------------------------------------------------------
from
reportlab.pdfgen
import
canvas
from
GeoInt_SIDT
import
settings
def
report_L2ASCL
(
request
,
report
):
with
open
(
"/home/ulises/REPSAT_NAS/mario_repsat_test/"
+
report
+
".json"
)
as
f
:
json_data
=
OrderedDict
(
json
.
load
(
f
))
graphData
=
dict
()
graphData
[
'type'
]
=
"line"
graphData
[
'type'
]
=
"line"
data
=
dict
()
data
[
'labels'
]
=
[
k
for
k
,
v
in
sorted
(
json_data
.
items
())
]
# data['click']="chartOnClick"
data
=
dict
()
data
[
'labels'
]
=
[
k
for
k
,
v
in
sorted
(
json_data
.
items
())
]
# data['click']="chartOnClick"
data
[
'datasets'
]
=
list
()
labels
=
set
()
for
d
in
json_data
:
labels
|=
set
(
json_data
[
d
]
.
keys
())
labels
.
remove
(
'date'
)
labelNames
=
[
"No Data"
,
"Saturated"
,
"Shadows"
,
"Cloud Shadows"
,
"Vegetation"
,
"Not-Vegetated"
,
"Whater"
,
"Unclassified"
,
"Cloud Medium Probablilty"
,
"Cloud Hight Probablilty"
,
"Thin Cirrus"
,
"Snow"
]
colors
=
[
"Black"
,
"Red"
,
"DarkGray"
,
"Brown"
,
"Green"
,
"Yellow"
,
"Blue"
,
"Grey"
,
"LightGray"
,
"White"
,
"Aqua"
,
"Pink"
]
labelNames
=
[
"No Data"
,
"Saturated"
,
"Shadows"
,
"Cloud Shadows"
,
"Vegetation"
,
"Not-Vegetated"
,
"Whater"
,
"Unclassified"
,
"Cloud Medium Probablilty"
,
"Cloud Hight Probablilty"
,
"Thin Cirrus"
,
"Snow"
]
colors
=
[
"Black"
,
"Red"
,
"DarkGray"
,
"Brown"
,
"Green"
,
"Yellow"
,
"Blue"
,
"Grey"
,
"LightGray"
,
"White"
,
"Aqua"
,
"Pink"
]
for
l
in
labels
:
item
=
dict
()
item
[
'label'
]
=
labelNames
[
int
(
l
)]
# item['fill'] = "false"
if
l
==
"0"
:
item
[
'hidden'
]
=
"true"
item
[
'data'
]
=
[
v
[
l
]
*
60
*
60
/
1000000.
for
k
,
v
in
sorted
(
json_data
.
items
())
if
l
in
v
]
item
[
'backgroundColor'
]
=
colors
[
int
(
l
)]
item
[
'data'
]
=
[
v
[
l
]
*
60
*
60
/
1000000.
for
k
,
v
in
sorted
(
json_data
.
items
())
if
l
in
v
]
item
[
'backgroundColor'
]
=
colors
[
int
(
l
)]
data
[
'datasets'
]
.
append
(
item
)
graphData
[
'data'
]
=
data
graphData
[
'data'
]
=
data
#print(settings.BASE_URL)
# graphData['options']['responsive']=True
# graphData['options']['maintainAspectRatio']=False
#print(json.dumps(graphData).encode("utf-8"))
# graphData['options']['responsive']=True
# graphData['options']['maintainAspectRatio']=False
print
(
json
.
dumps
(
graphData
)
.
encode
(
"utf-8"
))
return
render
(
request
,
'L2ASCL_data.html'
,
{
"graphData"
:
json
.
dumps
(
graphData
)
.
encode
(
"utf-8"
)})
return
render
(
request
,
'L2ASCL_data.html'
,
{
"graphData"
:
json
.
dumps
(
graphData
),
"report_name"
:
report
})
# -------------------------------------------------------------------------------
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