geoscript / geoscript-groovy

A Groovy implementation of GeoScript.
https://geoscript.net/groovy
MIT License
46 stars 22 forks source link

Add GeneratingTileLayer #34

Closed jericks closed 8 years ago

jericks commented 8 years ago

A TileLayer that can generate Tiles on demand as a client tries to get them. It would be wrap a TileLayer (like MBTiles) and a TileRenderer (like ImageTileRenderer) and if the client tries to get a tile that isn't present (doesn't have any data) it would use the TileRenderer to generate the data.

MBTiles mbtiles = new MBTiles(new File("world.mbtiles"),"The World","The World Tiles")

Workspace workspace = new geoscript.workspace.GeoPackage(new File("naturalearth.gpkg")) Layer countries = workspace.get("countries") countries.style = new SLDReader().read(new File("countries.sld")) Layer ocean = workspace.get("ocean") ocean.style = new SLDReader().read(new File("ocean.sld"))

ImageTileRenderer renderer = new ImageTileRenderer(mbtiles, [ocean, countries])

GeneratingTileLayer generatingTiles = new GeneratingTileLayer(mbtiles, renderer) generatingTiles.get(0,0,0) generatingTiles.get(1,0,0) generatingTiles.get(1,0,1) generatingTiles.get(1,1,0) generatingTiles.get(1,1,1)