Package mil.nga.geopackage.features
Class OAPIFeatureCoreGenerator
- java.lang.Object
-
- mil.nga.geopackage.features.FeatureCoreGenerator
-
- mil.nga.geopackage.features.OAPIFeatureCoreGenerator
-
public abstract class OAPIFeatureCoreGenerator extends FeatureCoreGenerator
OGC API Features Generator- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description protected static Projections
DEFAULT_PROJECTIONS
Default projectionsprotected int
downloadAttempts
Download attempts per feature requestprotected static String
EPSG_VERSION
EPSG CRS Versionprotected String
id
Identifier (name) of a specific collectionprotected Integer
limit
The optional limit parameter limits the number of items that are presented in the response document.protected static Pattern
LIMIT_PATTERN
Limit patternprotected static Projection
OGC_CRS84
OGC CRS84 Projectionprotected static String
OGC_VERSION
OGC CRS Versionprotected String
period
Time period string that adheres to RFC 3339protected String
server
Base server urlprotected String
time
Either a date-time or a period string that adheres to RFC 3339protected Integer
totalLimit
Total limit of number of items to request-
Fields inherited from class mil.nga.geopackage.features.FeatureCoreGenerator
boundingBox, boundingBoxProjection, columns, EPSG_WGS84, geometryColumns, geoPackage, progress, projection, srs, tableName, transactionLimit
-
-
Constructor Summary
Constructors Constructor Description OAPIFeatureCoreGenerator(GeoPackageCore geoPackage, String tableName, String server, String id)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
buildCollectionRequestUrl()
Build the collection request URLCollection
collectionRequest()
Collection requestprotected Collection
collectionRequest(String url)
Collection request for the provided URLprotected void
createFeature(Feature feature)
Create the featureprotected FeatureCollection
createFeatures(String features)
Create features in the feature DAO from the features valueprotected int
createFeatures(FeatureCollection featureCollection)
Create features from the feature collectionint
generateFeatures()
Generate the featuresint
generateFeatures(String urlString, int currentCount)
Generate featuresprotected Crs
getCrs(Projection projection)
Get the CRS from the projectionint
getDownloadAttempts()
Get the number of download attemptsString
getId()
Get the collection idInteger
getLimit()
Get the limitString
getPeriod()
Get the time periodProjections
getProjections()
Get the supported projectionsProjections
getProjections(String url)
Get the supported projectionsProjections
getProjections(Collection collection)
Get the supported projectionsString
getServer()
Get the serverprotected Projection
getSrsProjection()
Get the projection for creating the Spatial Reference SystemString
getTime()
Get the timeInteger
getTotalLimit()
Get the total limitboolean
isDefaultProjection(Projection projection)
Check if the projection is a default projectionboolean
requestProjection(Projection projection)
Determine if the projection should be requested from the servervoid
setDownloadAttempts(int downloadAttempts)
Set the number of download attemptsvoid
setLimit(Integer limit)
Set the limitvoid
setPeriod(String period)
Set the time periodvoid
setPeriod(Date period)
Set the time periodvoid
setTime(String time)
Set the timevoid
setTime(Date time)
Set the timevoid
setTotalLimit(Integer totalLimit)
Set the total limitprotected String
urlRequest(String urlValue)
URL requestprotected String
urlRequest(String urlValue, URL url)
Perform a URL request-
Methods inherited from class mil.nga.geopackage.features.FeatureCoreGenerator
addColumn, addProjection, createColumn, createFeature, createGeometryData, createProjection, createSrs, createTable, getBoundingBox, getBoundingBoxProjection, getColumn, getColumns, getGeometryColumns, getGeoPackage, getProgress, getProjection, getSrs, getTableName, getTransactionLimit, getType, getValue, getValue, initializeTable, isActive, saveFeature, setBoundingBox, setBoundingBoxProjection, setProgress, setProjection, setTransactionLimit
-
-
-
-
Field Detail
-
LIMIT_PATTERN
protected static final Pattern LIMIT_PATTERN
Limit pattern
-
OGC_CRS84
protected static final Projection OGC_CRS84
OGC CRS84 Projection
-
OGC_VERSION
protected static final String OGC_VERSION
OGC CRS Version- See Also:
- Constant Field Values
-
EPSG_VERSION
protected static final String EPSG_VERSION
EPSG CRS Version- See Also:
- Constant Field Values
-
DEFAULT_PROJECTIONS
protected static final Projections DEFAULT_PROJECTIONS
Default projections
-
server
protected final String server
Base server url
-
id
protected final String id
Identifier (name) of a specific collection
-
limit
protected Integer limit
The optional limit parameter limits the number of items that are presented in the response document.
-
time
protected String time
Either a date-time or a period string that adheres to RFC 3339
-
period
protected String period
Time period string that adheres to RFC 3339
-
totalLimit
protected Integer totalLimit
Total limit of number of items to request
-
downloadAttempts
protected int downloadAttempts
Download attempts per feature request
-
-
Constructor Detail
-
OAPIFeatureCoreGenerator
public OAPIFeatureCoreGenerator(GeoPackageCore geoPackage, String tableName, String server, String id)
Constructor- Parameters:
geoPackage
- GeoPackagetableName
- table nameserver
- server urlid
- collection identifier
-
-
Method Detail
-
getServer
public String getServer()
Get the server- Returns:
- server
-
getId
public String getId()
Get the collection id- Returns:
- collection id
-
getLimit
public Integer getLimit()
Get the limit- Returns:
- limit
-
setLimit
public void setLimit(Integer limit)
Set the limit- Parameters:
limit
- limit
-
getTime
public String getTime()
Get the time- Returns:
- time
-
setTime
public void setTime(String time)
Set the time- Parameters:
time
- time
-
setTime
public void setTime(Date time)
Set the time- Parameters:
time
- time
-
getPeriod
public String getPeriod()
Get the time period- Returns:
- period
-
setPeriod
public void setPeriod(String period)
Set the time period- Parameters:
period
- period
-
setPeriod
public void setPeriod(Date period)
Set the time period- Parameters:
period
- period
-
getTotalLimit
public Integer getTotalLimit()
Get the total limit- Returns:
- total limit
-
setTotalLimit
public void setTotalLimit(Integer totalLimit)
Set the total limit- Parameters:
totalLimit
- total limit
-
getDownloadAttempts
public int getDownloadAttempts()
Get the number of download attempts- Returns:
- download attempts
-
setDownloadAttempts
public void setDownloadAttempts(int downloadAttempts)
Set the number of download attempts- Parameters:
downloadAttempts
- download attempts
-
getSrsProjection
protected Projection getSrsProjection()
Get the projection for creating the Spatial Reference System- Overrides:
getSrsProjection
in classFeatureCoreGenerator
- Returns:
- projection
-
createFeature
protected void createFeature(Feature feature) throws SQLException
Create the feature- Parameters:
feature
- feature- Throws:
SQLException
- upon error
-
generateFeatures
public int generateFeatures() throws SQLException
Generate the features- Specified by:
generateFeatures
in classFeatureCoreGenerator
- Returns:
- generated count
- Throws:
SQLException
- upon error
-
buildCollectionRequestUrl
protected String buildCollectionRequestUrl()
Build the collection request URL- Returns:
- url
-
getProjections
public Projections getProjections()
Get the supported projections- Returns:
- projections
-
getProjections
public Projections getProjections(String url)
Get the supported projections- Parameters:
url
- URL- Returns:
- projections
-
getProjections
public Projections getProjections(Collection collection)
Get the supported projections- Parameters:
collection
- collection- Returns:
- projections
-
requestProjection
public boolean requestProjection(Projection projection)
Determine if the projection should be requested from the server- Parameters:
projection
- projection- Returns:
- true to request the projection (non null and non default)
-
isDefaultProjection
public boolean isDefaultProjection(Projection projection)
Check if the projection is a default projection- Parameters:
projection
- projection- Returns:
- true if default projection
-
collectionRequest
public Collection collectionRequest()
Collection request- Returns:
- collection
-
collectionRequest
protected Collection collectionRequest(String url)
Collection request for the provided URL- Parameters:
url
- url value- Returns:
- collection
-
generateFeatures
public int generateFeatures(String urlString, int currentCount) throws SQLException
Generate features- Parameters:
urlString
- URLcurrentCount
- current count- Returns:
- current result count
- Throws:
SQLException
- upon failure
-
urlRequest
protected String urlRequest(String urlValue)
URL request- Parameters:
urlValue
- URL value- Returns:
- response string
-
urlRequest
protected String urlRequest(String urlValue, URL url)
Perform a URL request- Parameters:
urlValue
- URL string valueurl
- URL- Returns:
- features response
-
createFeatures
protected FeatureCollection createFeatures(String features) throws SQLException
Create features in the feature DAO from the features value- Parameters:
features
- features json- Returns:
- feature collection
- Throws:
SQLException
- upon error
-
createFeatures
protected int createFeatures(FeatureCollection featureCollection)
Create features from the feature collection- Parameters:
featureCollection
- feature collection- Returns:
- features created
-
getCrs
protected Crs getCrs(Projection projection)
Get the CRS from the projection- Parameters:
projection
- projection- Returns:
- crs
-
-