ngageoint / geopackage-js

GeoPackage JavaScript Library
http://ngageoint.github.io/geopackage-js/
MIT License
304 stars 78 forks source link

Added in tile scaling extension #150

Closed caldwellc closed 4 years ago

caldwellc commented 4 years ago

Added in the Tile Scaling Extension:

http://ngageoint.github.io/GeoPackage/docs/extensions/tile-scaling.html

Added in test cases as well.

Start with a GeoPackage with a tile table that doesn't have tiles for every zoom level. In the case of the tests added, denver_tile.gpkg was added to the baseline. It has a set of tiles for zoom 16 only.

To enable tile scaling extension: const tileScalingExtension = geoPackage.getTileScalingExtension('tile_table_name'); await tileScalingExtension.getOrCreateExtension();

Setup tile scaling constraints: const tileScaling = new TileScaling(); tileScaling.scaling_type = TileScalingType.IN_OUT; tileScaling.zoom_in = 2; tileScaling.zoom_out = 2; tileScalingExtension.createOrUpdate(tileScaling);

Enable scaling in the GeoPackage Tile Retriever: var gpr = new GeoPackageTileRetriever(tileDao, 256, 256); gpr.setScaling(tileScalingDao.queryForTableName('tile_table_name'));

With the rules defined, if a zoom level is not found it will search IN first a maximum of 2 zoom levels, if no tiles are found, it will search OUT a maximum of 2 zoom levels. If tiles are found, they will be scaled accordingly to generate the scaled tile.