Skip to content

Managing Mosaic Layers

Simone Giannecchini edited this page Aug 1, 2013 · 14 revisions

Publishing an external mosaic in geoserver

The following code will create an external coverage store in GeoServer also publishing the layer:

`// layer encoder final GSLayerEncoder layerEnc = new GSLayerEncoder(); String style=getDefaultStyle(); if (style==null || style.isEmpty()) style="raster"; layerEnc.setDefaultStyle(style);

// coverage encoder final GSImageMosaicEncoder coverageEnc=new GSImageMosaicEncoder(); coverageEnc.setName(mosaicDescriptor.getCoverageStoreId()); coverageEnc.setTitle(mosaicDescriptor.getCoverageStoreId()); if (config.getCrs()!=null){ coverageEnc.setSRS(config.getCrs()); } coverageEnc.setMaxAllowedTiles(Integer.MAX_VALUE);

// ... many other options are supported

// create a new ImageMosaic layer... final boolean published = gsPublisher.publishExternalMosaic(workspace, storeName, baseDir, coverageEnc, layerEnc);

// check the results if (!published) { final String msg="Error creating the new store: " + layerName; Exception ex = new Exception(this.getClass(), msg); } `

Clone this wiki locally