mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-30 08:50:32 +02:00
Add tiler.getGeoJSON, useful for debugging tile settings
This commit is contained in:
@@ -111,6 +111,31 @@ export function utilTiler() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* getGeoJSON() returns a FeatureCollection for debugging tiles
|
||||
*/
|
||||
tiler.getGeoJSON = function(projection) {
|
||||
var features = tiler.getTiles(projection).map(function(tile) {
|
||||
return {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
id: tile.id,
|
||||
name: tile.id
|
||||
},
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [ tile.extent.polygon() ]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: features
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
tiler.tileSize = function(val) {
|
||||
if (!arguments.length) return _tileSize;
|
||||
_tileSize = val;
|
||||
|
||||
Reference in New Issue
Block a user