NGen
Loading...
Searching...
No Matches
geojson Namespace Reference

Classes

class  CollectionFeature
 
class  FeatureBase
 Represents an individual feature within a Geojson definition. More...
 
class  FeatureCollection
 
class  FeatureVisitor
 An abstract class used to operate on the children of FeatureBase. More...
 
class  JSONProperty
 @TODO: Convert JSONProperty into a variant of the supported types
More...
 
class  LineStringFeature
 
struct  List
 Struct wrapping a vector of JSONProperty representing a JSON list. More...
 
class  MultiLineStringFeature
 
class  MultiPointFeature
 
class  MultiPolygonFeature
 
struct  Object
 Struct wrapping a nested PropertyMap representing a JSON object. More...
 
class  PointFeature
 
class  PolygonFeature
 Represents a feature based around a polygon defining an area. More...
 

Typedefs

typedef std::shared_ptr< FeatureCollectionGeoJSON
 Easy short-hand for a smart pointer to a FeatureCollection.
 
typedef std::shared_ptr< FeatureBaseFeature
 An easy name for a smart pointer for FeatureBase and its children.
 
typedef std::vector< FeatureFeatureList
 Shorthand for a collection of pointers to Features.
 
typedef bg::model::point< double, 2, bg::cs::geographic< bg::degree > > coordinate_t
 A two dimensional point in geographic degrees.
 
typedef bg::model::linestring< coordinate_tlinestring_t
 A line made up of points in geographic degrees.
 
typedef bg::model::polygon< coordinate_tpolygon_t
 A polygon made up of points in geographic degrees.
 
typedef bg::model::multi_point< coordinate_tmultipoint_t
 
typedef bg::model::multi_linestring< linestring_tmultilinestring_t
 
typedef bg::model::multi_polygon< polygon_tmultipolygon_t
 
typedef std::vector< std::vector< double > > two_dimensional_coordinates
 A two dimensional matrix of doubles.
 
typedef std::vector< std::vector< std::vector< double > > > three_dimensional_coordinates
 A three dimensional matrix of doubles.
 
typedef std::vector< std::vector< std::vector< std::vector< double > > > > four_dimensional_coordinates
 A four dimensional matrix of doubles.
 
typedef boost::variant< coordinate_t, linestring_t, polygon_t, multipoint_t, multilinestring_t, multipolygon_tgeometry
 
typedef std::map< std::string, JSONPropertyPropertyMap
 Shorthand for a mapping between strings and properties.
 
using PropertyVariant
 

Enumerations

enum class  FeatureType {
  None ,
  Point ,
  LineString ,
  Polygon ,
  MultiPoint ,
  MultiLineString ,
  MultiPolygon ,
  GeometryCollection
}
 Describes a type of features. More...
 
enum class  JSONGeometryType {
  None ,
  LineString ,
  Point ,
  Polygon ,
  MultiLineString ,
  MultiPoint ,
  MultiPolygon
}
 Represents the type of geometry to be represented within a JSONGeometry. More...
 
enum class  PropertyType {
  Natural ,
  Real ,
  String ,
  Boolean ,
  List ,
  Object
}
 Defines the different types of properties that are stored within a JSON property. More...
 

Functions

static coordinate_t build_point (boost::property_tree::ptree &tree)
 Creates a single boost geometry point from the values in a boost property tree.
 
static linestring_t build_linestring (boost::property_tree::ptree &tree)
 Reads a ptree entry and converts it into a linestring.
 
static polygon_t build_polygon (boost::property_tree::ptree &tree)
 
static multipoint_t build_multipoint (boost::property_tree::ptree &tree)
 
static multilinestring_t build_multilinestring (boost::property_tree::ptree &tree)
 
static multipolygon_t build_multipolygon (boost::property_tree::ptree &tree)
 
static geometry build_geometry (boost::property_tree::ptree &tree)
 
static Feature build_feature (boost::property_tree::ptree &tree)
 
static GeoJSON build_collection (const boost::property_tree::ptree &tree, const std::vector< std::string > &ids={})
 helper function to build a GeoJSON FeatureCollection from a property tree
 
static GeoJSON read (const std::string &file_path, const std::vector< std::string > &ids={})
 
static GeoJSON read (std::stringstream &data, const std::vector< std::string > &ids={})
 
template<typename T >
static bool contains (const std::vector< T * > &container, const T *value)
 
template<typename T >
static bool contains (const std::vector< T > &container, const T value)
 
template<typename T >
get_shape (geometry geom)
 
std::string get_geometry_type (const geometry &geom)
 
static coordinate_t point (const double x, const double y)
 
static linestring_t linestring (const two_dimensional_coordinates &coordinates)
 
static polygon_t polygon (three_dimensional_coordinates &coordinates)
 
static multipoint_t multipoint (two_dimensional_coordinates &coordinates)
 
static multilinestring_t multilinestring (three_dimensional_coordinates &coordinates)
 
static multipolygon_t multipolygon (four_dimensional_coordinates &coordinates)
 
static std::string get_propertytype_name (PropertyType &&property_type)
 

Typedef Documentation

◆ coordinate_t

typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > geojson::coordinate_t

A two dimensional point in geographic degrees.

◆ Feature

typedef std::shared_ptr<FeatureBase> geojson::Feature

An easy name for a smart pointer for FeatureBase and its children.

◆ FeatureList

typedef std::vector<Feature> geojson::FeatureList

Shorthand for a collection of pointers to Features.

◆ four_dimensional_coordinates

typedef std::vector<std::vector<std::vector<std::vector<double> > > > geojson::four_dimensional_coordinates

A four dimensional matrix of doubles.

◆ GeoJSON

typedef std::shared_ptr<FeatureCollection> geojson::GeoJSON

