protected void handleKeywords(List kwords) { start("ows:Keywords"); if (kwords != null) { for (Iterator it = kwords.iterator(); it.hasNext(); ) { element("ows:Keyword", it.next().toString()); } } end("ows:Keywords"); }
private void handleKeywords(List kwords) { start("ows:Keywords"); if (kwords != null) { for (Iterator it = kwords.iterator(); it.hasNext();) { element("ows:Keyword", it.next().toString()); } } end("ows:Keywords"); }
private void handleInterpolationMethods(CoverageInfo ci) { start("wcs:InterpolationMethods"); for (Iterator it = ci.getInterpolationMethods().iterator(); it.hasNext();) { String method = (String) it.next(); String converted = METHOD_NAME_MAP.get(method); if (converted != null) element("wcs:InterpolationMethod", converted); } elementIfNotEmpty("wcs:Default", ci.getDefaultInterpolationMethod()); end("wcs:InterpolationMethods"); }
end("wcs:CoverageDescriptions");
end("wcs:CoverageDescriptions");
.append(encodedEnvelope.getUpperCorner().getOrdinate(1)) .toString()); end("ows:BoundingBox");
private void handleGridCRS(CoverageInfo ci) throws Exception { start("wcs:GridCRS"); element("wcs:GridBaseCRS", urnIdentifier(ci.getCrs())); element("wcs:GridType", GridType.GT2dGridIn2dCrs.getXmlConstant()); // TODO: go back to using the metadata once they can be trusted final LinearTransform tx = (LinearTransform) ci.getGrid().getGridToCRS(); final Matrix matrix = tx.getMatrix(); // origin StringBuffer origins = new StringBuffer(); for (int i = 0; i < matrix.getNumRow() - 1; i++) { origins.append(matrix.getElement(i, matrix.getNumCol() - 1)); if (i < matrix.getNumRow() - 2) origins.append(" "); } element("wcs:GridOrigin", origins.toString()); // offsets StringBuffer offsets = new StringBuffer(); for (int i = 0; i < matrix.getNumRow() - 1; i++) { for (int j = 0; j < matrix.getNumCol() - 1; j++) { offsets.append(matrix.getElement(i, j)); if (j < matrix.getNumCol() - 2) offsets.append(" "); } if (i < matrix.getNumRow() - 2) offsets.append(" "); } element("wcs:GridOffsets", offsets.toString()); element("wcs:GridCS", "urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS"); end("wcs:GridCRS"); }
private void handleRange(CoverageInfo ci) { start("wcs:Range"); // at the moment we only handle single field coverages start("wcs:Field"); CoverageDimension[] dimensions = ci.getDimensions(); element("wcs:Identifier", "contents"); // the output domain of the field start("wcs:Definition"); NumberRange range = getCoverageRange(dimensions); if (range == null || range.isEmpty()) { element("wcs:AnyValue", ""); } else { start("ows:AllowedValues"); start("ows:Range"); element("ows:MinimumValue", Double.toString(range.getMinimum())); element("ows:MaximumValue", Double.toString(range.getMaximum())); end("ows:Range"); end("ows:AllowedValues"); } end("wcs:Definition"); handleNullValues(dimensions); handleInterpolationMethods(ci); handleAxis(ci); end("wcs:Field"); end("wcs:Range"); }
protected void handleGridCRS(CoverageInfo ci) throws Exception { start("wcs:GridCRS"); element("wcs:GridBaseCRS", urnIdentifier(ci.getCRS())); element("wcs:GridType", GridType.GT2dGridIn2dCrs.getXmlConstant()); // TODO: go back to using the metadata once they can be trusted final LinearTransform tx = (LinearTransform) ci.getGrid().getGridToCRS(); final Matrix matrix = tx.getMatrix(); // origin StringBuffer origins = new StringBuffer(); for (int i = 0; i < matrix.getNumRow() - 1; i++) { origins.append(matrix.getElement(i, matrix.getNumCol() - 1)); if (i < matrix.getNumRow() - 2) origins.append(" "); } element("wcs:GridOrigin", origins.toString()); // offsets StringBuffer offsets = new StringBuffer(); for (int i = 0; i < matrix.getNumRow() - 1; i++) { for (int j = 0; j < matrix.getNumCol() - 1; j++) { offsets.append(matrix.getElement(i, j)); if (j < matrix.getNumCol() - 2) offsets.append(" "); } if (i < matrix.getNumRow() - 2) offsets.append(" "); } element("wcs:GridOffsets", offsets.toString()); element("wcs:GridCS", "urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS"); end("wcs:GridCRS"); }
protected void handleRange(CoverageInfo ci) { start("wcs:Range"); // at the moment we only handle single field coverages start("wcs:Field"); List<CoverageDimensionInfo> dimensions = ci.getDimensions(); element("wcs:Identifier", "contents"); // the output domain of the field start("wcs:Definition"); NumberRange range = getCoverageRange(dimensions); if (range == null || range.isEmpty()) { element("ows:AnyValue", ""); } else { start("ows:AllowedValues"); start("ows:Range"); element("ows:MinimumValue", Double.toString(range.getMinimum())); element("ows:MaximumValue", Double.toString(range.getMaximum())); end("ows:Range"); end("ows:AllowedValues"); } end("wcs:Definition"); handleNullValues(dimensions); handleInterpolationMethods(ci); handleAxis(ci); end("wcs:Field"); end("wcs:Range"); }
private void handleBoundingBox(GeneralEnvelope envelope, boolean wgsLonLat) throws Exception { final AttributesImpl attributes = new AttributesImpl(); final CoordinateReferenceSystem crs = envelope.getCoordinateReferenceSystem(); GeneralEnvelope encodedEnvelope = envelope; if (wgsLonLat) { attributes.addAttribute("", "crs", "crs", "", "urn:ogc:def:crs:OGC:1.3:CRS84"); } else { String urnIdentifier = urnIdentifier(crs); CoordinateReferenceSystem latlonCrs = CRS.decode(urnIdentifier); encodedEnvelope = CRS.transform(CRS.findMathTransform(crs, latlonCrs, true), envelope); attributes.addAttribute("", "crs", "crs", "", urnIdentifier); } attributes.addAttribute("", "dimensions", "dimensions", "", Integer.toString(crs .getCoordinateSystem().getDimension())); start("ows:BoundingBox", attributes); element("ows:LowerCorner", new StringBuffer(Double.toString(encodedEnvelope .getLowerCorner().getOrdinate(0))).append(" ").append( encodedEnvelope.getLowerCorner().getOrdinate(1)).toString()); element("ows:UpperCorner", new StringBuffer(Double.toString(encodedEnvelope .getUpperCorner().getOrdinate(0))).append(" ").append( encodedEnvelope.getUpperCorner().getOrdinate(1)).toString()); end("ows:BoundingBox"); }
protected void handleCoverageDescription(CoverageInfo ci) throws Exception { start("wcs:CoverageDescription"); element("ows:Title", ci.getTitle()); element("ows:Abstract", ci.getDescription()); handleKeywords(ci.getKeywords()); element("wcs:Identifier", ci.getStore().getWorkspace().getName() + ":" + ci.getName()); handleMetadataLinks(ci.getMetadataLinks(), "simple"); handleDomain(ci); handleRange(ci); handleSupportedCRSs(ci); handleSupportedFormats(ci); end("wcs:CoverageDescription"); }
protected void handleInterpolationMethods(CoverageInfo ci) { start("wcs:InterpolationMethods"); for (Iterator it = ci.getInterpolationMethods().iterator(); it.hasNext(); ) { String method = (String) it.next(); String converted = METHOD_NAME_MAP.get(method); if (converted != null) element("wcs:InterpolationMethod", converted); } elementIfNotEmpty("wcs:Default", ci.getDefaultInterpolationMethod()); end("wcs:InterpolationMethods"); }
protected void handleAxis(CoverageInfo ci) { final AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "identifier", "identifier", "", "Bands"); start("wcs:Axis", attributes); start("wcs:AvailableKeys"); List<CoverageDimensionInfo> dimensions = ci.getDimensions(); for (CoverageDimensionInfo cd : dimensions) { element("wcs:Key", cd.getName().replace(' ', '_')); } end("wcs:AvailableKeys"); end("wcs:Axis"); }
void handleCoverageDescription(CoverageInfo ci) throws Exception { start("wcs:CoverageDescription"); element("ows:Title", ci.getLabel()); element("ows:Abstract", ci.getDescription()); handleKeywords(ci.getKeywords()); element("wcs:Identifier", ci.getName()); handleMetadataLink(ci.getMetadataLink(), "simple"); handleDomain(ci); handleRange(ci); handleSupportedCRSs(ci); handleSupportedFormats(ci); end("wcs:CoverageDescription"); }
private void handleAxis(CoverageInfo ci) { final AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "identifier", "identifier", "", "Bands"); start("wcs:Axis", attributes); start("wcs:AvailableKeys"); CoverageDimension[] dimensions = ci.getDimensions(); for (int i = 0; i < dimensions.length; i++) { element("wcs:Key", dimensions[i].getName().replace(' ', '_')); } end("wcs:AvailableKeys"); end("wcs:Axis"); }