GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
|
A Feature that represents a grouping of related features or a complex polygon. More...
#include <Relation.h>
Public Member Functions | |
Type & Identity | |
FeatureType | type () const noexcept |
FeatureType::RELATION | |
int64_t | id () const noexcept |
The ID of this Relation. | |
bool | isNode () const noexcept |
Always false | |
bool | isAnonymousNode () const noexcept |
Always false | |
bool | isWay () const noexcept |
Always false | |
bool | isRelation () const noexcept |
Always true | |
bool | isArea () const noexcept |
true if this Relation represents an area. | |
bool | belongsToRelation () const noexcept |
true if this Relation itself belongs to at least one Relation. | |
StringValue | role () const noexcept |
The Relation's role in its parent Relation, if it was returned via members() or Features::membersOf(), otherwise an empty string. | |
Display | |
const char * | typeName () const noexcept |
"node" , "way" or "relation" | |
char * | format (char *buf) const noexcept |
Formats the string representation (e.g. "node/123456" ) of this Feature into the provided buffer. | |
std::string | toString () const |
Creates a std::string with the Feature's type and ID. | |
std::string | label () const |
Creates a short descriptive label. | |
Tags | |
TagValue | operator[] (std::string_view key) const noexcept |
Obtains the tag value for the given key. | |
Tags | tags () const noexcept |
A collection of the Feature's tags. | |
bool | hasTag (std::string_view k) const noexcept |
Checks if this Feature has a tag with the given key. | |
bool | hasTag (std::string_view k, std::string_view v) const noexcept |
Checks if this Feature has a tag with the given key and value. | |
Geometry | |
Box | bounds () const noexcept |
The bounding box of this Feature. | |
Coordinate | xy () const noexcept |
The Mercator-projected x/y coordinate of a Node, or the center point of the bounding box for a Way or Relation. | |
int32_t | x () const noexcept |
The Mercator-projected x-coordinate of a Node, or the horizontal midpoint of the bounding box for a Way or Relation. | |
int32_t | y () const noexcept |
The Mercator-projected y-coordinate of a Node, or the vertical midpoint of the bounding box for a Way or Relation. | |
double | lon () const noexcept |
The longitude of this feature (in WGS-84 degrees). | |
double | lat () const noexcept |
The latitude of this feature (in WGS-84 degrees). | |
Coordinate | centroid () const |
Computes the centroid of this Feature. | |
double | area () const |
Measures the area of this Feature. | |
double | length () const |
Measures the length of this Feature. | |
GEOSGeometry * | toGeometry (GEOSContextHandle_t geosContext) const |
Creates a GEOSGeometry based on this Feature's geometry. | |
Related Features | |
Nodes | nodes () const |
The nodes of this Way. | |
Nodes | nodes (const char *query) const |
The nodes of this Way that match the given query. | |
Features | members () const |
The members of this Relation. | |
Features | members (const char *query) const |
The members of this Relation that match the given query. | |
Features | parents () const |
The parent relations of this Feature (and the parent ways for a Node). | |
Features | parents (const char *query) const |
The parent relations of this Feature (and the parent ways for a Node) that match the given query. | |
Access to the Low-Level API | |
FeaturePtr | ptr () const noexcept |
Pointer to the stored data of this Feature. | |
FeatureStore * | store () const noexcept |
Pointer to the FeatureStore which contains this Feature. | |
A Feature that represents a grouping of related features or a complex polygon.
Each Relation has one or more member features, which can be retrieved via members(). Each Feature object returned by members() has its role set to a non-empty string, if it has an explicit role in this Relation (e.g. "stop"
for a Node in a route relation that represents a bus stop).
Note: Functions that require the complete geometry of a Relation (such as area() or centroid()) may fail with a QueryException if one or more tiles that contain members of the Relation are missing.
|
inherited |
Measures the area of this Feature.
0
if the feature is not polygonal QueryException | if one or more tiles that contain the geometry of a Relation are missing |
|
noexcept |
|
noexceptinherited |
|
inherited |
Computes the centroid of this Feature.
QueryException | if one or more tiles that contain the geometry of a Relation are missing |
|
noexceptinherited |
Formats the string representation (e.g. "node/123456"
) of this Feature into the provided buffer.
Appends a null-terminator at the end of the output, and returns a pointer to the null-terminator, allowing easy concatenation.
buf | pointer to a char array of sufficient size |
buf
|
noexceptinherited |
Checks if this Feature has a tag with the given key.
|
noexceptinherited |
Checks if this Feature has a tag with the given key and value.
|
noexcept |
The ID of this Relation.
|
noexcept |
Always false
|
noexcept |
true
if this Relation represents an area.
|
noexcept |
Always false
|
noexcept |
Always true
|
noexcept |
Always false
|
inherited |
Creates a short descriptive label.
This is usually a combination of the type and name, such as hotel "Four Seasons"
.
|
noexceptinherited |
|
inherited |
Measures the length of this Feature.
0
if the feature is not lineal QueryException | if one or more tiles that contain the geometry of a Relation are missing |
|
noexceptinherited |
|
inherited |
|
inherited |
The members of this Relation that match the given query.
query | a query in GOQL format |
QueryException | if the query is malformed. |
|
inherited |
|
inherited |
The nodes of this Way that match the given query.
query | a query in GOQL format |
QueryException | if the query is malformed. |
|
noexceptinherited |
Obtains the tag value for the given key.
|
inherited |
|
inherited |
|
noexceptinherited |
Pointer to the stored data of this Feature.
If this Feature is an anonymous node, the FeaturePtr
will be a nullptr
|
noexcept |
The Relation's role in its parent Relation, if it was returned via members() or Features::membersOf(), otherwise an empty string.
|
noexceptinherited |
Pointer to the FeatureStore which contains this Feature.
|
inherited |
Creates a GEOSGeometry
based on this Feature's geometry.
Coordinates will be in Mercator projection. The caller assumes ownership of the newly created GEOSGeometry
and is responsible for its cleanup.
This method is only available if build option GEODESK_WITH_GEOS
is enabled (off by default).
geosContext | The GEOS context o use |
GEOSGeometry
|
inherited |
Creates a std::string
with the Feature's type and ID.
"node/123456"
)
|
noexcept |
|
noexceptinherited |
"node"
, "way"
or "relation"
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |