use of org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo in project geo-platform by geosdi.
the class GeoserverConnectorCoverageStoresTest method n_readCoverageInfo.
@Test()
public void n_readCoverageInfo() throws Exception {
GeoserverLoadCoverageWithUrlRequest gpGeoserverLoadCoverageWithUrlRequest = this.geoserverConnectorStore.loadCoverageInfoWithUrl().withUrl("http://150.145.141.180/geoserver/rest/workspaces/nurc/coveragestores/mosaic/coverages/mosaic.json");
GPGeoserverCoverageInfo gpGeoserverFeatureTypeInfo = gpGeoserverLoadCoverageWithUrlRequest.getResponse();
logger.info("########################BBOX {}\n", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox());
logger.info("########################BBOX {}\n", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getCrs());
}
use of org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo in project geo-platform by geosdi.
the class GeoserverConnectorCoverageStoresTest method e_splitDimensions.
@Test
public void e_splitDimensions() throws Exception {
GPGeoserverCoverageInfo gpGeoserverCoverageInfo = this.geoserverConnectorStore.loadCoverageInfoWithUrl().withUrl("http://150.145.141.180/geoserver/rest/workspaces/nurc/coveragestores/mosaic/coverages/mosaic.json").getResponse();
logger.info("################{}\n", gpGeoserverCoverageInfo.getDimensions().getCoverageDimension());
logger.info("##############{}\n", StreamSupport.stream(gpGeoserverCoverageInfo.getDimensions().getCoverageDimension().spliterator(), Boolean.FALSE).collect(Collectors.toList()));
RESTLayer restLayer = this.restReader.getLayer("nurc", "mosaic");
RESTCoverage coverage = this.restReader.getCoverage(restLayer);
StreamSupport.stream(coverage.getEncodedDimensionsInfoList().spliterator(), Boolean.FALSE).forEach(c -> System.out.println(c.getName()));
}
use of org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo in project geo-platform by geosdi.
the class GPGeoserverCoverageInfoJacksonTest method b_unmarshallGPGeoserverCoverageInfoFromXmlFileTest.
@Test
public void b_unmarshallGPGeoserverCoverageInfoFromXmlFileTest() throws Exception {
GPGeoserverCoverageInfo coverageInfo = JACKSON_JAXB_XML_SUPPORT.getDefaultMapper().readValue(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "CoverageTypeInfo").collect(joining(separator, "", ".xml"))), GPGeoserverCoverageInfo.class);
logger.info("@@@@@@@@@@@@@@@@@@@@@@@GP_GEOSERVER_COVERAGE_INFO : {}\n", coverageInfo);
}
use of org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo in project geo-platform by geosdi.
the class GPPublisherBasicServiceImpl method getTIFURLByLayerName.
private InfoPreview getTIFURLByLayerName(String workspace, String layerName) {
String userWorkspace = workspace;
if (userWorkspace == null) {
userWorkspace = this.getWorkspace(workspace);
}
GeoserverLayer geoserverLayer = null;
try {
geoserverLayer = this.geoserverConnectorStore.loadWorkspaceLayerRequest().withLayerName(layerName).withWorkspaceName(workspace).getResponse();
} catch (Exception e) {
final String error = "Error to load layer with workspace name: " + workspace + " and layer name:" + layerName + " " + e;
logger.error(error);
throw new IllegalArgumentException(error, e.getCause());
}
if (geoserverLayer == null) {
throw new ResourceNotFoundFault("The layer: " + layerName + " with workspace: " + workspace + " does not exists");
}
if (geoserverLayer.getLayerType().getType() != GeoserverLayerType.Raster.getType()) {
throw new ResourceNotFoundFault("Bad layer type for layer " + layerName);
}
InfoPreview info = null;
try {
GeoserverLoadCoverageWithUrlRequest gpGeoserverLoadCoverageWithUrlRequest = this.geoserverConnectorStore.loadCoverageInfoWithUrl().withUrl(geoserverLayer.getLayerResource().getHref());
GPGeoserverCoverageInfo gpGeoserverFeatureTypeInfo = gpGeoserverLoadCoverageWithUrlRequest.getResponse();
Integer code = this.getEPSGCodeFromString(gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getCrs());
String epsgCode = null;
if (code != null) {
epsgCode = "EPSG:" + code.toString();
}
info = new InfoPreview(RESTURL, userWorkspace, layerName, gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMinx(), gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMiny(), gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMaxx(), gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMaxy(), epsgCode, geoserverLayer.getDefaultStyle().getName(), FALSE, Lists.<LayerPublishAction>newArrayList(LayerPublishAction.OVERRIDE, LayerPublishAction.RENAME));
} catch (Exception e) {
final String error = "The layer " + layerName + " is published in the " + userWorkspace + " workspace, but the server cannot provide info. " + e;
logger.error(error);
throw new IllegalArgumentException(error, e.getCause());
// info = new InfoPreview(layerName,
// "The layer " + layerName + " is published in the " + userWorkspace + " workspace, but the server cannot provide info");
}
return info;
}
use of org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo in project geo-platform by geosdi.
the class GPGeoserverCreateCoverageRequest method prepareHttpEntity.
/**
* @return {@link HttpEntity}
*/
@Override
protected HttpEntity prepareHttpEntity() throws Exception {
GPGeoserverCoverageInfo coverageBody = this.coverageBody.get();
checkArgument(coverageBody != null, "The coverageBody must not be null.");
String workspaceBodyString = jacksonSupport.getDefaultMapper().writeValueAsString(coverageBody);
logger.debug("#############################COVERAGE_BODY : \n{}\n", workspaceBodyString);
return new StringEntity(workspaceBodyString, APPLICATION_JSON);
}
Aggregations