use of eu.esdihumboldt.hale.io.jdbc.spatialite.internal.SpatiaLiteSupport in project hale by halestudio.
the class SpatiaLiteGeometries method configureGeometryColumnType.
@Override
public Class<? extends Geometry> configureGeometryColumnType(SQLiteConnection connection, BaseColumn<?> column, DefaultTypeDefinition type) {
String colName = column.getName();
String tabName = column.getParent().getName();
SpatiaLiteSupport slSupport = SpatiaLiteSupportFactory.getInstance().createSpatiaLiteSupport(connection);
// warn if SpatiaLite is not available
SpatiaLiteHelper.isSpatialLiteLoadedReport(connection, false);
GeometryTypeMetadata geomTypeMeta = slSupport.getGeometryTypeMetadata(connection, tabName, colName);
if (geomTypeMeta != null) {
SrsMetadata srsMeta = slSupport.getSrsMetadata(connection, geomTypeMeta.getSrid());
GeometryMetadata columnTypeConstraint;
if (srsMeta != null) {
// Create constraint to save the informations
columnTypeConstraint = new GeometryMetadata(Integer.toString(srsMeta.getAuthSrid()), geomTypeMeta.getCoordDimension(), srsMeta.getSrText(), srsMeta.getAuthName());
} else {
// no SRS information, just dimension
columnTypeConstraint = new GeometryMetadata(geomTypeMeta.getCoordDimension());
}
type.setConstraint(columnTypeConstraint);
return geomTypeMeta.getGeomType();
} else {
// no geometry column could be found
return null;
}
}
Aggregations