Skip to main content
Hint

This article is generated by AI translation.

Geospatial type handlers

Geospatial handlers live in net.hasor.dbvisitor.types.handler.geo. Add the JTS dependency before using them:

<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.19.0</version>
</dependency>

Formats

OpenGIS defines two formats:

  • Well-Known Text (WKT) as strings
  • Well-Known Binary (WKB) as byte[]

Store as WKT

Read as WKT and convert to WKB, or accept WKB and write WKT to the database.

  • Use JtsGeometryWktAsWkbTypeHandler for this.
数据库     应用
WKT -> WKB
WKT <- WKB

Store as WKB

Read as WKB and convert to WKT, or accept WKT and write WKB to the database.

  • Use JtsGeometryWkbAsWktTypeHandler for this.
数据库     应用
WKB -> WKT
WKB <- WKT

Store as WKB (HEX)

Read as WKB(HEX) and convert to WKT, or accept WKT and write WKB(HEX) to the database.

  • Use JtsGeometryWkbHexAsWktTypeHandler for this.
  数据库       应用
WKB(HEX) -> WKT
WKB(HEX) <- WKT