Package com.vividsolutions.jts.io

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);


            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);

            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);

            String regionId = r.getString(4);
            String zoneType = 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();
           
            ZoneDetails zoneDetails = new ZoneDetails();
            zoneDetails.setId(id);
            zoneDetails.setName(name);

        Boolean.TRUE);
   
    if(fromSRID.equals(toSRID))
      return inGeomWKT;
   
    WKTReader reader = new WKTReader();
    Geometry JTSGeometry;
    try {
      JTSGeometry = reader.read(inGeomWKT);
    } catch (ParseException e1) {
      logger.error("Cannot read the input WKT feature!");
      return inGeomWKT;
    }

      ArrayList<Row> rows, Map<String, String> columnNameMap) {
    for (Row row : rows) {
      try {
        String posList = row.getNode(coordinateHNodeIds.get(0))
            .getValue().asString();
            WKTReader reader = new WKTReader();
            Polygon JTSPolygon = (Polygon)reader.read(posList);
            if(JTSPolygon == null) continue;
            polygons.add(JTSPolygon);
        FeatureTable featureTable = new FeatureTable();
        Collection<Node> nodes = row.getNodes();
        for (Node node : nodes) {

    for (Row row : rows) {
      try {
        String posList = row.getNode(coordinateHNodeIds.get(0))
            .getValue().asString();
       
            WKTReader reader = new WKTReader();
           
            LineString JTSLine = (LineString)reader.read(posList);
            if(JTSLine == null) continue;
            int lineLength = JTSLine.getNumPoints();
        List<Coordinate> coordsList = new ArrayList<Coordinate>();
        for (int i=0;i<lineLength;i++) {
         

                .getNode(coordinateHNodeIds.get(0)).getValue()
                .asString();
          //  String[] coordinateSplit = coordinate.split(",");
          //  lng = coordinateSplit[0];
          //  lat = coordinateSplit[1];
            WKTReader reader = new WKTReader();
            Point JTSPoint = (Point)reader.read(coordinate);
            if(JTSPoint == null) continue;
            lng = Double.toString(JTSPoint.getX());
            lat = Double.toString(JTSPoint.getY());
          } catch (Exception e) {
            logger.error("Error creating point! Skipping it.", e);

          continue;
        else if(!posList.contains("(")) { // assuming the lon, lat case ... we might need to handle additional cases
          posList = "POINT(" + posList.replace(","," ")+")";
        }
        posList = posList.toUpperCase();
        WKTReader reader = new WKTReader();
        JTSGeometry = reader.read(posList);

        if (JTSGeometry == null)
          continue;

        String srid = "";

            } else if (isCalledAs("WKTtoGML")) {
                if (args[0].isEmpty())
                    result = Sequence.EMPTY_SEQUENCE;
                else {
                    String wkt = args[0].itemAt(0).getStringValue();
                    WKTReader wktReader = new WKTReader();
                    try {
                        geometry = wktReader.read(wkt);
                    } catch (ParseException e) {
                        logger.error(e.getMessage());
                        throw new XPathException(e);
                    }
                    if (geometry == null) {

TOP

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

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.