Easy short-hand for a smart pointer to a FeatureCollection.

◆ geometry

◆ linestring_t

typedef bg::model::linestring<coordinate_t> geojson::linestring_t

A line made up of points in geographic degrees.

◆ multilinestring_t

typedef bg::model::multi_linestring<linestring_t> geojson::multilinestring_t

◆ multipoint_t

typedef bg::model::multi_point<coordinate_t> geojson::multipoint_t

◆ multipolygon_t

typedef bg::model::multi_polygon<polygon_t> geojson::multipolygon_t

◆ polygon_t

typedef bg::model::polygon<coordinate_t> geojson::polygon_t

A polygon made up of points in geographic degrees.

◆ PropertyMap

typedef std::map<std::string, JSONProperty> geojson::PropertyMap

Shorthand for a mapping between strings and properties.

◆ PropertyVariant

Initial value:
boost::variant<boost::blank,
long,
double,
bool,
std::string,
boost::recursive_wrapper<List>,
boost::recursive_wrapper<Object>
>

◆ three_dimensional_coordinates

typedef std::vector<std::vector<std::vector<double> > > geojson::three_dimensional_coordinates

A three dimensional matrix of doubles.

◆ two_dimensional_coordinates

typedef std::vector<std::vector<double> > geojson::two_dimensional_coordinates

A two dimensional matrix of doubles.

Enumeration Type Documentation

◆ FeatureType

enum class geojson::FeatureType
strong

Describes a type of features.

Enumerator
None 

Represents an empty feature with no sort of geometry

Point 

Represents a feature that contains a single Point geometry

LineString 

Represents a feature that is represented by a series of interconnected points

Polygon 

Represents a feature that is represented by a defined area

MultiPoint 

Represents a feature that is represented by many points

MultiLineString 

Represents a feature that is represented by multiple series of interconnected points

MultiPolygon 

Represents a feature that is represented by multiple areas

GeometryCollection 

Represents a feature that contains a collection of different types of geometry

◆ JSONGeometryType

enum class geojson::JSONGeometryType
strong

Represents the type of geometry to be represented within a JSONGeometry.

Enumerator
None 
LineString 
Point 
Polygon 
MultiLineString 
MultiPoint 
MultiPolygon 

◆ PropertyType

enum class geojson::PropertyType
strong

Defines the different types of properties that are stored within a JSON property.

Enumerator
Natural 

Represents natural numbers, such as shorts, ints, and longs; no floating points

Real 

Represents floating point numbers

String 

Represents text

Boolean 

Represents a true or false value

List 

Represents a list of values

Object 

Represents a nested map of properties

Function Documentation

◆ build_collection()

static GeoJSON geojson::build_collection ( const boost::property_tree::ptree & tree,
const std::vector< std::string > & ids = {} )
static

helper function to build a GeoJSON FeatureCollection from a property tree

Parameters
treeboost::property_tree::ptree holding the parsed GeoJSON
idsoptional subset of string feature ids, only features in tree with these ids will be in the collection

◆ build_feature()

static Feature geojson::build_feature ( boost::property_tree::ptree & tree)
static

◆ build_geometry()

static geometry geojson::build_geometry ( boost::property_tree::ptree & tree)
static

◆ build_linestring()

static linestring_t geojson::build_linestring ( boost::property_tree::ptree & tree)
static

Reads a ptree entry and converts it into a linestring.

The input should be a boost property tree that looks like:

  • feature:
    • "type": "doesn't matter here"
    • "coordinates": [[0,0], [1,1], [2,2]]
Parameters
treeA property tree node describing a line strig
Returns
a boost geometry linestring

References point().

Referenced by build_geometry().

◆ build_multilinestring()

static multilinestring_t geojson::build_multilinestring ( boost::property_tree::ptree & tree)
static

References linestring(), and point().

Referenced by build_geometry().

◆ build_multipoint()

static multipoint_t geojson::build_multipoint ( boost::property_tree::ptree & tree)
static

References point().

Referenced by build_geometry().

◆ build_multipolygon()

static multipolygon_t geojson::build_multipolygon ( boost::property_tree::ptree & tree)
static

References point(), and polygon().

Referenced by build_geometry().

◆ build_point()

static coordinate_t geojson::build_point ( boost::property_tree::ptree & tree)
static

Creates a single boost geometry point from the values in a boost property tree.

Parameters
treeA boost geometry tree that should contain the properties of a single point
Returns
A boost geometry point specified by the property tree

References point().

Referenced by build_geometry().

◆ build_polygon()

static polygon_t geojson::build_polygon ( boost::property_tree::ptree & tree)
static

References polygon().

Referenced by build_geometry().

◆ contains() [1/2]

◆ contains() [2/2]

template<typename T >
static bool geojson::contains ( const std::vector< T > & container,
const T value )
static

◆ get_geometry_type()

◆ get_propertytype_name()

◆ get_shape()

template<typename T >
T geojson::get_shape ( geometry geom)

◆ linestring()

static linestring_t geojson::linestring ( const two_dimensional_coordinates & coordinates)
static

◆ multilinestring()

static multilinestring_t geojson::multilinestring ( three_dimensional_coordinates & coordinates)
static

◆ multipoint()

static multipoint_t geojson::multipoint ( two_dimensional_coordinates & coordinates)
static

◆ multipolygon()

static multipolygon_t geojson::multipolygon ( four_dimensional_coordinates & coordinates)
static

◆ point()

static coordinate_t geojson::point ( const double x,
const double y )
static

◆ polygon()

◆ read() [1/2]

static GeoJSON geojson::read ( const std::string & file_path,
const std::vector< std::string > & ids = {} )
static

◆ read() [2/2]

static GeoJSON geojson::read ( std::stringstream & data,
const std::vector< std::string > & ids = {} )
static