private void handleSupportedCRSs(CoverageInfo ci) throws Exception { Set supportedCRSs = new LinkedHashSet(); if (ci.getRequestCRSs() != null) supportedCRSs.addAll(ci.getRequestCRSs()); if (ci.getResponseCRSs() != null) supportedCRSs.addAll(ci.getResponseCRSs()); for (Iterator it = supportedCRSs.iterator(); it.hasNext();) { String crsName = (String) it.next(); CoordinateReferenceSystem crs = CRS.decode(crsName); element("wcs:SupportedCRS", urnIdentifier(crs)); element("wcs:SupportedCRS", crsName); } }
protected void handleSupportedCRSs(CoverageInfo ci) throws Exception { Set supportedCRSs = new LinkedHashSet(); if (ci.getRequestSRS() != null) supportedCRSs.addAll(ci.getRequestSRS()); if (ci.getResponseSRS() != null) supportedCRSs.addAll(ci.getResponseSRS()); for (Iterator it = supportedCRSs.iterator(); it.hasNext(); ) { String crsName = (String) it.next(); CoordinateReferenceSystem crs = CRS.decode(crsName); element("wcs:SupportedCRS", urnIdentifier(crs)); element("wcs:SupportedCRS", crsName); } }
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"); }
attributes.addAttribute("", "crs", "crs", "", "urn:ogc:def:crs:OGC:1.3:CRS84"); } else { String urnIdentifier = urnIdentifier(crs); CoordinateReferenceSystem latlonCrs = CRS.decode(urnIdentifier); encodedEnvelope = new ReferencedEnvelope(CRS.transform(encodedEnvelope, latlonCrs));
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"); }
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"); }