Package com.esri.core.geometry.ogc

Examples of com.esri.core.geometry.ogc.OGCGeometry.asText()


  public void testGeometryCollectionBuffer() {
    OGCGeometry g = OGCGeometry
        .fromText("GEOMETRYCOLLECTION(POINT(1 1), POINT(1 1), POINT(1 2), LINESTRING (0 0, 1 1, 1 0, 0 1), MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY)");
    OGCGeometry simpleG = g.buffer(0);
    String t = simpleG.geometryType();
    String rt = simpleG.asText();
    assertTrue(simpleG.geometryType().equals("GeometryCollection"));
  }

  @Test
  public void testIsectTria1() {
View Full Code Here


    g1.setSpatialReference(SpatialReference.create(4326));
    OGCGeometry rslt = g0.intersection(g1);
    assertTrue(rslt != null);
    assertTrue(rslt.geometryType().equals("Polygon"));
    assertTrue(rslt.esriSR.getID() == 4326);
    String s = rslt.asText();
  }

  @Test
  public void testIsectTriaJson1() throws JsonParseException, IOException {
    String json1 = "{\"rings\":[[[1, 0], [3, 0], [1, 2], [1, 0]]], \"spatialReference\":{\"wkid\":4326}}";
View Full Code Here

    g1.setSpatialReference(null);
    OGCGeometry rslt = g0.intersection(g1);
    assertTrue(rslt != null);
    assertTrue(rslt.dimension() == 1);
    assertTrue(rslt.geometryType().equals("LineString"));
    String s = rslt.asText();
  }

  @Test
  public void testIsectTria3() {
    String wkt = "polygon((1 0, 3 0, 1 2, 1 0))";
View Full Code Here

    OGCGeometry rslt = g0.intersection(g1);
    assertTrue(rslt != null);
    assertTrue(rslt.dimension() == 0);
    assertTrue(rslt.geometryType().equals("Point"));
    assertTrue(rslt.esriSR.getID() == 4326);
    String s = rslt.asText();
  }

  @Test
  public void testMultiPointSinglePoint() {
    String wkt = "multipoint((1 0))";
View Full Code Here

    String gt = g0.geometryType();
    assertTrue(gt.equals("MultiPoint"));
    OGCMultiPoint mp = (OGCMultiPoint)g0;
    assertTrue(mp.numGeometries() == 1);
    OGCGeometry p = mp.geometryN(0);
    String s = p.asText();
    assertTrue(s.equals("POINT (1 0)"));
   
    String ms = p.convertToMulti().asText();
    assertTrue(ms.equals("MULTIPOINT ((1 0))"));
   
View Full Code Here

    assertTrue(gc2.geometryN(2).geometryType().equals("LineString"));
    assertTrue(gc2.geometryN(3).geometryType().equals("MultiPolygon"));
    assertTrue(gc2.geometryN(4).geometryType().equals("MultiLineString"));
    assertTrue(gc2.geometryN(5).geometryType().equals("MultiPoint"));

    String wktString = g.asText();
    assertTrue(wktString
        .equals("GEOMETRYCOLLECTION (POLYGON EMPTY, POINT (1 1), GEOMETRYCOLLECTION EMPTY, LINESTRING EMPTY, GEOMETRYCOLLECTION (POLYGON EMPTY, POINT (1 1), LINESTRING EMPTY, MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY, MULTIPOINT EMPTY), MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY)"));

    g = OGCGeometry
        .fromGeoJson("{\"type\" : \"GeometryCollection\", \"geometries\" : [{\"type\" : \"Polygon\", \"coordinates\" : []}, {\"type\" : \"Point\", \"coordinates\" : [1, 1]}, {\"type\" : \"GeometryCollection\", \"geometries\" : []}, {\"type\" : \"LineString\", \"coordinates\" : []}, {\"type\" : \"GeometryCollection\", \"geometries\" : [{\"type\": \"Polygon\", \"coordinates\" : []}, {\"type\" : \"Point\", \"coordinates\" : [1,1]}, {\"type\" : \"LineString\", \"coordinates\" : []}, {\"type\" : \"MultiPolygon\", \"coordinates\" : []}, {\"type\" : \"MultiLineString\", \"coordinates\" : []}, {\"type\" : \"MultiPoint\", \"coordinates\" : []}]}, {\"type\" : \"MultiPolygon\", \"coordinates\" : []}, {\"type\" : \"MultiLineString\", \"coordinates\" : []} ] }");
View Full Code Here

        .equals("GEOMETRYCOLLECTION (POLYGON EMPTY, POINT (1 1), GEOMETRYCOLLECTION EMPTY, LINESTRING EMPTY, GEOMETRYCOLLECTION (POLYGON EMPTY, POINT (1 1), LINESTRING EMPTY, MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY, MULTIPOINT EMPTY), MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY)"));

    g = OGCGeometry
        .fromGeoJson("{\"type\" : \"GeometryCollection\", \"geometries\" : [{\"type\" : \"Polygon\", \"coordinates\" : []}, {\"type\" : \"Point\", \"coordinates\" : [1, 1]}, {\"type\" : \"GeometryCollection\", \"geometries\" : []}, {\"type\" : \"LineString\", \"coordinates\" : []}, {\"type\" : \"GeometryCollection\", \"geometries\" : [{\"type\": \"Polygon\", \"coordinates\" : []}, {\"type\" : \"Point\", \"coordinates\" : [1,1]}, {\"type\" : \"LineString\", \"coordinates\" : []}, {\"type\" : \"MultiPolygon\", \"coordinates\" : []}, {\"type\" : \"MultiLineString\", \"coordinates\" : []}, {\"type\" : \"MultiPoint\", \"coordinates\" : []}]}, {\"type\" : \"MultiPolygon\", \"coordinates\" : []}, {\"type\" : \"MultiLineString\", \"coordinates\" : []} ] }");

    wktString = g.asText();
    assertTrue(wktString
        .equals("GEOMETRYCOLLECTION (POLYGON EMPTY, POINT (1 1), GEOMETRYCOLLECTION EMPTY, LINESTRING EMPTY, GEOMETRYCOLLECTION (POLYGON EMPTY, POINT (1 1), LINESTRING EMPTY, MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY, MULTIPOINT EMPTY), MULTIPOLYGON EMPTY, MULTILINESTRING EMPTY)"));

  }
