Examples of WKBWriter


Examples of com.vividsolutions.jts.io.WKBWriter

            out.write(buf, 8);
        }
       
        //out.write(buf, buf.length);

        new WKBWriter(2, order).write(g, out);
    }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

        WKBWriter wkbWriter;

        public WKB(GeometryFactory geomFactory) {
            this.geomFactory = geomFactory;
            this.wkbReader = new WKBReader(geomFactory);
            this.wkbWriter = new WKBWriter();
        }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

            if (g instanceof LinearRing ) {
                //ingres does not handle linear rings, convert to just a line string
                g = g.getFactory().createLineString(((LinearRing) g).getCoordinateSequence());
            }
           
            byte[] bytes = new WKBWriter().write(g);
            ps.setBytes(column, bytes);
        } else {
            ps.setBytes(column, null);
        }
    }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

   
    @Override
    public void setGeometryValue(Geometry g, int dimension, int srid, Class binding,
            PreparedStatement ps, int column) throws SQLException {
        if ( g != null ) {
            ps.setBytes( column, new WKBWriter(dimension).write( g ) );
            //ps.setString( column, g.toText() );
        }
        else {
            ps.setNull(column, Types.OTHER);
        }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

    public void write(PreparedStatement ps, int position, Object value) throws IOException {
        try {
            if(value == null) {
                ps.setNull(position, Types.OTHER);
            } else {
                ps.setBytes( position, new WKBWriter().write( (Geometry)value ));
            }
        } catch (SQLException e) {
            throw new DataSourceException("SQL exception occurred while reading the geometry.", e);
        }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

                    SimpleFeature sf = (SimpleFeature) feature;
                    String fileName = (String) sf.getAttribute("location");
                    int idx = fileName.lastIndexOf(".");
                    Geometry g = (Geometry) sf.getDefaultGeometry();
                    File wkbFile = new File(testMosaic, fileName.substring(0, idx) + ".wkb");
                    byte[] bytes = new WKBWriter().write(g);
                    FileUtils.writeByteArrayToFile(wkbFile, bytes);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

            if (g instanceof LinearRing ) {
                //postgis does not handle linear rings, convert to just a line string
                g = g.getFactory().createLineString(((LinearRing) g).getCoordinateSequence());
            }
           
            byte[] bytes = new WKBWriter(dimension).write(g);
            ps.setBytes(column, bytes);
        } else {
            ps.setNull(column, Types.OTHER, "Geometry");
        }
    }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

  }
 
  // Protected methods

  protected void encodeGeometryShape(Geometry geometry, PropertyContainer container) {
        WKBWriter writer = new WKBWriter();
        container.setProperty(geomProperty, writer.write(geometry));
  }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

  public byte[] toBinary() {
    if (footprint == null) {
      return new byte[] {};
    }
    else {
      return new WKBWriter().write(footprint);
    }
  }
View Full Code Here

Examples of com.vividsolutions.jts.io.WKBWriter

     
    if (!geometry.isEmpty()){
      dimensions  = Double.isNaN(geometry.getCoordinate().getOrdinate(Coordinate.Z)) ? 2 : 3;
    }

    return new WKBWriter(dimensions).write(geometry);
  }
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.