Package com.vividsolutions.jts.io

Examples of com.vividsolutions.jts.io.WKTWriter


                    SimpleFeature sf = (SimpleFeature) feature;
                    String fileName = (String) sf.getAttribute("location");
                    int idx = fileName.lastIndexOf(".");
                    Geometry g = (Geometry) sf.getDefaultGeometry();
                    File wkbFile = new File(testMosaic, fileName.substring(0, idx) + ".wkt");
                    String wkt = new WKTWriter().write(g);
                    FileUtils.writeStringToFile(wkbFile, wkt);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
View Full Code Here


  }
 
  // Protected methods
 
  protected void encodeGeometryShape(Geometry geometry, PropertyContainer container) {
        WKTWriter writer = new WKTWriter();
        container.setProperty(geomProperty, writer.write(geometry));
  }
View Full Code Here

    public void testToStringObject()
    {
        Point point = new Point(4.5, 6.3);
        String pointStr = pa.toString(point);

        WKTWriter writer = new WKTWriter();
        String wktStr = writer.write(point);

        Assert.assertEquals(wktStr, pointStr);
    }
View Full Code Here

     */
    @Test
    public void testFromString()
    {
        Point point = new Point(4.5, 6.3);
        WKTWriter writer = new WKTWriter();
        String wktStr = writer.write(point);

        Point point2 = pa.fromString(com.vividsolutions.jts.geom.Point.class, wktStr);

        Assert.assertNotNull(point2);
        Assert.assertEquals(point.getX(), point2.getX());
View Full Code Here

        try {
            Geometry g = (Geometry) value;
            if (g instanceof LinearRing) {
                g = g.getFactory().createLineString(((LinearRing)g).getCoordinateSequence());
            }
            new WKTWriter().write(g, w);
        } finally {
            w.flush();
        }
    }
View Full Code Here

                for (Property prop : properties) {
                    Object value = prop.getValue();
                    if (value instanceof Geometry) {
                      //use wkt writer to convert geometry to string, so third dimension can be supported if present.
                      Geometry geom = (Geometry) value;
                      value = new WKTWriter(geom.getCoordinate().z == Double.NaN? 2 : 3).write(geom);
                    }
                    if (value == null || value.toString().equalsIgnoreCase("null")) {
                        values[valueIndex] = "null";
                    } else if (prop.getType() instanceof GeometryType) {
                        int srid = getSrid(((GeometryType) prop.getType()));
View Full Code Here

                for (Property prop : properties) {
                    Object value = prop.getValue();
                    if (value instanceof Geometry) {
                      //use wkt writer to convert geometry to string, so third dimension can be supported if present.
                      Geometry geom = (Geometry) value;
                      value = new WKTWriter(geom.getCoordinate().z == Double.NaN? 2 : 3).write(geom);
                    }
                    if (value == null || value.toString().equalsIgnoreCase("null")) {
                        values[valueIndex] = "null";
                    } else if (prop.getType() instanceof GeometryType) {
                        int srid = getSrid(((GeometryType) prop.getType()));
View Full Code Here

    @Override
    public void encode(Object value, OutputStream os) throws IOException {
        Writer w = new OutputStreamWriter(os);
        try {
            new WKTWriter().write((Geometry) value, w);
        } finally {
            w.flush();
        }
    }
View Full Code Here

   *  Features Specification.
   *
   *@return    the Well-known Text representation of this <code>Geometry</code>
   */
  public String toText() {
    WKTWriter writer = new WKTWriter();
    return writer.write(this);
  }
View Full Code Here

    System.out.println("Finished in " + sw.getTimeString());
  }

  private void printFormatted(Geometry geom)
  {
    WKTWriter writer = new WKTWriter();
    System.out.println(writer.writeFormatted(geom));
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.io.WKTWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.