How can I convert a WKT string to a WKB byte in Java using PostGIS functions? I need to save that WKT string in a PostGIS database (geometry column.
says that you can convert it like that in both ways:
bytea WKB = ST_AsBinary(geometry); text WKT = ST_AsText(geometry); geometry = ST_GeomFromWKB(bytea WKB, SRID); geometry = ST_GeometryFromText(text WKT, SRID);
If you need to save WKT in geometry column, you can do this in pure SQL using ST_GeomFromText function. Look at the docs to see the possible options.