@Test public void getVectorTile() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); tmsController.getVectorTile("layerBeansMultiPolygon", "layerBeansMultiPolygonStyleInfo", "EPSG:4326", 0, 0, 0, 100.0 / 256.0, "-50,-50", 256, 256, true, false, null, response); response.flushBuffer(); new ResponseAssert(response).assertEqualImage("layerBeansMultiPolygon-0-0-0.png", writeImages, DELTA); }
@RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) public void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs, @PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex, @RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin, @RequestParam(required = false, defaultValue = "256") int tileWidth, @RequestParam(required = false, defaultValue = "256") int tileHeight, @RequestParam(required = false, defaultValue = "true") boolean showGeometries, @RequestParam(required = false, defaultValue = "false") boolean showLabels, @RequestParam(required = false) String filter, HttpServletResponse response) throws Exception { try { Crs tileCrs = geoService.getCrs2(crs); TmsTileMetadata tileMetadata = new TmsTileMetadata(); tileMetadata.setCode(new TileCode(tileLevel, xIndex, yIndex)); tileMetadata.setCrs(geoService.getCodeFromCrs(tileCrs)); tileMetadata.setLayerId(layerId); tileMetadata.setPaintGeometries(showGeometries); tileMetadata.setPaintLabels(showLabels); tileMetadata.setRenderer(TMS_TILE_RENDERER); tileMetadata.setTileWidth(tileWidth); tileMetadata.setTileHeight(tileHeight); tileMetadata.setStyleInfo(styleService.retrieveStyle(layerId, styleKey)); tileMetadata.setFilter(filter); if (resolution == null || tileOrigin == null) { getProfileForLayer(layerId, crs).prepareMetadata(tileMetadata); } else { tileMetadata.setResolution(resolution); tileMetadata.setTileOrigin(parseOrigin(tileOrigin)); } RebuildCacheContainer rcc = new RebuildCacheContainer(); rcc.setMetadata(tileMetadata); PipelineContext context = pipelineService.createContext(); context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata); context.put(PipelineCode.LAYER_ID_KEY, layerId); cachingSupportService.putContainer(context, securityContextAdder, CacheCategory.REBUILD, KEYS, RasterizingPipelineCode.IMAGE_ID_KEY, RasterizingPipelineCode.IMAGE_ID_CONTEXT, rcc, null); String key = context.get(RasterizingPipelineCode.IMAGE_ID_KEY, String.class); renderImage(layerId, key, response); } catch (Throwable e) { log.error("Could not rasterize tile " + layerId + "/" + styleKey + "/" + tileLevel + "-" + xIndex + "-" + yIndex + ".png", e); response.sendError(HttpServletResponse.SC_NO_CONTENT); } }
TmsController { @RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) public void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs, @PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex, @RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin, @RequestParam(required = false, defaultValue = "256") int tileWidth, @RequestParam(required = false, defaultValue = "256") int tileHeight, @RequestParam(required = false, defaultValue = "true") boolean showGeometries, @RequestParam(required = false, defaultValue = "false") boolean showLabels, @RequestParam(required = false) String filter, HttpServletResponse response) throws Exception { try { Crs tileCrs = geoService.getCrs2(crs); TmsTileMetadata tileMetadata = new TmsTileMetadata(); tileMetadata.setCode(new TileCode(tileLevel, xIndex, yIndex)); tileMetadata.setCrs(geoService.getCodeFromCrs(tileCrs)); tileMetadata.setLayerId(layerId); tileMetadata.setPaintGeometries(showGeometries); tileMetadata.setPaintLabels(showLabels); tileMetadata.setRenderer(TMS_TILE_RENDERER); tileMetadata.setTileWidth(tileWidth); tileMetadata.setTileHeight(tileHeight); tileMetadata.setStyleInfo(styleService.retrieveStyle(layerId, styleKey)); tileMetadata.setFilter(filter); if (resolution == null || tileOrigin == null) { getProfileForLayer(layerId, crs).prepareMetadata(tileMetadata); } else { tileMetadata.setResolution(resolution); tileMetadata.setTileOrigin(parseOrigin(tileOrigin)); } RebuildCacheContainer rcc = new RebuildCacheContainer(); rcc.setMetadata(tileMetadata); PipelineContext context = pipelineService.createContext(); context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata); context.put(PipelineCode.LAYER_ID_KEY, layerId); cachingSupportService.putContainer(context, securityContextAdder, CacheCategory.REBUILD, KEYS, RasterizingPipelineCode.IMAGE_ID_KEY, RasterizingPipelineCode.IMAGE_ID_CONTEXT, rcc, null); String key = context.get(RasterizingPipelineCode.IMAGE_ID_KEY, String.class); renderImage(layerId, key, response); } catch (Throwable e) { log.error("Could not rasterize tile " + layerId + "/" + styleKey + "/" + tileLevel + "-" + xIndex + "-" + yIndex + ".png", e); response.sendError(HttpServletResponse.SC_NO_CONTENT); } } }
TmsController { @RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) public void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs, @PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex, @RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin, @RequestParam(required = false, defaultValue = "256") int tileWidth, @RequestParam(required = false, defaultValue = "256") int tileHeight, @RequestParam(required = false, defaultValue = "true") boolean showGeometries, @RequestParam(required = false, defaultValue = "false") boolean showLabels, @RequestParam(required = false) String filter, HttpServletResponse response) throws Exception { try { Crs tileCrs = geoService.getCrs2(crs); TmsTileMetadata tileMetadata = new TmsTileMetadata(); tileMetadata.setCode(new TileCode(tileLevel, xIndex, yIndex)); tileMetadata.setCrs(geoService.getCodeFromCrs(tileCrs)); tileMetadata.setLayerId(layerId); tileMetadata.setPaintGeometries(showGeometries); tileMetadata.setPaintLabels(showLabels); tileMetadata.setRenderer(TMS_TILE_RENDERER); tileMetadata.setTileWidth(tileWidth); tileMetadata.setTileHeight(tileHeight); tileMetadata.setStyleInfo(styleService.retrieveStyle(layerId, styleKey)); tileMetadata.setFilter(filter); if (resolution == null || tileOrigin == null) { getProfileForLayer(layerId, crs).prepareMetadata(tileMetadata); } else { tileMetadata.setResolution(resolution); tileMetadata.setTileOrigin(parseOrigin(tileOrigin)); } RebuildCacheContainer rcc = new RebuildCacheContainer(); rcc.setMetadata(tileMetadata); PipelineContext context = pipelineService.createContext(); context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata); context.put(PipelineCode.LAYER_ID_KEY, layerId); cachingSupportService.putContainer(context, securityContextAdder, CacheCategory.REBUILD, KEYS, RasterizingPipelineCode.IMAGE_ID_KEY, RasterizingPipelineCode.IMAGE_ID_CONTEXT, rcc, null); String key = context.get(RasterizingPipelineCode.IMAGE_ID_KEY, String.class); renderImage(layerId, key, response); } catch (Throwable e) { log.error("Could not rasterize tile " + layerId + "/" + styleKey + "/" + tileLevel + "-" + xIndex + "-" + yIndex + ".png", e); response.sendError(HttpServletResponse.SC_NO_CONTENT); } } TmsController(); }
TmsController { @RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) public void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs, @PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex, @RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin, @RequestParam(required = false, defaultValue = "256") int tileWidth, @RequestParam(required = false, defaultValue = "256") int tileHeight, @RequestParam(required = false, defaultValue = "true") boolean showGeometries, @RequestParam(required = false, defaultValue = "false") boolean showLabels, @RequestParam(required = false) String filter, HttpServletResponse response) throws Exception { try { Crs tileCrs = geoService.getCrs2(crs); TmsTileMetadata tileMetadata = new TmsTileMetadata(); tileMetadata.setCode(new TileCode(tileLevel, xIndex, yIndex)); tileMetadata.setCrs(geoService.getCodeFromCrs(tileCrs)); tileMetadata.setLayerId(layerId); tileMetadata.setPaintGeometries(showGeometries); tileMetadata.setPaintLabels(showLabels); tileMetadata.setRenderer(TMS_TILE_RENDERER); tileMetadata.setTileWidth(tileWidth); tileMetadata.setTileHeight(tileHeight); tileMetadata.setStyleInfo(styleService.retrieveStyle(layerId, styleKey)); tileMetadata.setFilter(filter); if (resolution == null || tileOrigin == null) { getProfileForLayer(layerId, crs).prepareMetadata(tileMetadata); } else { tileMetadata.setResolution(resolution); tileMetadata.setTileOrigin(parseOrigin(tileOrigin)); } RebuildCacheContainer rcc = new RebuildCacheContainer(); rcc.setMetadata(tileMetadata); PipelineContext context = pipelineService.createContext(); context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata); context.put(PipelineCode.LAYER_ID_KEY, layerId); cachingSupportService.putContainer(context, securityContextAdder, CacheCategory.REBUILD, KEYS, RasterizingPipelineCode.IMAGE_ID_KEY, RasterizingPipelineCode.IMAGE_ID_CONTEXT, rcc, null); String key = context.get(RasterizingPipelineCode.IMAGE_ID_KEY, String.class); renderImage(layerId, key, response); } catch (Throwable e) { log.error("Could not rasterize tile " + layerId + "/" + styleKey + "/" + tileLevel + "-" + xIndex + "-" + yIndex + ".png", e); response.sendError(HttpServletResponse.SC_NO_CONTENT); } } TmsController(); boolean isRedirectRasterLayers(); void setRedirectRasterLayers(boolean redirectRasterLayers); @RequestMapping(value = MAPPING_1_0_0, method = RequestMethod.GET) void getTileMapService(HttpServletResponse response); @RequestMapping(value = MAPPING_1_0_0 + "/{layerId}@{crs}/{styleKey}", method = RequestMethod.GET) void getTileMap(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs,
			HttpServletResponse response); @RequestMapping(value = MAPPING_1_0_0 + "/{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) void getTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs,
			@PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex,
			@RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin,
			@RequestParam(required = false, defaultValue = "256") int tileWidth,
			@RequestParam(required = false, defaultValue = "256") int tileHeight,
			@RequestParam(required = false, defaultValue = "true") boolean showGeometries,
			@RequestParam(required = false, defaultValue = "false") boolean showLabels,
			@RequestParam(required = false) String filter, HttpServletResponse response); @RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs,
			@PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex,
			@RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin,
			@RequestParam(required = false, defaultValue = "256") int tileWidth,
			@RequestParam(required = false, defaultValue = "256") int tileHeight,
			@RequestParam(required = false, defaultValue = "true") boolean showGeometries,
			@RequestParam(required = false, defaultValue = "false") boolean showLabels,
			@RequestParam(required = false) String filter, HttpServletResponse response); @RequestMapping(value = MAPPING + "{layerId}@{crs}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) void getRasterTile(@PathVariable String layerId, @PathVariable String crs, @PathVariable Integer tileLevel,
			@PathVariable Integer xIndex, @PathVariable Integer yIndex, @PathVariable String imageFormat,
			HttpServletRequest request, HttpServletResponse response); }
