Merge pull request #8937 from tschaub/debug-tiles

Make the tile debug source useful for understanding tiles
This commit is contained in:
Tim Schaub
2018-11-14 17:06:52 +01:00
committed by GitHub
3 changed files with 22 additions and 22 deletions
+1 -4
View File
@@ -4,10 +4,7 @@ title: Canvas Tiles
shortdesc: Renders tiles with coordinates for debugging.
docs: >
The black grid tiles are generated on the client with an HTML5 canvas. The
displayed tile coordinates are OpenLayers tile coordinates. These increase
from bottom to top, but standard XYZ tiling scheme coordinates increase from
top to bottom. To calculate the `y` for a standard XYZ tile coordinate, use
`-y - 1`.
displayed tile coordinates are the XYZ tile coordinates.
tags: "layers, openstreetmap, canvas"
---
<div id="map" class="map"></div>
+4 -9
View File
@@ -1,26 +1,21 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat} from '../src/ol/proj.js';
import {OSM, TileDebug} from '../src/ol/source.js';
const osmSource = new OSM();
const map = new Map({
layers: [
new TileLayer({
source: osmSource
source: new OSM()
}),
new TileLayer({
source: new TileDebug({
projection: 'EPSG:3857',
tileGrid: osmSource.getTileGrid()
})
source: new TileDebug()
})
],
target: 'map',
view: new View({
center: fromLonLat([-0.1275, 51.507222]),
zoom: 10
center: [0, 0],
zoom: 1
})
});