#8 Configure the BoundingBox when publishing a layer
Possibility to configure the BBox when publishing a Mosaic.
This commit is contained in:
parent
4de2db5553
commit
7f94202baa
@ -422,13 +422,38 @@ public class GeoServerRESTPublisher {
|
|||||||
* @param workspace an existing workspace
|
* @param workspace an existing workspace
|
||||||
* @param storeName the name of the coverageStore to be created
|
* @param storeName the name of the coverageStore to be created
|
||||||
* @param mosaicDir the directory where the raster images are located
|
* @param mosaicDir the directory where the raster images are located
|
||||||
|
* @param srs the coverage declared SRS
|
||||||
* @param defaultStyle may be null
|
* @param defaultStyle may be null
|
||||||
* @return true if the operation completed successfully.
|
|
||||||
* @throws FileNotFoundException
|
|
||||||
*
|
*
|
||||||
* @deprecated work in progress
|
* @return true if the operation completed successfully.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
*/
|
*/
|
||||||
public RESTCoverageStore publishExternalMosaic(String workspace, String storeName, File mosaicDir, String srs, String defaultStyle) throws FileNotFoundException {
|
public RESTCoverageStore publishExternalMosaic(String workspace, String storeName, File mosaicDir, String srs, String defaultStyle) throws FileNotFoundException {
|
||||||
|
GSCoverageEncoder coverageEncoder = new GSCoverageEncoder();
|
||||||
|
coverageEncoder.setSRS(srs);
|
||||||
|
|
||||||
|
return publishExternalMosaic(workspace, storeName, mosaicDir, coverageEncoder, defaultStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish a Mosaic already in a filesystem readable by GeoServer.
|
||||||
|
*
|
||||||
|
* <P> Sample cUrl usage:<BR>
|
||||||
|
* <TT>curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR"
|
||||||
|
* http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic </TT>
|
||||||
|
*
|
||||||
|
* @param workspace an existing workspace
|
||||||
|
* @param storeName the name of the coverageStore to be created
|
||||||
|
* @param mosaicDir the directory where the raster images are located
|
||||||
|
* @param coverageEncoder the set of parameters to be set to the coverage
|
||||||
|
* @param defaultStyle may be null
|
||||||
|
*
|
||||||
|
* @return true if the operation completed successfully.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public RESTCoverageStore publishExternalMosaic(String workspace, String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder, String defaultStyle) throws FileNotFoundException {
|
||||||
RESTCoverageStore store = configureExternaMosaicDatastore(workspace, storeName, mosaicDir);
|
RESTCoverageStore store = configureExternaMosaicDatastore(workspace, storeName, mosaicDir);
|
||||||
if (store != null ) {
|
if (store != null ) {
|
||||||
try {
|
try {
|
||||||
@ -441,13 +466,8 @@ public class GeoServerRESTPublisher {
|
|||||||
}
|
}
|
||||||
String coverageName = covList.get(0).getName();
|
String coverageName = covList.get(0).getName();
|
||||||
|
|
||||||
|
|
||||||
// config coverage props (srs)
|
|
||||||
GSCoverageEncoder coverageEncoder = new GSCoverageEncoder();
|
|
||||||
coverageEncoder.setSRS(srs);
|
|
||||||
configureCoverage(coverageEncoder, workspace, storeName, coverageName);
|
configureCoverage(coverageEncoder, workspace, storeName, coverageName);
|
||||||
|
|
||||||
|
|
||||||
// config layer props (style, ...)
|
// config layer props (style, ...)
|
||||||
GSLayerEncoder layerEncoder = new GSLayerEncoder();
|
GSLayerEncoder layerEncoder = new GSLayerEncoder();
|
||||||
layerEncoder.setDefaultStyle(defaultStyle);
|
layerEncoder.setDefaultStyle(defaultStyle);
|
||||||
|
|||||||
@ -29,14 +29,10 @@ package it.geosolutions.geoserver.rest.encoder;
|
|||||||
*
|
*
|
||||||
* @author ETj (etj at geo-solutions.it)
|
* @author ETj (etj at geo-solutions.it)
|
||||||
*/
|
*/
|
||||||
public class GSCoverageEncoder extends PropertyXMLEncoder {
|
public class GSCoverageEncoder extends GSResourceEncoder {
|
||||||
|
|
||||||
public GSCoverageEncoder() {
|
public GSCoverageEncoder() {
|
||||||
super("coverage");
|
super("coverage");
|
||||||
set("enabled", "true");
|
set("enabled", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSRS(String srs) {
|
|
||||||
setOrRemove("srs", srs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ package it.geosolutions.geoserver.rest.encoder;
|
|||||||
*
|
*
|
||||||
* @author ETj (etj at geo-solutions.it)
|
* @author ETj (etj at geo-solutions.it)
|
||||||
*/
|
*/
|
||||||
public class GSFeatureTypeEncoder extends PropertyXMLEncoder {
|
public class GSFeatureTypeEncoder extends GSResourceEncoder {
|
||||||
|
|
||||||
public GSFeatureTypeEncoder() {
|
public GSFeatureTypeEncoder() {
|
||||||
super("featureType");
|
super("featureType");
|
||||||
@ -39,13 +39,4 @@ public class GSFeatureTypeEncoder extends PropertyXMLEncoder {
|
|||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
setOrRemove("name", name);
|
setOrRemove("name", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSRS(String srs) {
|
|
||||||
setOrRemove("srs", srs);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void setNativeCRS(String crs) {
|
|
||||||
// setOrRemove("nativeCRS", crs);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
|
||||||
|
* http://www.geo-solutions.it
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package it.geosolutions.geoserver.rest.encoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ETj (etj at geo-solutions.it)
|
||||||
|
*/
|
||||||
|
public abstract class GSResourceEncoder extends PropertyXMLEncoder {
|
||||||
|
|
||||||
|
protected GSResourceEncoder(String rootName) {
|
||||||
|
super(rootName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSRS(String srs) {
|
||||||
|
setOrRemove("srs", srs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatLonBoundingBox(double minx, double maxy, double maxx, double miny, String crs) {
|
||||||
|
setOrRemove("latLonBoundingBox/minx", String.valueOf(minx));
|
||||||
|
setOrRemove("latLonBoundingBox/maxy", String.valueOf(maxy));
|
||||||
|
setOrRemove("latLonBoundingBox/maxx", String.valueOf(maxx));
|
||||||
|
setOrRemove("latLonBoundingBox/miny", String.valueOf(miny));
|
||||||
|
setOrRemove("latLonBoundingBox/crs", crs);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user