I'm sorry if this goes against etiquette, but I'm rather desperate so I need
to re-post this in it's own thread...
Thanks!
I've tried this and I'm having a few problems:
What do I need to replace "newCoverage" and "description" with in this line
CoverateStoreConfig coverageStore = new
CoverateStoreConfig("newCoverage","description");
And, what HttpServletRequest object is needed in the following line:
CoverageConfig coverageConfig = new CoverageConfig(formatID, format, reader,
request);
I'm doing all of this in the execute method of my Response class and don't
have a HttpServletRequest...
Thanks again,
Jon
Justin Deoliveira-4 wrote:
Ok, so based on your original email you say you are doing an operation
on two coverages to create a third. And I assume this is happening in a
servlet? For the coverates you are working on I assume you have a
reference to two CoverageInfo objects?CoverageInfo c1 = ...;
CoverageInfo c2 = ...;//get at the data config
ServletContext ctx = getServletConfig().getServletContext();
DataConfig dataConfig = (DataConfig) ctx.getAttribute(
DataConfig.CONFIG_KEY );//get at the data
Data data = (Data) ctx.getAttribute( Data.WEB_CONTAINER_KEY );//create a new coverage store config object
CoverateStoreConfig coverageStore = new CoverateStoreConfig(
"newCoverage", "description" );
coverageStoreConfig.setType( "GeoTIFF" );
coverageStoreConfig.setURL( "C:\data\...\something.tif" );
dataConfig.addDataFormat( coverageStoreConfig );CoverateStoreInfo coverateStoreInfo = new CoverateStoreInfo(
coverageStoreConfig.toDTO(), data);//create a new coverage config object
Format format = coverageStoreInfo.getFormat();
AbstractGridCoverage2DReader reader = (AbstractGridCoverage2DReader)
coverageStoreInfo.getReader();if (reader == null) {
reader = (AbstractGridCoverage2DReader) ((AbstractGridFormat)
format).getReader(GeoserverDataDirectory.findDataFile(coverageStoreInfo.getUrl()));
}CoverageConfig coverageConfig = new CoverageConfig(formatID, format,
reader, request);//add the new coverage
dataConfig.addCoverage( "key", coverageConfig );//save changes
data.load( dataConfig.toDTO() );
XMLConfigWriter.Store( data.toDTO(),
GeoServerDataDirecetory.getGeoserverDataDirectory());Try that out. I have to admit I have never really tried this before and
the code above is just what would be my first attempt. Try it out, but
you will probably have to play around a bit to get it to work.-Justin
--
View this message in context: http://www.nabble.com/Adding-a-new-coverage-from-within-a-service-tf4797060.html#a13723559
Sent from the GeoServer - Dev mailing list archive at Nabble.com.