route to merged tile added

parent 14c6b597
......@@ -35,7 +35,7 @@ function addImageLayer(labelDate) {
opacity: 0.5,
source: new ol.source.XYZ({
projection: 'EPSG:3857',
url: '/reports/tiles/'+purchase_id+'/'+zone+'/'+labelDate+'/{z}/{x}/{-y}.png',
url: getURL(purchase_id, zone, labelDate),
tilePixelRatio: 2,
minZoom: 9,
maxZoom: 14
......@@ -44,9 +44,20 @@ function addImageLayer(labelDate) {
imagelayer = xyz;
map.addLayer(xyz);
var extent = ol.proj.transformExtent(data.boundingBox, 'EPSG:4326', 'EPSG:3857');
map.getView().fit(extent, {duration: 800})
}
});
}
var getURL = function (id, report, date) {
var url = '/reports/tiles/'+id+'/'
if (report) {
url += report+'/'
}
return url+date+'/{z}/{x}/{-y}.png'
}
......@@ -10,5 +10,7 @@ urlpatterns = [
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'),
]
......@@ -291,7 +291,22 @@ def wsProcessProgress(request):
# tiles
def tiles(request, purchase_id, report, date, z, x, y):
absolute_path = USERS_PATH + request.user.email + '/' + purchase_id + '/out'
tile_folder = '/' + report + '/tiles' + '/' + date + '_TCI_60m'
tile_folder = '/' + report + '/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")
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
......
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