Returns a GeoJSON FeatureCollection containing a Feature for each rectangular tile
FeatureCollection containing a Feature for each rectangular tile
Returns a TileResult object which contains details about all the tiles covering the given viewport
tile result
At zoom 0:
+-------+ +85.0511
| |
| 0,0,0 |
| |
+-------+ -85.0511
-180 +180
const t0 = new Tiler();
const v0 = new Viewport();
v0.transform = { x: 128, y: 128, z: 0 };
v0.dimensions = [256, 256]; // entire world visible
const result = t0.getTiles(v0);
At zoom 1:
+-------+-------+ +85.0511
| | |
| 0,0,1 | 1,0,1 |
| | |
+-------+-------+ 0
| | |
| 0,1,1 | 1,1,1 |
| | |
+-------+-------+ -85.0511
-180 0 +180
const t1 = new Tiler();
const v1 = new Viewport();
v1.transform = { x: 256, y: 256, z: 1 };
v1.dimensions = [512, 512]; // entire world visible
const result = t1.getTiles(v1);
At zoom 2:
+-------+-------+-------+-------+ +85.0511
| | | | |
| 0,0,2 | 1,0,2 | 2,0,2 | 3,0,2 |
| | | | |
+-------+-------+-------+-------+ +66.5133
| | | | |
| 0,1,2 | 1,1,2 | 2,1,2 | 3,1,2 |
| | | | |
+-------+-------+-------+-------+ 0
| | | | |
| 0,2,2 | 1,2,2 | 2,2,2 | 3,2,2 |
| | | | |
+-------+-------+-------+-------+ -66.5133
| | | | |
| 0,3,2 | 1,3,2 | 2,3,2 | 3,3,2 |
| | | | |
+-------+-------+-------+-------+ -85.0511
-180 -90 0 +90 +180
const t2 = new Tiler();
const v2 = new Viewport();
v2.transform = { x: 512, y: 512, z: 2 };
v2.dimensions = [1024, 1024]; // entire world visible
const result = t2.getTiles(v2);
Sets/Gets the current tile margin (number to extend the rows/columns beyond those covering the viewport)
Optionalval: numberWhen an argument is passed, sets the tile margin and returns this for method chaining
Returns the tile margin otherwise
Sets/Gets the current skipNullIsland value
Optionalval: booleanWhen an argument is passed, sets the skipNullIsland value and returns this for method chaining
Returns the skipNullIsland value otherwise
Sets/Gets the current tileSize
Optionalval: numbertile size value
When passed a numeric argument, sets the tile size and returns this for method chaining
Returns the tile size otherwise
StaticisTests whether the given tile coordinate is near [0,0] (Null Island)
true if near null island, false otherwise
A tile is considered "near" if it >= z7 and around the center of the map within these or descendent tiles (roughly within about 2.8° of [0,0]).
+---------+---------+
| | |
| 63,63,7 | 64,63,7 |
| | |
+-------[0,0]-------+
| | |
| 63,64,7 | 64,64,7 |
| | |
+---------+---------+
Tiler.isNearNullIsland(31, 31, 6); // returns false (zoom 6)
Tiler.isNearNullIsland(63, 65, 7); // returns false (south of Null Island region)
Tiler.isNearNullIsland(63, 63, 7); // returns true
Tiler.isNearNullIsland(127, 127, 8); // returns true
Constructs a new Tiler