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 BoundingBox
boundingBox
Features bounding boxprotected Projection
boundingBoxProjection
Bounding Box projectionprotected Map<String,FeatureColumn>
columns
Table columnsprotected static Projection
EPSG_WGS84
EPSG WGS84protected GeometryColumns
geometryColumns
Table Geometry Columnsprotected GeoPackageCore
geoPackage
GeoPackageprotected GeoPackageProgress
progress
GeoPackage progressprotected Projection
projection
Features projectionprotected SpatialReferenceSystem
srs
Spatial Reference Systemprotected String
tableName
Table Nameprotected int
transactionLimit
Number 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 void
addColumn(FeatureColumn featureColumn)
Add a new columnprotected void
addProjection(Projections projections, String authority, String code)
Add a projectionprotected FeatureColumn
createColumn(String name, Object value)
Create a feature columnprotected void
createFeature(Geometry geometry, Map<String,Object> properties)
Create the featureprotected GeoPackageGeometryData
createGeometryData(Geometry geometry)
Create the geometry dataprotected Projection
createProjection(String authority, String code)
Create a projectionvoid
createSrs()
Create the Spatial Reference Systemprotected void
createTable(Map<String,Object> properties)
Create the feature tableabstract int
generateFeatures()
Generate the featuresBoundingBox
getBoundingBox()
Get bounding boxProjection
getBoundingBoxProjection()
Get the bounding box projectionprotected FeatureColumn
getColumn(String column, Object value)
Get the column, create if neededMap<String,FeatureColumn>
getColumns()
Get the columnsGeometryColumns
getGeometryColumns()
Get the geometry columnsGeoPackageCore
getGeoPackage()
Get the GeoPackageGeoPackageProgress
getProgress()
Get the progressProjection
getProjection()
Get the projectionSpatialReferenceSystem
getSrs()
Get the Spatial Reference Systemprotected Projection
getSrsProjection()
Get the projection for creating the Spatial Reference SystemString
getTableName()
Get the table nameint
getTransactionLimit()
Get the single transaction limitstatic GeoPackageDataType
getType(Object value)
Get the type for the object valuestatic Object
getValue(Object value, GeoPackageDataType type)
Get the value for the object value with the data typeprotected Object
getValue(String column, Object value)
Get the column valueprotected void
initializeTable()
Initialize after the feature table is createdboolean
isActive()
Determine if the feature generator should remain activeprotected abstract void
saveFeature(Geometry geometry, Map<String,Object> values)
Save the featurevoid
setBoundingBox(BoundingBox boundingBox)
Set the bounding boxvoid
setBoundingBoxProjection(Projection boundingBoxProjection)
Set the bounding box projectionvoid
setProgress(GeoPackageProgress progress)
Set the progressvoid
setProjection(Projection projection)
Set the projectionvoid
setTransactionLimit(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 SQLException
Generate 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 SQLException
Create 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
-
-