Package mil.nga.geopackage.features
Class FeatureCoreGenerator
- java.lang.Object
-
- mil.nga.geopackage.features.FeatureCoreGenerator
-
- Direct Known Subclasses:
OAPIFeatureCoreGenerator
public abstract class FeatureCoreGenerator extends Object
Feature Generator- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description protected BoundingBoxboundingBoxFeatures bounding boxprotected ProjectionboundingBoxProjectionBounding Box projectionprotected Map<String,FeatureColumn>columnsTable columnsprotected static ProjectionEPSG_WGS84EPSG WGS84protected GeometryColumnsgeometryColumnsTable Geometry Columnsprotected GeoPackageCoregeoPackageGeoPackageprotected GeoPackageProgressprogressGeoPackage progressprotected ProjectionprojectionFeatures projectionprotected SpatialReferenceSystemsrsSpatial Reference Systemprotected StringtableNameTable Nameprotected inttransactionLimitNumber of rows to save in a single transaction
-
Constructor Summary
Constructors Constructor Description FeatureCoreGenerator(GeoPackageCore geoPackage, String tableName)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddColumn(FeatureColumn featureColumn)Add a new columnprotected voidaddProjection(Projections projections, String authority, String code)Add a projectionprotected FeatureColumncreateColumn(String name, Object value)Create a feature columnprotected voidcreateFeature(Geometry geometry, Map<String,Object> properties)Create the featureprotected GeoPackageGeometryDatacreateGeometryData(Geometry geometry)Create the geometry dataprotected ProjectioncreateProjection(String authority, String code)Create a projectionvoidcreateSrs()Create the Spatial Reference Systemprotected voidcreateTable(Map<String,Object> properties)Create the feature tableabstract intgenerateFeatures()Generate the featuresBoundingBoxgetBoundingBox()Get bounding boxProjectiongetBoundingBoxProjection()Get the bounding box projectionprotected FeatureColumngetColumn(String column, Object value)Get the column, create if neededMap<String,FeatureColumn>getColumns()Get the columnsGeometryColumnsgetGeometryColumns()Get the geometry columnsGeoPackageCoregetGeoPackage()Get the GeoPackageGeoPackageProgressgetProgress()Get the progressProjectiongetProjection()Get the projectionSpatialReferenceSystemgetSrs()Get the Spatial Reference Systemprotected ProjectiongetSrsProjection()Get the projection for creating the Spatial Reference SystemStringgetTableName()Get the table nameintgetTransactionLimit()Get the single transaction limitstatic GeoPackageDataTypegetType(Object value)Get the type for the object valuestatic ObjectgetValue(Object value, GeoPackageDataType type)Get the value for the object value with the data typeprotected ObjectgetValue(String column, Object value)Get the column valueprotected voidinitializeTable()Initialize after the feature table is createdbooleanisActive()Determine if the feature generator should remain activeprotected abstract voidsaveFeature(Geometry geometry, Map<String,Object> values)Save the featurevoidsetBoundingBox(BoundingBox boundingBox)Set the bounding boxvoidsetBoundingBoxProjection(Projection boundingBoxProjection)Set the bounding box projectionvoidsetProgress(GeoPackageProgress progress)Set the progressvoidsetProjection(Projection projection)Set the projectionvoidsetTransactionLimit(int transactionLimit)Set the single transaction limit
-
-
-
Field Detail
-
EPSG_WGS84
protected static final Projection EPSG_WGS84
EPSG WGS84
-
geoPackage
protected final GeoPackageCore geoPackage
GeoPackage
-
tableName
protected final String tableName
Table Name
-
boundingBox
protected BoundingBox boundingBox
Features bounding box
-
boundingBoxProjection
protected Projection boundingBoxProjection
Bounding Box projection
-
projection
protected Projection projection
Features projection
-
transactionLimit
protected int transactionLimit
Number of rows to save in a single transaction
-
progress
protected GeoPackageProgress progress
GeoPackage progress
-
geometryColumns
protected GeometryColumns geometryColumns
Table Geometry Columns
-
columns
protected Map<String,FeatureColumn> columns
Table columns
-
srs
protected SpatialReferenceSystem srs
Spatial Reference System
-
-
Constructor Detail
-
FeatureCoreGenerator
public FeatureCoreGenerator(GeoPackageCore geoPackage, String tableName)
Constructor- Parameters:
geoPackage- GeoPackagetableName- table name
-
-
Method Detail
-
getGeoPackage
public GeoPackageCore getGeoPackage()
Get the GeoPackage- Returns:
- GeoPackage
-
getTableName
public String getTableName()
Get the table name- Returns:
- table name
-
getBoundingBox
public BoundingBox getBoundingBox()
Get bounding box- Returns:
- bounding box
-
setBoundingBox
public void setBoundingBox(BoundingBox boundingBox)
Set the bounding box- Parameters:
boundingBox- bounding box
-
getBoundingBoxProjection
public Projection getBoundingBoxProjection()
Get the bounding box projection- Returns:
- bounding box projection
-
setBoundingBoxProjection
public void setBoundingBoxProjection(Projection boundingBoxProjection)
Set the bounding box projection- Parameters:
boundingBoxProjection- bounding box projection
-
getProjection
public Projection getProjection()
Get the projection- Returns:
- projection
-
setProjection
public void setProjection(Projection projection)
Set the projection- Parameters:
projection- projection
-
getTransactionLimit
public int getTransactionLimit()
Get the single transaction limit- Returns:
- transaction limit
-
setTransactionLimit
public void setTransactionLimit(int transactionLimit)
Set the single transaction limit- Parameters:
transactionLimit- transaction limit
-
getProgress
public GeoPackageProgress getProgress()
Get the progress- Returns:
- progress
-
setProgress
public void setProgress(GeoPackageProgress progress)
Set the progress- Parameters:
progress- progress
-
isActive
public boolean isActive()
Determine if the feature generator should remain active- Returns:
- true if active
-
getGeometryColumns
public GeometryColumns getGeometryColumns()
Get the geometry columns- Returns:
- geometry columns
-
getColumns
public Map<String,FeatureColumn> getColumns()
Get the columns- Returns:
- columns
-
getSrs
public SpatialReferenceSystem getSrs()
Get the Spatial Reference System- Returns:
- srs
-
generateFeatures
public abstract int generateFeatures() throws SQLExceptionGenerate the features- Returns:
- generated count
- Throws:
SQLException- upon error
-
addColumn
protected abstract void addColumn(FeatureColumn featureColumn)
Add a new column- Parameters:
featureColumn- feature column
-
initializeTable
protected void initializeTable()
Initialize after the feature table is created
-
saveFeature
protected abstract void saveFeature(Geometry geometry, Map<String,Object> values)
Save the feature- Parameters:
geometry- geometryvalues- column to value mapping
-
createFeature
protected void createFeature(Geometry geometry, Map<String,Object> properties) throws SQLException
Create the feature- Parameters:
geometry- geometryproperties- properties- Throws:
SQLException- upon error
-
createSrs
public void createSrs() throws SQLExceptionCreate the Spatial Reference System- Throws:
SQLException- upon error
-
getSrsProjection
protected Projection getSrsProjection()
Get the projection for creating the Spatial Reference System- Returns:
- projection
-
createTable
protected void createTable(Map<String,Object> properties) throws SQLException
Create the feature table- Parameters:
properties- properties- Throws:
SQLException- upon error
-
getValue
protected Object getValue(String column, Object value)
Get the column value- Parameters:
column- column namevalue- value- Returns:
- column value
-
getColumn
protected FeatureColumn getColumn(String column, Object value)
Get the column, create if needed- Parameters:
column- column namevalue- value- Returns:
- feature column
-
createColumn
protected FeatureColumn createColumn(String name, Object value)
Create a feature column- Parameters:
name- column namevalue- value- Returns:
- feature column
-
createGeometryData
protected GeoPackageGeometryData createGeometryData(Geometry geometry)
Create the geometry data- Parameters:
geometry- geometry- Returns:
- geometry data
-
getType
public static GeoPackageDataType getType(Object value)
Get the type for the object value- Parameters:
value- value- Returns:
- data type
-
getValue
public static Object getValue(Object value, GeoPackageDataType type)
Get the value for the object value with the data type- Parameters:
value- valuetype- data type- Returns:
- default value
-
addProjection
protected void addProjection(Projections projections, String authority, String code)
Add a projection- Parameters:
projections- projectionsauthority- authoritycode- code
-
createProjection
protected Projection createProjection(String authority, String code)
Create a projection- Parameters:
authority- authoritycode- code- Returns:
- projection
-
-