Hint
This article is generated by AI translation.
Geospatial Type Handlers
Geospatial type handlers are located in the net.hasor.dbvisitor.types.handler.geo package. Add the JTS dependency before use:
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.19.0</version>
</dependency>
OpenGIS Standard Formats
The OpenGIS specification defines two geospatial data representation formats:
- WKT (Well-Known Text) — string form, e.g.
POINT (30 10) - WKB (Well-Known Binary) — byte array
byte[]form
Built-in Handlers
Choose the appropriate handler based on the database storage format and application-level type:
| Handler | DB Format | Java Type | Description |
|---|---|---|---|
JtsGeometryWktAsWkbTypeHandler | WKT (String) | byte[] | Read: WKT→WKB, Write: WKB→WKT |
JtsGeometryWkbAsWktTypeHandler | WKB (byte[]) | String | Read: WKB→WKT, Write: WKT→WKB |
JtsGeometryWkbHexAsWktTypeHandler | WKB HEX (String) | String | Read: HEX→WKB→WKT, Write: WKT→WKB→HEX |
Store as WKT
Database stores in WKT (String) format, application uses WKB (byte[]):
Database Application
WKT (String) → WKB (byte[])
WKT (String) ← WKB (byte[])
Use JtsGeometryWktAsWkbTypeHandler
Store as WKB
Database stores in WKB (byte[]) format, application uses WKT (String):
Database Application
WKB (byte[]) → WKT (String)
WKB (byte[]) ← WKT (String)
Use JtsGeometryWkbAsWktTypeHandler
Store as WKB HEX
Database stores in WKB HEX-encoded (String) format, application uses WKT (String):
Database Application
WKB HEX (String) → WKT (String)
WKB HEX (String) ← WKT (String)
Use JtsGeometryWkbHexAsWktTypeHandler