Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import groovy.sql.Sql
- import com.vividsolutions.jts.io.WKTReader
- import com.vividsolutions.jts.io.WKBWriter
- import com.vividsolutions.jts.geom.Geometry
- def url = "jdbc:oracle:thin:@localhost:1521:TESTDB"
- sql = Sql.newInstance(url,"username","password","oracle.jdbc.driver.OracleDriver")
- WKTReader reader = new WKTReader()
- WKBWriter writer = new WKBWriter()
- String wkt = "LINESTRING (-92.3213354 20.368354, -92.383172 20.4760694, -92.4390244 20.603732)"
- int objectid = 466
- Geometry geom = reader.read(wkt)
- byte[] wkb = writer.write(geom)
- def stmt = """UPDATE FEATURE_TEST SET SHAPE = MDSYS.SDO_GEOMETRY(?,8307) WHERE OBJECTID = ?"""
- sql.executeUpdate(stmt.toString(),[wkb,objectid])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement