Examples of WKTReader


Examples of com.vividsolutions.jts.io.WKTReader

    public void testTemplate() throws Exception {
        SimpleFeatureType ft = DataUtilities.createType("bridges",
                "the_geom:Point,FID:String,NAME:String");

        WKTReader reader = new WKTReader();
        SimpleFeatureBuilder sb = new SimpleFeatureBuilder(ft);
        sb.set("the_geom", reader.read("POINT(10 10)"));
        sb.set("FID", "Fid001");
        sb.set("NAME", "Pluto");
        SimpleFeature f = sb.buildFeature("fidxxx");

        String template = "Hello this is ${FID.value} my name is ${NAME.value}";

Examples of com.vividsolutions.jts.io.WKTReader

        }
        w.write();
    }
   
    Geometry geometry( String wkt, int srid ) throws Exception {
        Geometry g = new WKTReader().read( wkt );
        g.setUserData( CRS.decode( "EPSG:" + srid ) );
        return g;
    }

Examples of com.vividsolutions.jts.io.WKTReader

                return "oaks";
            }
        };

        SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(type);
        WKTReader reader = new WKTReader();
        sfb.set("the_geom", reader.read("POINT (0.002 0.0008)"));
        sfb.set("FID", "023");
        sfb.set("NAME", "Old oak");
        SimpleFeature feature = sfb.buildFeature(null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> fc = DataUtilities.collection(feature);

Examples of com.vividsolutions.jts.io.WKTReader

        assertTrue("Feature id has not been renamed, it's still " + sf.getID(), sf.getID()
                .startsWith(RENAMED));
       
        // check mappings occurred
        assertEquals("description-f001", sf.getAttribute("description"));
        assertTrue(new WKTReader().read("MULTIPOINT(39.73245 2.00342)").equalsExact(
            (Geometry) sf.getAttribute("pointProperty")));
        assertEquals(new Long(155), sf.getAttribute("intProperty"));
        assertNull(sf.getAttribute("newProperty"));
    }

Examples of com.vividsolutions.jts.io.WKTReader

                return "oaks";
            }
        };

        SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(type);
        WKTReader reader = new WKTReader();
        sfb.set("the_geom", reader.read("POINT (0.002 0.0008)"));
        sfb.set("FID", "023");
        sfb.set("NAME", "Old oak");
        SimpleFeature feature = sfb.buildFeature(null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> fc = DataUtilities.collection(feature);

Examples of com.vividsolutions.jts.io.WKTReader

                entry("LINESTRING(-90 -45, 90 45)") };
        return entries;
    }

    private static Geometry entry(final String wkt) throws ParseException {
        Geometry geometry = new WKTReader().read(wkt);
        return geometry;
    }

Examples of com.vividsolutions.jts.io.WKTReader

        wktPoint = v.toText();
        return v.toText();
    }

    public Point marshal(String v) {
        WKTReader fromText = new WKTReader();
        Geometry geom = null;
        Point p = null;
        try {
         geom = (Point) fromText.read(wktPoint);
        } catch (ParseException pe) {
            throw new RuntimeException("Not a WKT string" + wktPoint);
        }
        if(!geom.getGeometryType().equals("Point")) {
            throw new RuntimeException("Geometry must be a Point"+geom.getGeometryType());

Examples of com.vividsolutions.jts.io.WKTReader

            String industrialZoneBlockLength = r.getString(12);
            String residentialZoneBlockLength = r.getString(13);
            String gpsTaggingTolerance = r.getString(14);
           
            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            fetched = new StudyRegion();
            fetched.setId(id);
            fetched.setName(name);
            fetched.setDescription(description);
            fetched.setCurrentRegion(currentRegion);
            fetched.setMapZoomLevel(mapZoomLevel);
            fetched.setDefaultZoneType(defaultZoneType);
            fetched.setUtcOffset(utcOffset);
            fetched.setMinimumSoakInterval(minimumSoakInterval);
            fetched.setCommercialZoneBlockLength(commercialZoneBlockLength);
            fetched.setIndustrialZoneBlockLength(industrialZoneBlockLength);
            fetched.setResidentialZoneBlockLength(residentialZoneBlockLength);
            fetched.setGpsTaggingTolerance(gpsTaggingTolerance);
           
            // now convert the geometry to an ArrayList<Vertex> and
            // set in the roadDetails
            ArrayList<Vertex> vertices = Utils.geometryToVertexArrayList(geometry);
            fetched.setVertices(vertices);
           
            // convert the centroid point into a Vertex
            Vertex centroid = new Vertex();
            centroid.setLat(centroidJTS.getY());
            centroid.setLng(centroidJTS.getX());
            fetched.setCentroid(centroid);
           
            // and get the map meta data too
            Geometry mapCenterGeom = reader.read(mapCenterWKT);
            Point mapCenterJTS = mapCenterGeom.getCentroid();
            Vertex mapCenterVertex = new Vertex();
            mapCenterVertex.setLat(mapCenterJTS.getY());
            mapCenterVertex.setLng(mapCenterJTS.getX());
            fetched.setMapCenter(mapCenterVertex);

Examples of com.vividsolutions.jts.io.WKTReader

            String industrialZoneBlockLength = r.getString(12);
            String residentialZoneBlockLength = r.getString(13);
            String gpsTaggingTolerance = r.getString(14);
           
            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            StudyRegion studyRegion = new StudyRegion();
            studyRegion.setId(id);
            studyRegion.setName(name);
            studyRegion.setDescription(description);
            studyRegion.setCurrentRegion(currentRegion);
            studyRegion.setMapZoomLevel(mapZoomLevel);
            studyRegion.setDefaultZoneType(defaultZoneType);
            studyRegion.setUtcOffset(utcOffset);
            studyRegion.setMinimumSoakInterval(minimumSoakInterval);
            studyRegion.setCommercialZoneBlockLength(commercialZoneBlockLength);
            studyRegion.setIndustrialZoneBlockLength(industrialZoneBlockLength);
            studyRegion.setResidentialZoneBlockLength(residentialZoneBlockLength);
            studyRegion.setGpsTaggingTolerance(gpsTaggingTolerance);
           
            // now convert the geometry to an ArrayList<Vertex> and
            // set in the roadDetails
            ArrayList<Vertex> vertices = Utils.geometryToVertexArrayList(geometry);
            studyRegion.setVertices(vertices);
           
            // convert the centroid point into a Vertex
            Vertex centroid = new Vertex();
            centroid.setLat(centroidJTS.getY());
            centroid.setLng(centroidJTS.getX());
            studyRegion.setCentroid(centroid);
           
            // and get the map meta data too
            Geometry mapCenterGeom = reader.read(mapCenterWKT);
            Point mapCenterJTS = mapCenterGeom.getCentroid();
            Vertex mapCenterVertex = new Vertex();
            mapCenterVertex.setLat(mapCenterJTS.getY());
            mapCenterVertex.setLng(mapCenterJTS.getX());
            studyRegion.setMapCenter(mapCenterVertex);

Examples of com.vividsolutions.jts.io.WKTReader

            String regionId = r.getString(4);
            String tagId = r.getString(5);
            String lineString = r.getString(6);
           
            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            RoadDetails roadDetails = new RoadDetails();
            roadDetails.setId(id);
            roadDetails.setName(name);
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.