View Full Code Here

  public void testIntersection() {
    OGCGeometry g = OGCGeometry.fromText("LINESTRING(0 0, 10 10)");
    OGCGeometry g2 = OGCGeometry.fromText("LINESTRING(10 0, 0 10)");
    OGCGeometry u = g.intersection(g2);
    assertTrue(u.dimension() == 0);
    String s = u.asText();
    assertTrue(u.equals(OGCGeometry.fromText("POINT(5 5)")));
  }

  @Test
  public void testPointSymDif() {
View Full Code Here

        OGCGeometry g = OGCGeometry.fromJson(s);
        boolean res = g.isSimple();
        assertTrue(!res);
        Geometry resg = OperatorSimplifyOGC.local().execute(g.getEsriGeometry(), null, true, null);
        OGCGeometry og = OGCGeometry.createFromEsriGeometry(resg, null);
        String res_str = og.asText();
        assertTrue(og.isSimple());
      }     
      {
        String s = "{\"rings\":[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]}";
        OGCGeometry g = OGCGeometry.fromJson(s);
View Full Code Here

        boolean res = g.isSimple();
        assertTrue(res);
        assertTrue(g.isSimpleRelaxed());
        Geometry resg = OperatorSimplifyOGC.local().execute(g.getEsriGeometry(), null, true, null);
        OGCGeometry og = OGCGeometry.createFromEsriGeometry(resg, null);
        String res_str = og.asText();
        assertTrue(og.geometryType().equals("Polygon"));
        assertTrue(((OGCPolygon)og).numInteriorRing() == 0);
        assertTrue(og.isSimple());
      }
View Full Code Here

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.