NGen
Loading...
Searching...
No Matches
ngen::geopackage Namespace Reference

Classes

struct  wkb
 A recursive WKB reader. More...
 

Enumerations

enum  wkb_geom_t {
  geometry = 0 ,
  point = 1 ,
  linestring = 2 ,
  polygon = 3 ,
  multipoint = 4 ,
  multilinestring = 5 ,
  multipolygon = 6 ,
  geometry_collection = 7
}
 

Functions

geojson::geometry build_geometry (const ngen::sqlite::database::iterator &row, const std::string &geom_col, std::vector< double > &bounding_box)
 Build a geometry object from GeoPackage WKB.
 
geojson::PropertyMap build_properties (const ngen::sqlite::database::iterator &row, const std::string &geom_col)
 Build properties from GeoPackage table columns.
 
geojson::Feature build_feature (const ngen::sqlite::database::iterator &row, const std::string &id_col, const std::string &geom_col)
 Build a feature from a GPKG table row.
 
std::shared_ptr< geojson::FeatureCollectionread (const std::string &gpkg_path, const std::string &layer, const std::vector< std::string > &ids)
 Build a feature collection from a GPKG layer.
 
void throw_if_not_type (uint32_t given, wkb_geom_t expected)
 

Enumeration Type Documentation

◆ wkb_geom_t

Enumerator
geometry 
point 
linestring 
polygon 
multipoint 
multilinestring 
multipolygon 
geometry_collection 

Function Documentation

◆ build_feature()

geojson::Feature ngen::geopackage::build_feature ( const ngen::sqlite::database::iterator & row,
const std::string & id_col,
const std::string & geom_col )

Build a feature from a GPKG table row.

Parameters
[in]rowSQLite iterator at the row to build a feature from
[in]geom_colName of geometry column containing GPKG WKB
Returns
geojson::Feature Feature containing geometry and properties from the given row

References build_geometry(), build_properties(), geojson::GeometryCollection, ngen::sqlite::database::iterator::get(), geojson::LineString, geojson::MultiLineString, geojson::MultiPoint, geojson::MultiPolygon, geojson::Point, and geojson::Polygon.

◆ build_geometry()

geojson::geometry ngen::geopackage::build_geometry ( const ngen::sqlite::database::iterator & row,
const std::string & geom_col,
std::vector< double > & bounding_box )

Build a geometry object from GeoPackage WKB.

Parameters
[in]rowSQLite iterator at the row containing a geometry column
[in]geom_colName of geometry column containing GPKG WKB
[out]bounding_boxBounding box of the geometry to output
Returns
geojson::geometry GPKG WKB converted and projected to a boost geometry model

References utils::copy_from(), ngen::sqlite::database::iterator::get(), ngen::srs::epsg::get(), and ngen::srs::epsg::wgs84.

Referenced by build_feature().

◆ build_properties()

geojson::PropertyMap ngen::geopackage::build_properties ( const ngen::sqlite::database::iterator & row,
const std::string & geom_col )

Build properties from GeoPackage table columns.

Parameters
[in]rowSQLite iterator at the row containing the data columns
[in]geom_colName of geometry column containing GPKG WKB to ignore
Returns
geojson::PropertyMap PropertyMap of properties from the given row

References ngen::sqlite::database::iterator::columns(), and ngen::sqlite::database::iterator::types().

Referenced by build_feature().

◆ read()

std::shared_ptr< geojson::FeatureCollection > ngen::geopackage::read ( const std::string & gpkg_path,
const std::string & layer = "",
const std::vector< std::string > & ids = {} )

Build a feature collection from a GPKG layer.

Parameters
[in]gpkg_pathPath to GPKG file
[in]layerLayer name within GPKG file to create a collection from
[in]idsoptional subset of feature IDs to capture (if empty, the entire layer is converted)
Returns
std::shared_ptr<geojson::FeatureCollection>

◆ throw_if_not_type()

void ngen::geopackage::throw_if_not_type ( uint32_t given,
wkb_geom_t expected )