OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GpkgGeometry.hpp File Reference

GeoPackage Binary geometry encoding and decoding (ISO WKB with GP header). More...

#include "core/PolygonRings.hpp"
#include <algorithm>
#include <vector>
#include <cstdint>
#include <cstring>
#include <stdexcept>
Include dependency graph for GpkgGeometry.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmm::gpkg::DecodedPoint
 
struct  openswmm::gpkg::DecodedLinestring
 
struct  openswmm::gpkg::DecodedMultipolygon
 

Namespaces

namespace  openswmm
 
namespace  openswmm::gpkg
 
namespace  openswmm::gpkg::detail
 

Enumerations

enum  openswmm::gpkg::WkbType : uint32_t {
  openswmm::gpkg::WKB_POINT = 1 ,
  openswmm::gpkg::WKB_LINESTRING = 2 ,
  openswmm::gpkg::WKB_POLYGON = 3 ,
  openswmm::gpkg::WKB_MULTIPOLYGON = 6
}
 

Functions

void openswmm::gpkg::detail::append_u8 (std::vector< uint8_t > &buf, uint8_t v)
 Append 1 native representation byte.
 
void openswmm::gpkg::detail::append_u32 (std::vector< uint8_t > &buf, uint32_t v)
 Append 4 native representation bytes.
 
void openswmm::gpkg::detail::append_f64 (std::vector< uint8_t > &buf, double v)
 Append 8 native representation bytes.
 
void openswmm::gpkg::detail::write_gp_header (std::vector< uint8_t > &buf, int32_t srs_id, double min_x, double min_y, double max_x, double max_y)
 Append a version-zero nonempty GP header with XY envelope.
 
void openswmm::gpkg::detail::write_gp_header_empty (std::vector< uint8_t > &buf, int32_t srs_id)
 Append an empty GP header without an envelope.
 
std::vector< uint8_t > openswmm::gpkg::encode_point (double x, double y, int32_t srs_id)
 Encode an XY point with a matching XY envelope.
 
std::vector< uint8_t > openswmm::gpkg::encode_linestring (const std::vector< double > &xs, const std::vector< double > &ys, int32_t srs_id)
 Encode an XY LINESTRING.
 
std::vector< uint8_t > openswmm::gpkg::encode_multipolygon (const std::vector< double > &xs, const std::vector< double > &ys, int32_t srs_id)
 Encode closed-ring spatial coordinates in MULTIPOLYGON form.
 
std::vector< uint8_t > openswmm::gpkg::encode_polygon (const std::vector< double > &xs, const std::vector< double > &ys, int32_t srs_id)
 Encode a single exterior ring in POLYGON form.
 
size_t openswmm::gpkg::detail::parse_gp_header (const uint8_t *data, size_t size, int32_t &srs_id)
 Read GP magic and envelope kind to locate the WKB payload.
 
template<typename T>
T openswmm::gpkg::detail::read_val (const uint8_t *data, size_t &offset)
 Read an unchecked native scalar and advance a byte offset.
 
DecodedPoint openswmm::gpkg::decode_point (const std::vector< uint8_t > &blob)
 Decode POINT coordinates from a prevalidated native-endian GP blob.
 
DecodedLinestring openswmm::gpkg::decode_linestring (const std::vector< uint8_t > &blob)
 Decode LINESTRING coordinates from a prevalidated native-endian GP blob.
 
DecodedMultipolygon openswmm::gpkg::decode_multipolygon (const std::vector< uint8_t > &blob)
 Decode MULTIPOLYGON coordinates from a prevalidated native-endian GP blob.
 

Variables

constexpr uint8_t openswmm::gpkg::WKB_LITTLE_ENDIAN = 1
 
constexpr uint8_t openswmm::gpkg::GP_MAGIC_1 = 0x47
 
constexpr uint8_t openswmm::gpkg::GP_MAGIC_2 = 0x50
 

Detailed Description

GeoPackage Binary geometry encoding and decoding (ISO WKB with GP header).

Encodes/decodes POINT, LINESTRING, and MULTIPOLYGON geometries in the GeoPackage Standard Binary format (Annex F of the spec).

GP Binary layout: [Magic: 2B "GP"] [Version: 1B] [Flags: 1B] [SRS ID: 4B] [Envelope: 0-64B depending on flags] [ISO WKB payload]

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0