Examples of WKTReader


Examples of com.vividsolutions.jts.io.WKTReader

    }
    String data = (String) object;
    int srid = Integer.parseInt(data.substring(0, SRID_LENGTH - 1));
    Geometry geom;
    try {
      WKTReader reader = new WKTReader();
      geom = reader.read(data.substring(SRID_LENGTH + 1));
    } catch (Exception e) {
      throw new RuntimeException("Couldn't parse incoming wkt geometry.", e);
    }
    geom.setSRID(srid);
    return geom;

Examples of com.vividsolutions.jts.io.WKTReader

    Assert.assertTrue((jts.getLength() - gwt.getLength()) < ZERO);
  }

  @Test
  public void toWkt() throws ParseException {
    WKTReader reader = new WKTReader();
    com.vividsolutions.jts.geom.Geometry result = reader.read(gwt.toWkt());
    Assert.assertEquals(gwt.getX(), result.getCoordinate().x, DELTA);
    Assert.assertEquals(gwt.getY(), result.getCoordinate().y, DELTA);

    Assert.assertEquals("POINT(EMPTY)", empty.toWkt());
  }

Examples of com.vividsolutions.jts.io.WKTReader

    Assert.assertTrue((jts.getLength() - gwt.getLength()) < ZERO);
  }

  @Test
  public void toWkt() throws Exception {
    WKTReader reader = new WKTReader();
    com.vividsolutions.jts.geom.Geometry result = reader.read(gwt.toWkt());
    Assert.assertEquals(gwt.getCoordinate().getX(), result.getCoordinate().x, DELTA);
    Assert.assertEquals(gwt.getCoordinate().getY(), result.getCoordinate().y, DELTA);
    Assert.assertEquals("LINESTRING(EMPTY)", empty.toWkt());
  }

Examples of com.vividsolutions.jts.io.WKTReader

    Assert.assertTrue((jts.getLength() - gwt.getLength()) < DELTA);
  }

  @Test
  public void toWkt() throws ParseException {
    WKTReader reader = new WKTReader();
    com.vividsolutions.jts.geom.Geometry result = reader.read(gwt.toWkt());
    Assert.assertEquals(gwt.getX(), result.getCoordinate().x, DELTA);
    Assert.assertEquals(gwt.getY(), result.getCoordinate().y, DELTA);

    Assert.assertEquals("POINT(EMPTY)", empty.toWkt());
  }

Examples of com.vividsolutions.jts.io.WKTReader

    // Assert.assertEquals(Double.MAX_VALUE, gwt.getDistance(null), DELTA);
  }

  @Test
  public void toWkt() throws ParseException {
    WKTReader reader = new WKTReader();
    com.vividsolutions.jts.geom.Geometry result = reader.read(gwt.toWkt());
    Assert.assertEquals(gwt.getCoordinate().getX(), result.getCoordinate().x, DELTA);
    Assert.assertEquals(gwt.getCoordinate().getY(), result.getCoordinate().y, DELTA);

    Assert.assertEquals("LINESTRING(EMPTY)", empty.toWkt());
  }

Examples of com.vividsolutions.jts.io.WKTReader

  }

  void run()
      throws Exception
  {
    WKTReader rdr = new WKTReader();
    Collection lines = new ArrayList();

    lines.add(rdr.read("LINESTRING (0 0 , 10 10)"));   // isolated edge
    lines.add(rdr.read("LINESTRING (185 221, 100 100)"));   //dangling edge
    lines.add(rdr.read("LINESTRING (185 221, 88 275, 180 316)"));
    lines.add(rdr.read("LINESTRING (185 221, 292 281, 180 316)"));
    lines.add(rdr.read("LINESTRING (189 98, 83 187, 185 221)"));
    lines.add(rdr.read("LINESTRING (189 98, 325 168, 185 221)"));

    Polygonizer polygonizer = new Polygonizer();
    polygonizer.add(lines);

    Collection polys = polygonizer.getPolygons();

Examples of com.vividsolutions.jts.io.WKTReader

public class PolygonUnionUsingBuffer {

  public static void main(String[] args)
      throws Exception
  {
    WKTReader rdr = new WKTReader();

    Geometry[] geom = new Geometry[3];
    geom[0] = rdr.read("POLYGON (( 100 180, 100 260, 180 260, 180 180, 100 180 ))");
    geom[1] = rdr.read("POLYGON (( 80 140, 80 200, 200 200, 200 140, 80 140 ))");
    geom[2] = rdr.read("POLYGON (( 160 160, 160 240, 240 240, 240 160, 160 160 ))");
    unionUsingBuffer(geom);

  }

Examples of com.vividsolutions.jts.io.WKTReader

public class LineStringSelfIntersections {

  public static void main(String[] args)
      throws Exception
  {
    WKTReader rdr = new WKTReader();

    LineString line1 = (LineString) (rdr.read("LINESTRING (0 0, 10 10, 20 20)"));
    showSelfIntersections(line1);
    LineString line2 = (LineString) (rdr.read("LINESTRING (0 40, 60 40, 60 0, 20 0, 20 60)"));
    showSelfIntersections(line2);

  }

Examples of com.vividsolutions.jts.io.WKTReader

{
  public static void main(String[] args)
      throws Exception
  {
    // read a geometry from a WKT string (using the default geometry factory)
    Geometry g1 = new WKTReader().read("LINESTRING (0 0, 10 10, 20 20)");
    System.out.println("Geometry 1: " + g1);

    // create a geometry by specifying the coordinates directly
    Coordinate[] coordinates = new Coordinate[]{new Coordinate(0, 0),
      new Coordinate(10, 10), new Coordinate(20, 20)};

Examples of com.vividsolutions.jts.io.WKTReader

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        Geometry geom = null;
        if (value != null) {
            try {
                WKTReader reader = new WKTReader();
                geom = reader.read(value);
                geom.setSRID(4326);
            } catch (ParseException ex) {
                Logger.getLogger(GeometryConverter.class.getName()).log(Level.SEVERE, null, ex);
            }
TOP
Copyright © 2018 www.massapi.com. 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.