Examples of WKTReader2


Examples of org.geotools.geometry.jts.WKTReader2

public void wktCurve() throws Exception{
    // wktCurve start
    GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    CurvedGeometryFactory curvedfactory = new CurvedGeometryFactory(Double.MAX_VALUE);
   
    WKTReader2 reader = new WKTReader2(curvedfactory);
    CircularString arc = (CircularString) reader.read("CIRCULARSTRING(10 14,6 10,14 10)");
    // wktCurve end   
}
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

private void transformExample() throws Exception {
    // transformExample start
    SimpleFeatureType TYPE = DataUtilities.createType("urn:org.geotools.xml.examples", "location", "geom:Point,name:String");
    TYPE.getUserData().put("prefix", "ex");
   
    WKTReader2 wkt = new WKTReader2();
    List<SimpleFeature> collection = new LinkedList<SimpleFeature>();
    collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (1 2)"), "name1" }, null));
    collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (4 4)"), "name2" }, null));

    SimpleFeatureCollection featureCollection = new ListFeatureCollection(TYPE, collection);
 
    FeatureTransformer transform = new FeatureTransformer();
    transform.setEncoding(Charset.defaultCharset());
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

    @Test
    public void testEncodeGML2Legacy() throws Exception {
        SimpleFeatureType TYPE = DataUtilities.createType("Location", "geom:Point,name:String");

        DefaultFeatureCollection collection = new DefaultFeatureCollection();
        WKTReader2 wkt = new WKTReader2();

        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (1 2)"),
                "name1" }, null));
        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (4 4)"),
                "name2" }, null));

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        GML encode = new GML(Version.GML2);
        encode.setNamespace("Location", "http://localhost/Location.xsd");
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        encode.encode(out, TYPE);

        out.close();

        DefaultFeatureCollection collection = new DefaultFeatureCollection();
        WKTReader2 wkt = new WKTReader2();

        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (1 2)"),
                "name1" }, null));
        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (4 4)"),
                "name2" }, null));

        ByteArrayOutputStream out2 = new ByteArrayOutputStream();
        GML encode2 = new GML(Version.GML2);
        encode2.setBaseURL(baseURL);
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        tb.add("name", String.class);

        SimpleFeatureType TYPE = tb.buildFeatureType();

        DefaultFeatureCollection collection = new DefaultFeatureCollection();
        WKTReader2 wkt = new WKTReader2();
        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (1 2)"),
                "name1" }, null));
        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (4 4)"),
                "name2" }, null));

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        GML encode = new GML(Version.WFS1_0);
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        tb.add("name", String.class);

        SimpleFeatureType TYPE = tb.buildFeatureType();

        DefaultFeatureCollection collection = new DefaultFeatureCollection();
        WKTReader2 wkt = new WKTReader2();
        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (1 2)"),
                "name1" }, null));
        collection.add(SimpleFeatureBuilder.build(TYPE, new Object[] { wkt.read("POINT (4 4)"),
                "name2" }, null));

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        GML encode = new GML(Version.WFS1_1);
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        String typeName, Query query) throws IOException {
      PropertyFeatureReader reader = new PropertyFeatureReader(directory, typeName);
      Object toleranceHint = query.getHints().get(Hints.LINEARIZATION_TOLERANCE);
    if(toleranceHint instanceof Double) {
      double tolerance = (double) toleranceHint;
      reader.setWKTReader(new WKTReader2(tolerance));
    }
   
    return reader;
    }
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        // ROI object
        Polygon roi = (Polygon) new WKTReader2()
                .read("POLYGON ((0.0008993124415341 0.0006854377923293, 0.0008437876520112 0.0006283489242283, 0.0008566913002806 0.0005341131898971, 0.0009642217025257 0.0005188634237605, 0.0011198475210477 0.000574779232928, 0.0010932581852198 0.0006572843779233, 0.0008993124415341 0.0006854377923293))");

        FeatureTypeInfo ti = getCatalog().getFeatureTypeByName(getLayerId(MockData.BUILDINGS));
        SimpleFeatureCollection rawSource = (SimpleFeatureCollection) ti.getFeatureSource(null,
                null).getFeatures();
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);

        // test ROI
        Polygon roi = (Polygon) new WKTReader2()
                .read("POLYGON (( -127.57473954542964 54.06575021619523, -130.88669845369998 52.00807146727025, -129.50812897394974 49.85372324691927, -130.5300633861675 49.20465679591609, -129.25955033314003 48.60392508062591, -128.00975216684665 50.986137055052474, -125.8623089087404 48.63154492960477, -123.984159178178 50.68231871628503, -126.91186316993704 52.15307567440926, -125.3444367403868 53.54787804784162, -127.57473954542964 54.06575021619523 ))");
        roi.setSRID(4326);
        // ROI reprojection
        Polygon roiResampled = (Polygon) JTS.transform(
                roi,
View Full Code Here

Examples of org.geotools.geometry.jts.WKTReader2

        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        // ROI as polygon
        Polygon roi = (Polygon) new WKTReader2()
                .read("POLYGON (( -127.57473954542964 54.06575021619523, -130.8545966116691 52.00807146727025, -129.50812897394974 49.85372324691927, -130.5300633861675 49.20465679591609, -129.25955033314003 48.60392508062591, -128.00975216684665 50.986137055052474, -125.8623089087404 48.63154492960477, -123.984159178178 50.68231871628503, -126.91186316993704 52.15307567440926, -125.3444367403868 53.54787804784162, -127.57473954542964 54.06575021619523 ))");
        roi.setSRID(4326);

        try {
            // Download the data with ROI. It should throw an exception
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.