private void encodeGmlRssGeometry(Geometry g) { try { // get the proper element name QName elementName = null; if (g instanceof Polygon) { elementName = org.geotools.gml2.GML.Polygon; } else if (g instanceof MultiPoint) { elementName = org.geotools.gml2.GML.MultiPoint; } else { elementName = org.geotools.gml2.GML._Geometry; } // encode in GML3 Encoder encoder = new Encoder(GML_CONFIGURATION); encoder.setInline(true); encoder.setIndenting(true); encoder.encode(g, elementName, contentHandler); } catch (Exception e) { throw new RuntimeException("Cannot transform the specified geometry in GML", e); } }
fos = new FileOutputStream(target); Encoder encoder = new Encoder(cfg); encoder.setIndenting(true); encoder.setIndentSize(2); encoder.encode(gft, elementName, fos);
encoder.setIndenting(true); encoder.setIndentSize(2); encoder.setLineWidth(60);
encoder.setIndenting(true); encoder.setIndentSize(2); encoder.setLineWidth(60);
/** * Returns the xml encoding of the created request. * * @param version * @throws IOException */ public String asXML(String version) throws IOException { if ("1.1.1".equals(version)) { Encoder encoder = new Encoder(new org.geotools.wcs.v1_1.WCSConfiguration()); encoder.setIndenting(true); encoder.setOmitXMLDeclaration(true); // prefix is set to 'null' if we don't declare it explicitly encoder.getNamespaces().declarePrefix("ows", "http://www.opengis.net/ows/1.1"); return encoder.encodeAsString(wcs111GetCoverage, org.geotools.wcs.v1_1.WCS.GetCoverage); } else { Encoder encoder = new Encoder(new WCSConfiguration()); encoder.setIndenting(true); encoder.setOmitXMLDeclaration(true); return encoder.encodeAsString(getCoverageType, WCS.GetCoverage); } }