Closed ElijasZ closed 6 years ago
Hi,
According to http://django-raster.readthedocs.io/en/latest/installation.html you should add the following url to your project urlpatterns
definition.
url(r'^raster/', include('raster.urls')),
Then according to https://leafletjs.com/ you can use django-raster's TMS endpoint in leaflet as demonstrated bellow:
// replace the setView arguments so it's centered and zoomed on you area of interest.
// Here it's centered to lat 51.505, lon -0.09 and it's using the 13th zoom level.
var map = L.map('map').setView([51.505, -0.09], 13);
// Openstreemap background tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// Your tiles
L.tileLayer('http://localhost:8000/raster/tiles/layer_id/{z}/{x}/{y}.png', {
attribution: 'Something'
}).addTo(map);
I'm not entirely sure about the leaflet setup as I use openlayers but it should work that way. By default django-raster will display the tilling using a simple grayscale, so checkout the TMS endpoint documentation to see how to add colors.
Thank you very much, it worked like a charm.
Hello, i am completely new regarding GDAL and Django GIS coul you give an example of code on how to pass raster stored in raster database to leaflet (since you mention it in documentation)