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
85de7f9b
Commit
85de7f9b
authored
Mar 15, 2019
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
draw tiles fixed
parent
e8f4d959
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
55 deletions
+12
-55
minimap.js
reports/static/reports/js/minimap.js
+4
-14
urls.py
reports/urls.py
+0
-3
views.py
reports/views.py
+8
-38
No files found.
reports/static/reports/js/minimap.js
View file @
85de7f9b
...
...
@@ -29,12 +29,13 @@ function addImageLayer(labelDate) {
url
:
'/reports/tiles/tileinfo'
,
success
:
function
(
data
)
{
map
.
removeLayer
(
imagelayer
)
console
.
log
(
"response "
,
data
);
console
.
log
({
purchase_id
,
zone
,
labelDate
});
var
xyz
=
new
ol
.
layer
.
Tile
({
opacity
:
0.5
,
opacity
:
1
,
source
:
new
ol
.
source
.
XYZ
({
projection
:
'EPSG:3857'
,
url
:
getURL
(
purchase_id
,
zone
,
labelDate
)
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
labelDate
+
'/{z}/{x}/{-y}.png'
,
tilePixelRatio
:
2
,
minZoom
:
data
.
zoom
.
min
,
maxZoom
:
data
.
zoom
.
max
...
...
@@ -51,14 +52,3 @@ function addImageLayer(labelDate) {
}
});
}
var
getURL
=
function
(
id
,
report
,
date
)
{
var
url
=
'/reports/tiles/'
+
id
+
'/'
if
(
report
)
{
url
+=
report
+
'/'
}
return
url
+
date
+
'/{z}/{x}/{-y}.png'
}
reports/urls.py
View file @
85de7f9b
...
...
@@ -4,13 +4,10 @@ from . import views
from
reports
import
views
urlpatterns
=
[
url
(
r'^(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^$'
,
views
.
Reports
,
name
=
'reports'
),
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$'
,
views
.
tiles
,
name
=
'tile'
),
url
(
r'^tiles/(?P<purchase_id>(\d+))/(?P<date>[0-9]+)/(?P<z>[0-9]+)/(?P<x>[0-9]+)/(?P<y>[0-9]+).png$'
,
views
.
mergedTiles
,
name
=
'mergedTiles'
),
url
(
r'^tiles/tileinfo$'
,
views
.
tileinfo
,
name
=
'tileinfo'
),
]
reports/views.py
View file @
85de7f9b
...
...
@@ -264,65 +264,35 @@ def wsProcessProgress(request):
# tiles
def
tiles
(
request
,
purchase_id
,
report
,
date
,
z
,
x
,
y
):
print
(
"tiles!!!"
)
absolute_path
=
USERS_PATH
+
request
.
user
.
email
+
'/'
+
purchase_id
+
'/out'
tile_folder
=
'/'
+
report
+
'/TCI/tiles/'
+
date
+
'_TCI_60m'
image
=
'/'
+
z
+
'/'
+
x
+
'/'
+
y
+
'.png'
image_path
=
absolute_path
+
tile_folder
+
image
print
(
image_path
)
image_path
=
"{}{}/{}/out/{}/TCI/tiles/{}_TCI_60m/{}/{}/{}.png"
.
format
(
USERS_PATH
,
request
.
user
.
email
,
purchase_id
,
report
,
date
,
z
,
x
,
y
)
if
not
os
.
path
.
exists
(
image_path
):
# raise Http404
return
HttpResponse
(
None
,
content_type
=
"image/png"
)
# image_path = USERS_PATH + 'none.png'
image
=
open
(
image_path
,
"rb"
)
.
read
()
return
HttpResponse
(
image
,
content_type
=
"image/png"
)
def
mergedTiles
(
request
,
purchase_id
,
date
,
z
,
x
,
y
):
absolute_path
=
USERS_PATH
+
request
.
user
.
email
+
'/'
+
purchase_id
+
'/out'
tile_folder
=
'/mask/TCI/tiles/'
+
date
+
'_TCI_60m'
image
=
'/'
+
z
+
'/'
+
x
+
'/'
+
y
+
'.png'
image_path
=
absolute_path
+
tile_folder
+
image
if
not
os
.
path
.
exists
(
image_path
):
# raise Http404
return
HttpResponse
(
None
,
content_type
=
"image/png"
)
# image_path = USERS_PATH + 'none.png'
image
=
open
(
image_path
,
"rb"
)
.
read
()
return
HttpResponse
(
image
,
content_type
=
"image/png"
)
# read a xml file with tiles info to display and return that info
@
csrf_exempt
def
tileinfo
(
request
):
print
(
"tileinfo!!!"
)
if
request
.
is_ajax
():
req
=
dict
(
request
.
POST
)
resource_path
=
USERS_PATH
+
request
.
user
.
email
+
'/'
+
req
[
'purchase_id'
][
0
]
+
'/out'
print
(
req
)
print
(
req
[
'report'
][
0
])
if
req
[
'report'
][
0
]
!=
"mask"
:
resource_path
+=
'/'
+
req
[
'report'
][
0
]
+
'/TCI/tiles/'
else
:
resource_path
+=
'/mask/TCI/tiles/'
resource_path
+=
req
[
'date'
][
0
]
+
'_TCI_60m/tilemapresource.xml'
print
(
resource_path
)
resource_path
=
"{}{}/{}/out/{}/TCI/tiles/{}_TCI_60m/tilemapresource.xml"
.
format
(
USERS_PATH
,
request
.
user
.
email
,
req
[
'purchase_id'
][
0
],
req
[
'report'
][
0
],
req
[
'date'
][
0
]
)
if
not
os
.
path
.
exists
(
resource_path
):
raise
Http404
tree
=
ET
.
parse
(
resource_path
)
print
(
tree
)
bounding_box
=
tree
.
find
(
'BoundingBox'
)
sets
=
[
set
.
get
(
'order'
)
for
set
in
tree
.
findall
(
'TileSets/TileSet'
)]
sets
=
[
int
(
set
.
get
(
'order'
)
)
for
set
in
tree
.
findall
(
'TileSets/TileSet'
)]
origin
=
tree
.
find
(
'Origin'
)
return
JsonResponse
({
...
...
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