Include file

ogr_geomcoordinateprecision.h

OGRGeomCoordinatePrecision struct

struct OGRGeomCoordinatePrecision

Geometry coordinate precision.

This may affect how many decimal digits (for text-based output) or bits (for binary encodings) are used to encode geometries.

It is important to note that the coordinate precision has no direct relationship with the "physical" accuracy. It is generally advised that the resolution (precision) be at least 10 times smaller than the accuracy.

Since

GDAL 3.9

Public Functions

void SetFromMeter(const OGRSpatialReference *poSRS, double dfXYMeterResolution, double dfZMeterResolution, double dfMResolution)

Set the resolution of the geometry coordinate components.

For the X, Y and Z coordinates, the precision should be expressed in meter, e.g 1e-3 for millimetric precision.

Resolution should be stricty positive, or set to OGRGeomCoordinatePrecision::UNKNOWN when unknown.

Since

GDAL 3.9

Parameters:
  • poSRS -- Spatial reference system, used for metric to SRS unit conversion (must not be null)

  • dfXYMeterResolution -- Resolution for for X and Y coordinates, in meter.

  • dfZMeterResolution -- Resolution for for Z coordinates, in meter.

  • dfMResolutionIn -- Resolution for for M coordinates.

OGRGeomCoordinatePrecision ConvertToOtherSRS(const OGRSpatialReference *poSRSSrc, const OGRSpatialReference *poSRSDst) const

Return equivalent coordinate precision setting taking into account a change of SRS.

Since

GDAL 3.9

Parameters:
  • poSRSSrc -- Spatial reference system of the current instance (if null, meter unit is assumed)

  • poSRSDst -- Spatial reference system of the returned instance (if null, meter unit is assumed)

Returns:

a new OGRGeomCoordinatePrecision instance, with a poSRSDst SRS.

Public Members

double dfXYResolution = UNKNOWN

Resolution for the coordinate precision of the X and Y coordinates.

Expressed in the units of the X and Y axis of the SRS. For example for a projected SRS with X,Y axis unit in meter, a value of 1e-3 corresponds to a 1 mm precision. For a geographic SRS (on Earth) with axis unit in degree, a value of 8.9e-9 (degree) also corresponds to a 1 mm precision. Set to UNKNOWN if unknown.

double dfZResolution = UNKNOWN

Resolution for the coordinate precision of the Z coordinate.

Expressed in the units of the Z axis of the SRS. Set to UNKNOWN if unknown.

double dfMResolution = UNKNOWN

Resolution for the coordinate precision of the M coordinate.

Set to UNKNOWN if unknown.

std::map<std::string, CPLStringList> oFormatSpecificOptions = {}

Map from a format name to a list of format specific options.

This can be for example used to store FileGeodatabase xytolerance, xorigin, yorigin, etc. coordinate precision grids options, which can be help to maximize preservation of coordinates in FileGDB -> FileGDB conversion processes.

Public Static Functions

static int ResolutionToPrecision(double dfResolution)

Return the number of decimal digits after the decimal point to get the specified resolution.

Since

GDAL 3.9

Public Static Attributes

static constexpr double UNKNOWN = 0

Constant for a UNKNOWN resolution.