Skip to content
mtehver edited this page May 19, 2014 · 6 revisions

Nutiteq SDK supports different map projections for both vector and raster data but makes certain assumptions for raster tilesets:

  • Origin of map tiles corresponds to the center of the bounds of the projection.

  • We calculate the number of root tiles automatically from projection bounds (for example, for 1 root tile for EPSG3857, 2 root tiles for EPSG4326).

For custom projections/custom tiles these assumptions could be limiting, but this could be usually overcome by redefining bounds of the projection.

com.nutiteq.utils.TileUtils class has helper method for calculating projection bounds based on 2 points on actual tiles. For example,

Bounds tileBounds = com.nutiteq.utils.TileUtils.ProjectionBounds(
   new MapTile(12, 18, 6, 0),  35, 130, new MapPos(67751.185,  228789.73),
   new MapTile(54,  2, 6, 0), 218,  24, new MapPos(242684.185, 161586.73)
);
Projection projection = new EPSG31370(tileBounds);

This snippet configures EPSG31370 projection with custom bounds. Bounds are calculated from 2 points. The first point (coordinates 67751.185, 228789.73) corresponds to tile 12/18/6 (x/y/zoom), and pixel with coordinates x=35, y=130 (calculated from left and bottom of the tile). The second point (coordinates 242684.185, 161586.73) is on tile 54/2/6, at pixel coordinates 218/24.

For best fit, the 2 points should be as far as possible (along both projection axis). Also, corresponding pixels should be at the highest possible zoom levels (pixels from tiles at zoom levels 12 give 64 times better precision that corresponding pixels from zoom level 6, for example).

Clone this wiki locally