TmsController { @RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) public void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs, @PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex, @RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin, @RequestParam(required = false, defaultValue = "256") int tileWidth, @RequestParam(required = false, defaultValue = "256") int tileHeight, @RequestParam(required = false, defaultValue = "true") boolean showGeometries, @RequestParam(required = false, defaultValue = "false") boolean showLabels, @RequestParam(required = false) String filter, HttpServletResponse response) throws Exception { try { Crs tileCrs = geoService.getCrs2(crs); TmsTileMetadata tileMetadata = new TmsTileMetadata(); tileMetadata.setCode(new TileCode(tileLevel, xIndex, yIndex)); tileMetadata.setCrs(geoService.getCodeFromCrs(tileCrs)); tileMetadata.setLayerId(layerId); tileMetadata.setPaintGeometries(showGeometries); tileMetadata.setPaintLabels(showLabels); tileMetadata.setRenderer(TMS_TILE_RENDERER); tileMetadata.setTileWidth(tileWidth); tileMetadata.setTileHeight(tileHeight); tileMetadata.setStyleInfo(styleService.retrieveStyle(layerId, styleKey)); tileMetadata.setFilter(filter); if (resolution == null || tileOrigin == null) { getProfileForLayer(layerId, crs).prepareMetadata(tileMetadata); } else { tileMetadata.setResolution(resolution); tileMetadata.setTileOrigin(parseOrigin(tileOrigin)); } RebuildCacheContainer rcc = new RebuildCacheContainer(); rcc.setMetadata(tileMetadata); PipelineContext context = pipelineService.createContext(); context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata); context.put(PipelineCode.LAYER_ID_KEY, layerId); cachingSupportService.putContainer(context, securityContextAdder, CacheCategory.REBUILD, KEYS, RasterizingPipelineCode.IMAGE_ID_KEY, RasterizingPipelineCode.IMAGE_ID_CONTEXT, rcc, null); String key = context.get(RasterizingPipelineCode.IMAGE_ID_KEY, String.class); renderImage(layerId, key, response); } catch (Throwable e) { log.error("Could not rasterize tile " + layerId + "/" + styleKey + "/" + tileLevel + "-" + xIndex + "-" + yIndex + ".png", e); response.sendError(HttpServletResponse.SC_NO_CONTENT); } } TmsController(); boolean isRedirectRasterLayers(); void setRedirectRasterLayers(boolean redirectRasterLayers); @RequestMapping(value = MAPPING_1_0_0, method = RequestMethod.GET) void getTileMapService(HttpServletResponse response); @RequestMapping(value = MAPPING_1_0_0 + "/{layerId}@{crs}/{styleKey}", method = RequestMethod.GET) void getTileMap(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs,
			HttpServletResponse response); @RequestMapping(value = MAPPING_1_0_0 + "/{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) void getTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs,
			@PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex,
			@RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin,
			@RequestParam(required = false, defaultValue = "256") int tileWidth,
			@RequestParam(required = false, defaultValue = "256") int tileHeight,
			@RequestParam(required = false, defaultValue = "true") boolean showGeometries,
			@RequestParam(required = false, defaultValue = "false") boolean showLabels,
			@RequestParam(required = false) String filter, HttpServletResponse response); @RequestMapping(value = MAPPING + "{layerId}@{crs}/{styleKey}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) void getVectorTile(@PathVariable String layerId, @PathVariable String styleKey, @PathVariable String crs,
			@PathVariable Integer tileLevel, @PathVariable Integer xIndex, @PathVariable Integer yIndex,
			@RequestParam(required = false) Double resolution, @RequestParam(required = false) String tileOrigin,
			@RequestParam(required = false, defaultValue = "256") int tileWidth,
			@RequestParam(required = false, defaultValue = "256") int tileHeight,
			@RequestParam(required = false, defaultValue = "true") boolean showGeometries,
			@RequestParam(required = false, defaultValue = "false") boolean showLabels,
			@RequestParam(required = false) String filter, HttpServletResponse response); @RequestMapping(value = MAPPING + "{layerId}@{crs}/{tileLevel}/{xIndex}/{yIndex}.{imageFormat}", method = RequestMethod.GET) void getRasterTile(@PathVariable String layerId, @PathVariable String crs, @PathVariable Integer tileLevel,
			@PathVariable Integer xIndex, @PathVariable Integer yIndex, @PathVariable String imageFormat,
			HttpServletRequest request, HttpServletResponse response); static final int PROFILE_TILE_SIZE; static final String MAPPING; static final String MAPPING_1_0_0; }