/** Supports WCS 1.1.1 */ public Contents mapContents(CapabilitiesDocument capDoc) { CoverageSummaryType[] covSumArray = capDoc.getCapabilities().getContents().getCoverageSummaryArray(); ArrayList<Dataset> dataIdentificationList = new ArrayList<Dataset>(); for (CoverageSummaryType covSum : covSumArray) { String title = covSum.getTitleArray()[0].getStringValue(); String identifier = covSum.getIdentifier(); String ll = covSum.getWGS84BoundingBoxArray()[0].getLowerCorner().toString(); String ur = covSum.getWGS84BoundingBoxArray()[0].getUpperCorner().toString(); double[] lla = new double[2]; for (int i = 0; i < 2; i++) { lla[i] = new Double(ll.split(" ")[i]); } double[] ura = new double[2]; for (int i = 0; i < 2; i++) { ura[i] = new Double(ur.split(" ")[i]); } BoundingBox bBox = new BoundingBox(lla, ura); // add Dataset to list: Dataset dataID = new Dataset(title, identifier, new BoundingBox[] {bBox}); dataIdentificationList.add(dataID); } Contents c = new Contents(dataIdentificationList); return c; }
public ServiceIdentification mapServiceIdentification(CapabilitiesDocument capDoc) throws OXFException { String title = capDoc.getCapabilities().getServiceIdentification().getTitleArray().toString(); String serviceType = "OGC:WCS"; // -> cause its a WCS-Adapter String[] serviceTypeVersion = new String[] {"1.1.1"}; ServiceIdentification si; try { si = new ServiceIdentification(title, serviceType, serviceTypeVersion); } catch (IllegalArgumentException e) { throw new OXFException(e); } return si; }
/** Supports WCS 1.1.1 */ public OperationsMetadata mapOperationsMetadata(CapabilitiesDocument capDoc, Contents contents) throws OXFException { List<DCP> getCapDcps = new ArrayList<DCP>(); List<DCP> desCovDcps = new ArrayList<DCP>(); List<DCP> getCovDcps = new ArrayList<DCP>(); net.opengis.ows.x11.OperationDocument.Operation[] opsArray = capDoc.getCapabilities().getOperationsMetadata().getOperationArray(); for (net.opengis.ows.x11.OperationDocument.Operation op : opsArray) { if (op.getName().equalsIgnoreCase("GetCapabilities")) { getCapDcps.add(makeDCP(op)); } else if (op.getName().equalsIgnoreCase("GetCoverage")) { getCovDcps.add(makeDCP(op)); } else if (op.getName().equalsIgnoreCase("DescribeCoverage")) { desCovDcps.add(makeDCP(op)); } } // --- GetCapabilities-Operation: ---------------------------------------------------------- Parameter serviceParameter = new Parameter("SERVICE", true, new StringValueDomain("WCS"), null); Parameter getCapRequest = new Parameter("REQUEST", true, new StringValueDomain("GetCapabilities"), null); String[] versions = new String[] {"1.1.1"}; Parameter versionParameter = new Parameter("VERSION", true, new StringValueDomain(versions), null); Parameter section = new Parameter( "SECTION", false, new StringValueDomain( new String[] { "WCS_Capabilities/Service", "WCS_Capabilities/Capability", "WCS_Capabilities/ContentMetadata" }), null); Parameter[] getCapabilitiesParameters = new Parameter[] {versionParameter, serviceParameter, getCapRequest, section}; Operation opGetCapabilities = new Operation( "GetCapabilities", getCapabilitiesParameters, null, getCapDcps.toArray(new DCP[0])); // --- DescribeCoverage Operation ---------------------------------------------------------- Parameter descCovRequest = new Parameter("REQUEST", true, new StringValueDomain("DescribeCoverage"), null); // -------- Coverage-Namen raus-parsen: String[] covNames = new String[contents.getDataIdentificationCount()]; for (int i = 0; i < contents.getDataIdentificationCount(); i++) { covNames[i] = contents.getDataIdentification(i).getIdentifier(); } // -------- fertig Parameter coverageParameter = new Parameter( "COVERAGE", false, new StringValueDomain(covNames), Parameter.COMMON_NAME_RESOURCE_ID); Parameter[] describeCoverageParameters = new Parameter[] {versionParameter, serviceParameter, descCovRequest, coverageParameter}; Operation opDescribeCoverage = new Operation( "DescribeCoverage", describeCoverageParameters, null, desCovDcps.toArray(new DCP[0])); // --- GetCoverage Operation --------------------------------------------------------------- ArrayList<Parameter> getCoverageParameterList = new ArrayList<Parameter>(); Parameter getCovRequestParameter = new Parameter("REQUEST", true, new StringValueDomain("GetCoverage"), null); for (int i = 0; i < contents.getDataIdentificationCount(); i++) { String[] availableCRS = contents.getDataIdentification(i).getAvailableCRSs(); if (availableCRS != null) { getCoverageParameterList.add( new DatasetParameter( "CRS", true, new StringValueDomain(availableCRS), contents.getDataIdentification(i), Parameter.COMMON_NAME_SRS)); } for (int j = 0; j < contents.getDataIdentification(i).getBoundingBoxes().length; j++) { getCoverageParameterList.add( new DatasetParameter( "BBOX", true, contents.getDataIdentification(i).getBoundingBoxes()[j], contents.getDataIdentification(i), Parameter.COMMON_NAME_BBOX)); } TemporalValueDomain temporalDomain = (TemporalValueDomain) contents.getDataIdentification(i).getTemporalDomain(); if (temporalDomain != null) { getCoverageParameterList.add( new DatasetParameter( "TIME", true, temporalDomain, contents.getDataIdentification(i), Parameter.COMMON_NAME_TIME)); } ArrayList<String> formatList = new ArrayList<String>(); if (contents.getDataIdentification(i).getOutputFormats() != null) { for (int j = 0; j < contents.getDataIdentification(i).getOutputFormats().length; j++) { formatList.add(contents.getDataIdentification(i).getOutputFormats()[j]); } getCoverageParameterList.add( new DatasetParameter( "FORMAT", true, new StringValueDomain(formatList), contents.getDataIdentification(i), Parameter.COMMON_NAME_FORMAT)); } } // GridParameter // -------- GridParameter raus-parsen: String[] gridBaseCRSs = new String[contents.getDataIdentificationCount()]; String[] gridTypes = new String[contents.getDataIdentificationCount()]; String[] gridCSs = new String[contents.getDataIdentificationCount()]; for (int i = 0; i < contents.getDataIdentificationCount(); i++) { gridBaseCRSs[i] = ((CoverageDataset) contents.getDataIdentification(i)).getGridBaseCRS(); gridTypes[i] = ((CoverageDataset) contents.getDataIdentification(i)).getGridType(); gridCSs[i] = ((CoverageDataset) contents.getDataIdentification(i)).getGridCS(); } Parameter gridBaseCRS = new Parameter("GRIDBASECRS", true, new StringValueDomain(gridBaseCRSs), null); Parameter gridType = new Parameter("GRIDTYPE", true, new StringValueDomain(gridTypes), null); Parameter gridCS = new Parameter("GRIDCS", true, new StringValueDomain(gridCSs), null); Parameter gridOrigin = new Parameter("GRIDORIGIN", true, new StringValueDomain(), null); Parameter gridOffsets = new Parameter("GRIDOFFSETS", true, new StringValueDomain(), null); Parameter widthParameter = new Parameter( "WIDTH", true, new IntegerRangeValueDomain(0, Integer.MAX_VALUE), Parameter.COMMON_NAME_WIDTH); Parameter heightParameter = new Parameter( "HEIGHT", true, new IntegerRangeValueDomain(0, Integer.MAX_VALUE), Parameter.COMMON_NAME_HEIGHT); getCoverageParameterList.add(versionParameter); getCoverageParameterList.add(serviceParameter); getCoverageParameterList.add(getCovRequestParameter); getCoverageParameterList.add(coverageParameter); getCoverageParameterList.add(gridBaseCRS); getCoverageParameterList.add(gridType); getCoverageParameterList.add(gridCS); getCoverageParameterList.add(gridOffsets); getCoverageParameterList.add(gridOrigin); getCoverageParameterList.add(widthParameter); getCoverageParameterList.add(heightParameter); Parameter[] getCoverageParameters = new Parameter[getCoverageParameterList.size()]; getCoverageParameterList.toArray(getCoverageParameters); Operation opGetCoverage = new Operation("GetCoverage", getCoverageParameters, null, getCovDcps.toArray(new DCP[0])); Operation[] ops = new Operation[] {opGetCapabilities, opDescribeCoverage, opGetCoverage}; OperationsMetadata om = new OperationsMetadata(ops); return om; }
/** Supports WCS 1.1.1 */ public ServiceProvider mapServiceProvider(CapabilitiesDocument capDoc) { Contact contact; ServiceContact serviceContact; String providerName = capDoc.getCapabilities().getServiceProvider().getProviderName(); String individualName = capDoc.getCapabilities().getServiceProvider().getServiceContact().getIndividualName(); String positionName = capDoc.getCapabilities().getServiceProvider().getServiceContact().getPositionName(); String city = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getAddress() .getCity(); String country = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getAddress() .getCountry(); String administrativeArea = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getAddress() .getAdministrativeArea(); String postalCode = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getAddress() .getPostalCode(); String[] deliveryPoint = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getAddress() .getDeliveryPointArray(); String[] mailAdress = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getAddress() .getElectronicMailAddressArray(); // TODO: check if organisation Name ist available String organisationName = providerName; Address address = new Address(city, administrativeArea, postalCode, country, deliveryPoint, mailAdress); String[] telephone = capDoc .getCapabilities() .getServiceProvider() .getServiceContact() .getContactInfo() .getPhone() .getVoiceArray(); OnlineResource onlineResource = new OnlineResource( "http://www.onlineresource.de/hardcoded URL changes this WCSCapabilitiesMapper.java"); // OnlineResource onlineResource = new // OnlineResource(capDoc.getCapabilities().getServiceProvider().getServiceContact().getContactInfo().getOnlineResource().getHref()); contact = new Contact(telephone, null, null, null, address, onlineResource); serviceContact = new ServiceContact(individualName, organisationName, positionName, contact); ServiceProvider sp = new ServiceProvider(providerName, serviceContact); return sp; }