public String toText() { return polygon.toText(); }
// build polygon p1 Polygon p1 = new GeometryFactory().createPolygon(new Coordinate[]{new Coordinate(0,0), new Coordinate(0,10), new Coordinate(10,10), new Coordinate(10,0), new Coordinate(0,0)}); // build polygon p2 Polygon p2 = new GeometryFactory().createPolygon(new Coordinate[]{new Coordinate(0,0), new Coordinate(0,30), new Coordinate(5,30), new Coordinate(5,0), new Coordinate(0,0)}); // calculate polygon3 as the union of p1 and p2 Polygon p3 = (Polygon) p1.union(p2); // print simple WKT System.out.println(p3.toText());
/** * Converts a boundingbox to a WKT-based string. * * @param bbox BoundingBox to convert to WKT. * @return WKT String. */ public static String bboxToWKT(BoundingBox bbox) { return JTS.toGeometry(bbox).toText(); }
holes.toArray(new LinearRing[holes.size()])).toText();
holes.toArray(new LinearRing[holes.size()])).toText();
.format(ErrorMessageKeys.OUTSIDE_CRS, jtsPolygon.toText()));
@Test public void testInstantiationWithGPF() throws GraphException { GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis(); GeometryFactory gf = new GeometryFactory(); Polygon polygon = gf.createPolygon(gf.createLinearRing(new Coordinate[]{ new Coordinate(-5, 5), new Coordinate(5, 5), new Coordinate(5, -5), new Coordinate(-5, -5), new Coordinate(-5, 5), }), null); HashMap<String, Object> parameters = new HashMap<>(); parameters.put("geoRegion", polygon.toText()); parameters.put("fullSwath", true); final Product sp = createTestProduct(100, 100); assertNotNull(sp.getGeoCoding()); Product tp = GPF.createProduct("Subset", parameters, sp); assertNotNull(tp); assertEquals(100, tp.getSceneRasterWidth()); assertEquals(50, tp.getSceneRasterHeight()); }
ErrorMessageKeys.OUTSIDE_CRS, jtsPolygon.toText()), new ErrorLocator(-1, -1, XMLUtils.buildXPointer(quad))); ErrorMessageKeys.RING_NOT_CCW, jtsPolygon.toText()), new ErrorLocator(-1, -1, XMLUtils.buildXPointer(quad))); ErrorMessageKeys.QUAD_NOT_CONVEX, jtsPolygon.toText()), new ErrorLocator(-1, -1, XMLUtils.buildXPointer(quad)));
String wkt = poly.toText(); args.add(new Pair(wkt, Types.VARCHAR)); args.add(new Pair(srid, Types.INTEGER));
.setValue(String.valueOf(dim1.height)); meg1PM.getAt(MeasurementGrid.PROP_BOUNDING_BOX) .setValue(JTS.toGeometry(bb1).toText()); meg1PM.getAt(MeasurementGrid.PROP_MEASUREMENTS) .setValue(new MeasurementsConverter().toString(val1));
newObsPM.getAt(Observation.PROP_BOUNDING_BOX).setValue(JTS.toGeometry(newObsEnvelope).toText());