SpatiaLite  5.0.0
Functions
gg_formats.h File Reference

Geometry handling functions: formats. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

GAIAGEO_DECLARE int gaiaEndianArch (void)
 Test CPU endianness. More...
 
GAIAGEO_DECLARE short gaiaImport16 (const unsigned char *p, int little_endian, int little_endian_arch)
 Import an INT-16 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE int gaiaImport32 (const unsigned char *p, int little_endian, int little_endian_arch)
 Import an INT-32 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE unsigned int gaiaImportU32 (const unsigned char *p, int little_endian, int little_endian_arch)
 Import an UINT-32 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE float gaiaImportF32 (const unsigned char *p, int little_endian, int little_endian_arch)
 Import a FLOAT-32 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE double gaiaImport64 (const unsigned char *p, int little_endian, int little_endian_arch)
 Import an DOUBLE-64 in endian-aware fashion. More...
 
GAIAGEO_DECLARE sqlite3_int64 gaiaImportI64 (const unsigned char *p, int little_endian, int little_endian_arch)
 Import an INT-64 in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaExport16 (unsigned char *p, short value, int little_endian, int little_endian_arch)
 Export an INT-16 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaExport32 (unsigned char *p, int value, int little_endian, int little_endian_arch)
 Export an INT-32 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaExportU32 (unsigned char *p, unsigned int value, int little_endian, int little_endian_arch)
 Export an UINT-32 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaExportF32 (unsigned char *p, float value, int little_endian, int little_endian_arch)
 Export a FLOAT-32 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaExport64 (unsigned char *p, double value, int little_endian, int little_endian_arch)
 Export a DOUBLE value in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaExportI64 (unsigned char *p, sqlite3_int64 value, int little_endian, int little_endian_arch)
 Export an INT-64 value in endian-aware fashion. More...
 
GAIAGEO_DECLARE void gaiaOutBufferInitialize (gaiaOutBufferPtr buf)
 Initializes a dynamically growing Text output buffer. More...
 
GAIAGEO_DECLARE void gaiaOutBufferReset (gaiaOutBufferPtr buf)
 Resets a dynamically growing Text output buffer to its initial (empty) state. More...
 
GAIAGEO_DECLARE void gaiaAppendToOutBuffer (gaiaOutBufferPtr buf, const char *text)
 Appends a text string at the end of Text output buffer. More...
 
GAIAGEO_DECLARE void gaiaMakePoint (double x, double y, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a Point (BLOB-Geometry) More...
 
GAIAGEO_DECLARE void gaiaMakePointZ (double x, double y, double z, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a PointZ (BLOB-Geometry) More...
 
GAIAGEO_DECLARE void gaiaMakePointM (double x, double y, double m, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a PointM (BLOB-Geometry) More...
 
GAIAGEO_DECLARE void gaiaMakePointZM (double x, double y, double z, double m, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a PointZM (BLOB-Geometry) More...
 
GAIAGEO_DECLARE void gaiaMakePointEx (int tiny_point, double x, double y, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a Point (BLOB-Geometry or BLOB-TinyPoint) More...
 
GAIAGEO_DECLARE void gaiaMakePointZEx (int tiny_point, double x, double y, double z, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a PointZ (BLOB-Geometry or BLOB-TinyPoint) More...
 
GAIAGEO_DECLARE void gaiaMakePointMEx (int tiny_point, double x, double y, double m, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a PointM (BLOB-Geometry or BLOB-TinyPoint) More...
 
GAIAGEO_DECLARE void gaiaMakePointZMEx (int tiny_point, double x, double y, double z, double m, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a PointZM (BLOB-Geometry or BLOB-TinyPoint) More...
 
GAIAGEO_DECLARE void gaiaMakeLine (gaiaGeomCollPtr geom1, gaiaGeomCollPtr geom2, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing a Segment (2-Points Linestring) More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkb (const unsigned char *blob, unsigned int size)
 Creates a Geometry object from the corresponding BLOB-Geometry. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkbEx (const unsigned char *blob, unsigned int size, int gpkg_mode, int gpkg_amphibious)
 Creates a Geometry object from the corresponding BLOB-Geometry. More...
 
GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkb (gaiaGeomCollPtr geom, unsigned char **result, int *size)
 Creates a BLOB-Geometry corresponding to a Geometry object. More...
 
GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx (gaiaGeomCollPtr geom, unsigned char **result, int *size, int gpkg_mode)
 Creates a BLOB-Geometry corresponding to a Geometry object. More...
 
GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx2 (gaiaGeomCollPtr geom, unsigned char **result, int *size, int gpkg_mode, int tiny_point)
 Creates a BLOB-Geometry corresponding to a Geometry object. More...
 
GAIAGEO_DECLARE void gaiaToCompressedBlobWkb (gaiaGeomCollPtr geom, unsigned char **result, int *size)
 Creates a Compressed BLOB-Geometry corresponding to a Geometry object. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromWkb (const unsigned char *blob, unsigned int size)
 Creates a Geometry object from WKB notation. More...
 
GAIAGEO_DECLARE void gaiaToWkb (gaiaGeomCollPtr geom, unsigned char **result, int *size)
 Encodes a Geometry object into WKB notation. More...
 
GAIAGEO_DECLARE char * gaiaToHexWkb (gaiaGeomCollPtr geom)
 Encodes a Geometry object into (hex) WKB notation. More...
 
GAIAGEO_DECLARE void gaiaToEWKB (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom)
 Encodes a Geometry object into EWKB notation. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromEWKB (const unsigned char *in_buffer)
 Creates a Geometry object from EWKB notation. More...
 
GAIAGEO_DECLARE unsigned char * gaiaParseHexEWKB (const unsigned char *blob_hex, int *blob_size)
 Translates an EWKB notation from hexadecimal into binary. More...
 
GAIAGEO_DECLARE int gaiaEwkbGetPoint (gaiaGeomCollPtr geom, unsigned char *blob, int offset, int blob_size, int endian, int endian_arch, int dims)
 Attempts to decode a Point from within an EWKB binary buffer. More...
 
GAIAGEO_DECLARE int gaiaEwkbGetLinestring (gaiaGeomCollPtr geom, unsigned char *blob, int offset, int blob_size, int endian, int endian_arch, int dims)
 Attempts to decode a Point from within an EWKB binary buffer. More...
 
GAIAGEO_DECLARE int gaiaEwkbGetPolygon (gaiaGeomCollPtr geom, unsigned char *blob, int offset, int blob_size, int endian, int endian_arch, int dims)
 Attempts to decode a Polygon from within an EWKB binary buffer. More...
 
GAIAGEO_DECLARE int gaiaEwkbGetMultiGeometry (gaiaGeomCollPtr geom, unsigned char *blob, int offset, int blob_size, int endian, int endian_arch, int dims)
 Attempts to decode a MultiGeometry from within an EWKB binary buffer. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromFgf (const unsigned char *blob, unsigned int size)
 Creates a Geometry object from FGF notation. More...
 
GAIAGEO_DECLARE void gaiaToFgf (gaiaGeomCollPtr geom, unsigned char **result, int *size, int coord_dims)
 Encodes a Geometry object into FGF notation. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseWkt (const unsigned char *in_buffer, short type)
 Creates a Geometry object from WKT notation. More...
 
GAIAGEO_DECLARE void gaiaOutWkt (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom)
 Encodes a Geometry object into WKT notation. More...
 
GAIAGEO_DECLARE void gaiaOutWktEx (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom, int precision)
 Encodes a Geometry object into WKT notation. More...
 
GAIAGEO_DECLARE void gaiaOutWktStrict (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom, int precision)
 Encodes a Geometry object into strict 2D WKT notation. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseEWKT (const unsigned char *in_buffer)
 Creates a Geometry object from EWKT notation. More...
 
GAIAGEO_DECLARE void gaiaToEWKT (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom)
 Encodes a Geometry object into EWKT notation. More...
 
GAIAGEO_DECLARE void gaiaOutPointZ (gaiaOutBufferPtr out_buf, gaiaPointPtr point)
 Encodes a WKT 3D Point [XYZ]. More...
 
GAIAGEO_DECLARE void gaiaOutPointZex (gaiaOutBufferPtr out_buf, gaiaPointPtr point, int precision)
 Encodes a WKT 3D Point [XYZ]. More...
 
GAIAGEO_DECLARE void gaiaOutLinestringZ (gaiaOutBufferPtr out_buf, gaiaLinestringPtr linestring)
 Encodes a WKT 3D Linestring [XYZ]. More...
 
GAIAGEO_DECLARE void gaiaOutLinestringZex (gaiaOutBufferPtr out_buf, gaiaLinestringPtr linestring, int precision)
 Encodes a WKT 3D Linestring [XYZ]. More...
 
GAIAGEO_DECLARE void gaiaOutPolygonZ (gaiaOutBufferPtr out_buf, gaiaPolygonPtr polygon)
 Encodes a WKT 3D Polygon [XYZ]. More...
 
GAIAGEO_DECLARE void gaiaOutPolygonZex (gaiaOutBufferPtr out_buf, gaiaPolygonPtr polygon, int precision)
 Encodes a WKT 3D Polygon [XYZ]. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseKml (const unsigned char *in_buffer)
 Creates a Geometry object from KML notation. More...
 
GAIAGEO_DECLARE void gaiaOutBareKml (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom, int precision)
 Encodes a Geometry object into KML notation. More...
 
GAIAGEO_DECLARE void gaiaOutFullKml (gaiaOutBufferPtr out_buf, const char *name, const char *desc, gaiaGeomCollPtr geom, int precision)
 Encodes a Geometry object into KML notation. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml (const unsigned char *in_buffer, sqlite3 *sqlite_handle)
 Creates a Geometry object from GML notation. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml_r (const void *p_cache, const unsigned char *in_buffer, sqlite3 *sqlite_handle)
 Creates a Geometry object from GML notation. More...
 
GAIAGEO_DECLARE void gaiaOutGml (gaiaOutBufferPtr out_buf, int version, int precision, gaiaGeomCollPtr geom)
 Encodes a Geometry object into GML notation. More...
 
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGeoJSON (const unsigned char *in_buffer)
 Creates a Geometry object from GeoJSON notation. More...
 
GAIAGEO_DECLARE void gaiaOutGeoJSON (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom, int precision, int options)
 Encodes a Geometry object into GeoJSON notation. More...
 
GAIAGEO_DECLARE void gaiaOutSvg (gaiaOutBufferPtr out_buf, gaiaGeomCollPtr geom, int relative, int precision)
 Encodes a Geometry object into SVG notation. More...
 
GAIAGEO_DECLARE gaiaValuePtr gaiaCloneValue (gaiaValuePtr org)
 Allocates a new DBF Field Value object [duplicating an existing one]. More...
 
GAIAGEO_DECLARE void gaiaFreeValue (gaiaValuePtr p)
 Resets a DBF Field Value object to its initial empty state. More...
 
GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAllocDbfField (char *name, unsigned char type, int offset, unsigned char length, unsigned char decimals)
 Allocates a new DBF Field object. More...
 
GAIAGEO_DECLARE void gaiaFreeDbfField (gaiaDbfFieldPtr p)
 Destroys a DBF Field object. More...
 
GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaCloneDbfField (gaiaDbfFieldPtr org)
 Allocates a new DBF Field object [duplicating an existing one]. More...
 
GAIAGEO_DECLARE void gaiaSetNullValue (gaiaDbfFieldPtr field)
 Sets a NULL current value for a DBF Field object. More...
 
GAIAGEO_DECLARE void gaiaSetIntValue (gaiaDbfFieldPtr field, sqlite3_int64 value)
 Sets an INTEGER current value for a DBF Field object. More...
 
GAIAGEO_DECLARE void gaiaSetDoubleValue (gaiaDbfFieldPtr field, double value)
 Sets a DOUBLE current value for a DBF Field object. More...
 
GAIAGEO_DECLARE void gaiaSetStrValue (gaiaDbfFieldPtr field, char *str)
 Sets a TEXT current value for a DBF Field object. More...
 
GAIAGEO_DECLARE gaiaDbfListPtr gaiaAllocDbfList (void)
 Creates an initially empty DBF List object. More...
 
GAIAGEO_DECLARE void gaiaFreeDbfList (gaiaDbfListPtr list)
 Destroys a DBF List object. More...
 
GAIAGEO_DECLARE int gaiaIsValidDbfList (gaiaDbfListPtr list)
 Checks a DBF List object for validity. More...
 
GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAddDbfField (gaiaDbfListPtr list, char *name, unsigned char type, int offset, unsigned char length, unsigned char decimals)
 Inserts a further DBF Field object into a DBF List object. More...
 
GAIAGEO_DECLARE void gaiaResetDbfEntity (gaiaDbfListPtr list)
 Resets a DBF List object to its initial empty state. More...
 
GAIAGEO_DECLARE gaiaDbfListPtr gaiaCloneDbfEntity (gaiaDbfListPtr org)
 Allocates a new DBF List object [duplicating an existing one]. More...
 
GAIAGEO_DECLARE gaiaShapefilePtr gaiaAllocShapefile (void)
 Allocates a new Shapefile object. More...
 
GAIAGEO_DECLARE void gaiaFreeShapefile (gaiaShapefilePtr shp)
 Destroys a Shapefile object. More...
 
GAIAGEO_DECLARE void gaiaOpenShpRead (gaiaShapefilePtr shp, const char *path, const char *charFrom, const char *charTo)
 Open a Shapefile in read mode. More...
 
GAIAGEO_DECLARE void gaiaOpenShpWriteEx (gaiaShapefilePtr shp, const char *path, int shape, gaiaDbfListPtr list, const char *charFrom, const char *charTo, int colname_case)
 Open a Shapefile in write mode - extended. More...
 
GAIAGEO_DECLARE void gaiaOpenShpWrite (gaiaShapefilePtr shp, const char *path, int shape, gaiaDbfListPtr list, const char *charFrom, const char *charTo)
 Open a Shapefile in write mode. More...
 
GAIAGEO_DECLARE int gaiaReadShpEntity (gaiaShapefilePtr shp, int current_row, int srid)
 Reads a feature from a Shapefile object. More...
 
GAIAGEO_DECLARE int gaiaReadShpEntity_ex (gaiaShapefilePtr shp, int current_row, int srid, int text_dates)
 Reads a feature from a Shapefile object. More...
 
GAIAGEO_DECLARE void gaiaShpAnalyze (gaiaShapefilePtr shp)
 Prescans a Shapefile object gathering informations. More...
 
GAIAGEO_DECLARE int gaiaWriteShpEntity (gaiaShapefilePtr shp, gaiaDbfListPtr entity)
 Writes a feature into a Shapefile object. More...
 
GAIAGEO_DECLARE void gaiaFlushShpHeaders (gaiaShapefilePtr shp)
 Writes into an output Shapefile any required header / footer. More...
 
GAIAGEO_DECLARE gaiaDbfPtr gaiaAllocDbf (void)
 Allocates a new DBF File object. More...
 
GAIAGEO_DECLARE void gaiaFreeDbf (gaiaDbfPtr dbf)
 Destroys a DBF File object. More...
 
GAIAGEO_DECLARE void gaiaOpenDbfRead (gaiaDbfPtr dbf, const char *path, const char *charFrom, const char *charTo)
 Open a DBF File in read mode. More...
 
GAIAGEO_DECLARE gaiaDbfPtr gaiaOpenZipDbf (const char *zip_path, const char *filename, const char *charFrom, const char *charTo)
 Open a DBF File contained within a Zipfile (just for checking its fields) More...
 
GAIAGEO_DECLARE void gaiaOpenDbfWriteEx (gaiaDbfPtr dbf, const char *path, const char *charFrom, const char *charTo, int colname_case)
 Open a DBF File in write mode,- extended. More...
 
GAIAGEO_DECLARE void gaiaOpenDbfWrite (gaiaDbfPtr dbf, const char *path, const char *charFrom, const char *charTo)
 Open a DBF File in write mode. More...
 
GAIAGEO_DECLARE int gaiaReadDbfEntity (gaiaDbfPtr dbf, int current_row, int *deleted)
 Reads a record from a DBF File object. More...
 
GAIAGEO_DECLARE int gaiaReadDbfEntity_ex (gaiaDbfPtr dbf, int current_row, int *deleted, int text_dates)
 Reads a record from a DBF File object. More...
 
GAIAGEO_DECLARE int gaiaWriteDbfEntity (gaiaDbfPtr dbf, gaiaDbfListPtr entity)
 Writes a record into a DBF File object. More...
 
GAIAGEO_DECLARE void gaiaFlushDbfHeader (gaiaDbfPtr dbf)
 Writes into an output DBF File any required header / footer. More...
 
GAIAGEO_DECLARE size_t gaiaMemRead (void *ptr, size_t bytes, gaiaMemFilePtr mem)
 Reads from a Memory File. More...
 
GAIAGEO_DECLARE int gaiaMemFseek (gaiaMemFilePtr mem, long offset)
 Repositioning a Memory File. More...
 
GAIAGEO_DECLARE char * gaiaReadWktFromZipShp (const char *zip_path, const char *basename)
 Attempting to get a WKT from the .PRJ member of a given zipped Shapefile. More...
 
GAIAGEO_DECLARE int gaiaZipfileNumSHP (const char *zip_path, int *count)
 Will return the number of Shapefiles from within a given Zipfile. More...
 
GAIAGEO_DECLARE char * gaiaZipfileShpN (const char *zip_path, int idx)
 Will return the basename of the Nth Shapefile from within a given Zipfile. More...
 
GAIAGEO_DECLARE int gaiaZipfileNumDBF (const char *zip_path, int *count)
 Will return the number of DBF files from within a given Zipfile. More...
 
GAIAGEO_DECLARE char * gaiaZipfileDbfN (const char *zip_path, int idx)
 Will return the filename of the Nth DBF file from within a given Zipfile. More...
 
GAIAGEO_DECLARE gaiaTextReaderPtr gaiaTextReaderAlloc (const char *path, char field_separator, char text_separator, char decimal_separator, int first_line_titles, const char *encoding)
 Creates a Text Reader object. More...
 
GAIAGEO_DECLARE void gaiaTextReaderDestroy (gaiaTextReaderPtr reader)
 Destroys a Text Reader object. More...
 
GAIAGEO_DECLARE int gaiaTextReaderParse (gaiaTextReaderPtr reader)
 Prescans the external file associated to a Text Reade object. More...
 
GAIAGEO_DECLARE int gaiaTextReaderGetRow (gaiaTextReaderPtr reader, int row_num)
 Reads a line from a Text Reader object. More...
 
GAIAGEO_DECLARE int gaiaTextReaderFetchField (gaiaTextReaderPtr reader, int field_num, int *type, const char **value)
 Retrieves an individual field value from the current Line. More...
 

Detailed Description

Geometry handling functions: formats.

Function Documentation

◆ gaiaAddDbfField()

GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAddDbfField ( gaiaDbfListPtr  list,
char *  name,
unsigned char  type,
int  offset,
unsigned char  length,
unsigned char  decimals 
)

Inserts a further DBF Field object into a DBF List object.

Parameters
listpointer to the DBF List object.
nametext string: DBF Field name.
typeidentifier of the corresponding DBF data type.
offsetcorresponding offset into the DBF I/O buffer.
lengthmax field length (in bytes).
decimalsprecision: number of decimal digits.
Returns
the pointer to newly created DBF Field object.
See also
gaiaAllocDbfField
Note
supported DBF data types are:
  • 'C' text string [default]
  • 'N' numeric
  • 'D' date
  • 'L' boolean

◆ gaiaAllocDbf()

GAIAGEO_DECLARE gaiaDbfPtr gaiaAllocDbf ( void  )

Allocates a new DBF File object.

Returns
the pointer to newly created DBF File object.
See also
gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite, gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
Note
you are responsible to destroy (before or after) any allocated DBF File.
you should phisically open the DBF File in read or write mode before performing any actual I/O operation.

◆ gaiaAllocDbfField()

GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAllocDbfField ( char *  name,
unsigned char  type,
int  offset,
unsigned char  length,
unsigned char  decimals 
)

Allocates a new DBF Field object.

Parameters
nametext string: DBF Field name.
typeidentifier of the corresponding DBF data type.
offsetcorresponding offset into the DBF I/O buffer.
lengthmax field length (in bytes).
decimalsprecision: number of decimal digits.
Returns
the pointer to newly created DBF Field object.
See also
gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue, gaiaSetStrValue
Note
you are responsible to destroy (before or after) any allocated DBF Field, unless you've passed ownership to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.


supported DBF data types are:

  • 'C' text string [default]
  • 'N' numeric
  • 'D' date
  • 'L' boolean

◆ gaiaAllocDbfList()

GAIAGEO_DECLARE gaiaDbfListPtr gaiaAllocDbfList ( void  )

Creates an initially empty DBF List object.

Returns
the pointer to newly allocated DBF List object: NULL on failure.
See also
gaiaFreeDbfList, gaiaIsValidDbfList, gaiaResetDbfEntity, gaiaCloneDbfEntity, gaiaAddDbfField
Note
you are responsible to destroy (before or after) any allocated DBF List, unless you've passed ownership to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaAllocShapefile()

GAIAGEO_DECLARE gaiaShapefilePtr gaiaAllocShapefile ( void  )

Allocates a new Shapefile object.

Returns
the pointer to newly created Shapefile object.
See also
gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
Note
you are responsible to destroy (before or after) any allocated Shapefile.
you should phisically open the Shapefile in read or write mode before performing any actual I/O operation.

◆ gaiaAppendToOutBuffer()

GAIAGEO_DECLARE void gaiaAppendToOutBuffer ( gaiaOutBufferPtr  buf,
const char *  text 
)

Appends a text string at the end of Text output buffer.

Parameters
bufpointer to gaiaOutBufferStruct structure.
textthe text string to be appended.
See also
gaiaOutBufferInitialize, gaiaOutBufferReset
Note
You are required to initialize this structure before attempting any further operation: the dynamically growing Text buffer will be automatically allocated and/or extended as required.

◆ gaiaCloneDbfEntity()

GAIAGEO_DECLARE gaiaDbfListPtr gaiaCloneDbfEntity ( gaiaDbfListPtr  org)

Allocates a new DBF List object [duplicating an existing one].

Parameters
orgpointer to input DBF List object.
Returns
the pointer to newly created DBF List object.
See also
gaiaCloneDbfField, gaiaCloneValue,
Note
the newly created object is an exact copy of the original one.
this including any currently set Field Value.

◆ gaiaCloneDbfField()

GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaCloneDbfField ( gaiaDbfFieldPtr  org)

Allocates a new DBF Field object [duplicating an existing one].

Parameters
orgpointer to input DBF Field object.
Returns
the pointer to newly created DBF Field object.
See also
gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue, gaiaSetStrValue
Note
the newly created object is an exact copy of the original one [this including an evantual Field Value].

◆ gaiaCloneValue()

GAIAGEO_DECLARE gaiaValuePtr gaiaCloneValue ( gaiaValuePtr  org)

Allocates a new DBF Field Value object [duplicating an existing one].

Parameters
orgpointer to input DBF Field Value object.
Returns
the pointer to newly created DBF Field object.
See also
gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaCloneValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue, gaiaSetStrValue
Note
the newly created object is an exact copy of the original one.

◆ gaiaEndianArch()

GAIAGEO_DECLARE int gaiaEndianArch ( void  )

Test CPU endianness.

Returns
0 if big-endian: any other value if little-endian

◆ gaiaEwkbGetLinestring()

GAIAGEO_DECLARE int gaiaEwkbGetLinestring ( gaiaGeomCollPtr  geom,
unsigned char *  blob,
int  offset,
int  blob_size,
int  endian,
int  endian_arch,
int  dims 
)

Attempts to decode a Point from within an EWKB binary buffer.

Parameters
geompointer to an existing Geometry object; if succesfull the parsed Linestring will be inserted into this Geometry
blobpointer to EWKB input buffer
offsetthe offset (in bytes) on the input buffer where the Point definition is expected to start.
blob_sizelenght (in bytes) of the input buffer.
endian(boolean) states if the EWKB input buffer is little- or big-endian encode.
endian_arch(boolean) states if the target CPU has a little- or big-endian architecture.
dimsdimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
Returns
-1 on failure; otherwise the offset where the next object starts.
See also
gaiaEwkbGetPoint, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
Note
these functions are mainly intended for internal usage.

◆ gaiaEwkbGetMultiGeometry()

GAIAGEO_DECLARE int gaiaEwkbGetMultiGeometry ( gaiaGeomCollPtr  geom,
unsigned char *  blob,
int  offset,
int  blob_size,
int  endian,
int  endian_arch,
int  dims 
)

Attempts to decode a MultiGeometry from within an EWKB binary buffer.

Parameters
geompointer to an existing Geometry object; if succesfull the parsed MultiGeometry will be inserted into this Geometry
blobpointer to EWKB input buffer
offsetthe offset (in bytes) on the input buffer where the Point definition is expected to start.
blob_sizelenght (in bytes) of the input buffer.
endian(boolean) states if the EWKB input buffer is little- or big-endian encode.
endian_arch(boolean) states if the target CPU has a little- or big-endian architecture.
dimsdimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
Returns
-1 on failure; otherwise the offset where the next object starts.
See also
gaiaEwkbGetPoint, gaiaEwkbGetLinestring, gaiaEwkbGetPolygon
Note
these functions are mainly intended for internal usage.

◆ gaiaEwkbGetPoint()

GAIAGEO_DECLARE int gaiaEwkbGetPoint ( gaiaGeomCollPtr  geom,
unsigned char *  blob,
int  offset,
int  blob_size,
int  endian,
int  endian_arch,
int  dims 
)

Attempts to decode a Point from within an EWKB binary buffer.

Parameters
geompointer to an existing Geometry object; if succesfull the parsed Point will be inserted into this Geometry
blobpointer to EWKB input buffer
offsetthe offset (in bytes) on the input buffer where the Point definition is expected to start.
blob_sizelenght (in bytes) of the input buffer.
endian(boolean) states if the EWKB input buffer is little- or big-endian encode.
endian_arch(boolean) states if the target CPU has a little- or big-endian architecture.
dimsdimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
Returns
-1 on failure; otherwise the offset where the next object starts.
See also
gaiaEwkbGetLinestring, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
Note
these functions are mainly intended for internal usage.

◆ gaiaEwkbGetPolygon()

GAIAGEO_DECLARE int gaiaEwkbGetPolygon ( gaiaGeomCollPtr  geom,
unsigned char *  blob,
int  offset,
int  blob_size,
int  endian,
int  endian_arch,
int  dims 
)

Attempts to decode a Polygon from within an EWKB binary buffer.

Parameters
geompointer to an existing Geometry object; if succesfull the parsed Polygon will be inserted into this Geometry
blobpointer to EWKB input buffer
offsetthe offset (in bytes) on the input buffer where the Point definition is expected to start.
blob_sizelenght (in bytes) of the input buffer.
endian(boolean) states if the EWKB input buffer is little- or big-endian encode.
endian_arch(boolean) states if the target CPU has a little- or big-endian architecture.
dimsdimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
Returns
-1 on failure; otherwise the offset where the next object starts.
See also
gaiaEwkbGetPoint, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry

◆ gaiaExport16()

GAIAGEO_DECLARE void gaiaExport16 ( unsigned char *  p,
short  value,
int  little_endian,
int  little_endian_arch 
)

Export an INT-16 value in endian-aware fashion.

Parameters
pendian-dependent representation (output buffer).
valuethe internal value to be exported.
little_endian0 if the output buffer has to be big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
See also
gaiaEndianArch, gaiaImport16
Note
you are expected to pass an output buffer corresponding to an allocation size of (at least) 2 bytes.

◆ gaiaExport32()

GAIAGEO_DECLARE void gaiaExport32 ( unsigned char *  p,
int  value,
int  little_endian,
int  little_endian_arch 
)

Export an INT-32 value in endian-aware fashion.

Parameters
pendian-dependent representation (output buffer).
valuethe internal value to be exported.
little_endian0 if the output buffer has to be big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
See also
gaiaEndianArch, gaiaImport32
Note
you are expected to pass an output buffer corresponding to an allocation size of (at least) 4 bytes.

◆ gaiaExport64()

GAIAGEO_DECLARE void gaiaExport64 ( unsigned char *  p,
double  value,
int  little_endian,
int  little_endian_arch 
)

Export a DOUBLE value in endian-aware fashion.

Parameters
pendian-dependent representation (output buffer).
valuethe internal value to be exported.
little_endian0 if the output buffer has to be big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
See also
gaiaEndianArch, gaiaImport64
Note
you are expected to pass an output buffer corresponding to an allocation size of (at least) 8 bytes.

◆ gaiaExportF32()

GAIAGEO_DECLARE void gaiaExportF32 ( unsigned char *  p,
float  value,
int  little_endian,
int  little_endian_arch 
)

Export a FLOAT-32 value in endian-aware fashion.

Parameters
pendian-dependent representation (output buffer).
valuethe internal value to be exported.
little_endian0 if the output buffer has to be big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
See also
gaiaEndianArch, gaiaImportF32
Note
you are expected to pass an output buffer corresponding to an allocation size of (at least) 4 bytes.

◆ gaiaExportI64()

GAIAGEO_DECLARE void gaiaExportI64 ( unsigned char *  p,
sqlite3_int64  value,
int  little_endian,
int  little_endian_arch 
)

Export an INT-64 value in endian-aware fashion.

Parameters
pendian-dependent representation (output buffer).
valuethe internal value to be exported.
little_endian0 if the output buffer has to be big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
See also
gaiaEndianArch, gaiaImportI64
Note
you are expected to pass an output buffer corresponding to an allocation size of (at least) 8 bytes.

◆ gaiaExportU32()

GAIAGEO_DECLARE void gaiaExportU32 ( unsigned char *  p,
unsigned int  value,
int  little_endian,
int  little_endian_arch 
)

Export an UINT-32 value in endian-aware fashion.

Parameters
pendian-dependent representation (output buffer).
valuethe internal value to be exported.
little_endian0 if the output buffer has to be big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
See also
gaiaEndianArch, gaiaImportU32
Note
you are expected to pass an output buffer corresponding to an allocation size of (at least) 4 bytes.

◆ gaiaFlushDbfHeader()

GAIAGEO_DECLARE void gaiaFlushDbfHeader ( gaiaDbfPtr  dbf)

Writes into an output DBF File any required header / footer.

Parameters
dbfpointer to the DBF File object.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite, gaiaReadDbfEntity, gaiaWriteDbfEntity
Note
forgetting to call gaiaFlushDbfHeader for any DBF File opened in write mode immediately before destroying the object, will surely cause severe file corruption.

◆ gaiaFlushShpHeaders()

GAIAGEO_DECLARE void gaiaFlushShpHeaders ( gaiaShapefilePtr  shp)

Writes into an output Shapefile any required header / footer.

Parameters
shppointer to the Shapefile object.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity
Note
forgetting to call gaiaFlushShpHeader for any Shapefile opened in write mode immediately before destroying the object, will surely cause severe file corruption.

◆ gaiaFreeDbf()

GAIAGEO_DECLARE void gaiaFreeDbf ( gaiaDbfPtr  dbf)

Destroys a DBF File object.

Parameters
dbfpointer to the DBF File object.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfWrite, gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
Note
destroying the Shapefile object will close any related file: anyway you a responsible to explicitly call gaiaFlushShpHeader before destroyng a Shapefile opened in write mode.

◆ gaiaFreeDbfField()

GAIAGEO_DECLARE void gaiaFreeDbfField ( gaiaDbfFieldPtr  p)

Destroys a DBF Field object.

Parameters
ppointer to DBF Field object
See also
gaiaAllocDbfField, gaiaCloneDbfField, gaiaCloneValue, gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue, gaiaSetStrValue

◆ gaiaFreeDbfList()

GAIAGEO_DECLARE void gaiaFreeDbfList ( gaiaDbfListPtr  list)

Destroys a DBF List object.

Parameters
listpointer to the DBF List object
See also
gaiaAllocDbfList, gaiaIsValidDbfList, gaiaResetDbfEntity, gaiaCloneDbfEntity, gaiaAddDbfField
Note
attempting to destroy any DBF List object whose ownnership has already been transferred to some other (higher order) object is a serious error, and will easily cause severe memory corruption.

◆ gaiaFreeShapefile()

GAIAGEO_DECLARE void gaiaFreeShapefile ( gaiaShapefilePtr  shp)

Destroys a Shapefile object.

Parameters
shppointer to the Shapefile object.
See also
gaiaAllocShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
Note
destroying the Shapefile object will close any related file: anyway you a responsible to explicitly call gaiaFlushShpHeader before destroyng a Shapefile opened in write mode.

◆ gaiaFreeValue()

GAIAGEO_DECLARE void gaiaFreeValue ( gaiaValuePtr  p)

Resets a DBF Field Value object to its initial empty state.

Parameters
ppointer to DBF Field Value object
See also
gaiaAllocDbfField, gaiaCloneDbfField, gaiaCloneValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue, gaiaSetStrValue, gaiaResetDbfEntity

◆ gaiaFromEWKB()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromEWKB ( const unsigned char *  in_buffer)

Creates a Geometry object from EWKB notation.

Parameters
in_bufferpointer to EWKB buffer
Returns
the pointer to the newly created Geometry object: NULL on failure.
See also
gaiaToWkb, gaiaToHexWkb, gaiaParseHexEWKB, gaiaToEWKB, gaiaEwkbGetPoint, gaiaEwkbGetLinestring, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaFromFgf()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromFgf ( const unsigned char *  blob,
unsigned int  size 
)

Creates a Geometry object from FGF notation.

Parameters
blobpointer to FGF buffer
sizethe BLOB's size (in bytes)
Returns
the pointer to the newly created Geometry object: NULL on failure.
See also
gaiaToFgf
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaFromSpatiaLiteBlobWkb()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkb ( const unsigned char *  blob,
unsigned int  size 
)

Creates a Geometry object from the corresponding BLOB-Geometry.

Parameters
blobpointer to BLOB-Geometry
sizethe BLOB's size
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaFreeGeomColl, gaiaToSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb, gaiaFromSpatiaLiteBlobWkbEx
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.
Examples
demo1.c.

◆ gaiaFromSpatiaLiteBlobWkbEx()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkbEx ( const unsigned char *  blob,
unsigned int  size,
int  gpkg_mode,
int  gpkg_amphibious 
)

Creates a Geometry object from the corresponding BLOB-Geometry.

Parameters
blobpointer to BLOB-Geometry
sizethe BLOB's size
gpkg_modeis set to TRUE will accept only GPKG Geometry-BLOBs
gpkg_amphibiousis set to TRUE will indifferenctly accept either SpatiaLite Geometry-BLOBs or GPKG Geometry-BLOBs
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaFreeGeomColl, gaiaToSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaFromWkb()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromWkb ( const unsigned char *  blob,
unsigned int  size 
)

Creates a Geometry object from WKB notation.

Parameters
blobpointer to WKB buffer
sizethe BLOB's size (in bytes)
Returns
the pointer to the newly created Geometry object: NULL on failure.
See also
gaiaToWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaImport16()

GAIAGEO_DECLARE short gaiaImport16 ( const unsigned char *  p,
int  little_endian,
int  little_endian_arch 
)

Import an INT-16 value in endian-aware fashion.

Parameters
pendian-dependent representation (input buffer).
little_endian0 if the input buffer is big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
Returns
the internal SHORT value
See also
gaiaEndianArch, gaiaExport16
Note
you are expected to pass an input buffer corresponding to an allocation size of (at least) 2 bytes.

◆ gaiaImport32()

GAIAGEO_DECLARE int gaiaImport32 ( const unsigned char *  p,
int  little_endian,
int  little_endian_arch 
)

Import an INT-32 value in endian-aware fashion.

Parameters
pendian-dependent representation (input buffer).
little_endian0 if the input buffer is big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
Returns
the internal INT value
See also
gaiaEndianArch, gaiaExport32
Note
you are expected to pass an input buffer corresponding to an allocation size of (at least) 4 bytes.

◆ gaiaImport64()

GAIAGEO_DECLARE double gaiaImport64 ( const unsigned char *  p,
int  little_endian,
int  little_endian_arch 
)

Import an DOUBLE-64 in endian-aware fashion.

Parameters
pendian-dependent representation (input buffer).
little_endian0 if the input buffer is big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
Returns
the internal DOUBLE value
See also
gaiaEndianArch, gaiaExport64
Note
you are expected to pass an input buffer corresponding to an allocation size of (at least) 8 bytes.

◆ gaiaImportF32()

GAIAGEO_DECLARE float gaiaImportF32 ( const unsigned char *  p,
int  little_endian,
int  little_endian_arch 
)

Import a FLOAT-32 value in endian-aware fashion.

Parameters
pendian-dependent representation (input buffer).
little_endian0 if the input buffer is big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
Returns
the internal FLOAT value
See also
gaiaEndianArch, gaiaExportF32
Note
you are expected to pass an input buffer corresponding to an allocation size of (at least) 4 bytes.

◆ gaiaImportI64()

GAIAGEO_DECLARE sqlite3_int64 gaiaImportI64 ( const unsigned char *  p,
int  little_endian,
int  little_endian_arch 
)

Import an INT-64 in endian-aware fashion.

Parameters
pendian-dependent representation (input buffer).
little_endian0 if the input buffer is big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
Returns
the internal INT-64 value
See also
gaiaEndianArch, gaiaExportI64
Note
you are expected to pass an input buffer corresponding to an allocation size of (at least) 8 bytes.

◆ gaiaImportU32()

GAIAGEO_DECLARE unsigned int gaiaImportU32 ( const unsigned char *  p,
int  little_endian,
int  little_endian_arch 
)

Import an UINT-32 value in endian-aware fashion.

Parameters
pendian-dependent representation (input buffer).
little_endian0 if the input buffer is big-endian: any other value for little-endian.
little_endian_archthe value returned by gaiaEndianArch()
Returns
the internal UINT value
See also
gaiaEndianArch, gaiaExportU32
Note
you are expected to pass an input buffer corresponding to an allocation size of (at least) 4 bytes.

◆ gaiaIsValidDbfList()

GAIAGEO_DECLARE int gaiaIsValidDbfList ( gaiaDbfListPtr  list)

Checks a DBF List object for validity.

Parameters
listpointer to the DBF List object.
Returns
0 if not valid: any other value if valid.
See also
gaiaAllocDbfList, gaiaFreeDbfList, gaiaIsValidDbfList, gaiaResetDbfEntity, gaiaCloneDbfEntity, gaiaAddDbfField

◆ gaiaMakeLine()

GAIAGEO_DECLARE void gaiaMakeLine ( gaiaGeomCollPtr  geom1,
gaiaGeomCollPtr  geom2,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a Segment (2-Points Linestring)

Parameters
geom1pointer to first Geometry object (expected to represent a Point).
geom2pointer to second Geometry object (expected to represent a Point).
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePoint()

GAIAGEO_DECLARE void gaiaMakePoint ( double  x,
double  y,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a Point (BLOB-Geometry)

Parameters
xPoint X coordinate.
yPoint Y coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointEx
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointEx()

GAIAGEO_DECLARE void gaiaMakePointEx ( int  tiny_point,
double  x,
double  y,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a Point (BLOB-Geometry or BLOB-TinyPoint)

Parameters
tiny_pointif set to TRUE the POINT Geometry will be encoded by using the TinyPoint BLOB format.
xPoint X coordinate.
yPoint Y coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePoint
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointM()

GAIAGEO_DECLARE void gaiaMakePointM ( double  x,
double  y,
double  m,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a PointM (BLOB-Geometry)

Parameters
xPoint X coordinate.
yPoint Y coordinate.
mPoint M coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointMEx
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointMEx()

GAIAGEO_DECLARE void gaiaMakePointMEx ( int  tiny_point,
double  x,
double  y,
double  m,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a PointM (BLOB-Geometry or BLOB-TinyPoint)

Parameters
tiny_pointif set to TRUE the POINT Geometry will be encoded by using the TinyPoint BLOB format.
xPoint X coordinate.
yPoint Y coordinate.
mPoint M coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointM
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointZ()

GAIAGEO_DECLARE void gaiaMakePointZ ( double  x,
double  y,
double  z,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a PointZ (BLOB-Geometry)

Parameters
xPoint X coordinate.
yPoint Y coordinate.
zPoint Z coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZEx
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointZEx()

GAIAGEO_DECLARE void gaiaMakePointZEx ( int  tiny_point,
double  x,
double  y,
double  z,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a PointZ (BLOB-Geometry or BLOB-TinyPoint)

Parameters
tiny_pointif set to TRUE the POINT Geometry will be encoded by using the TinyPoint BLOB format.
xPoint X coordinate.
yPoint Y coordinate.
zPoint Z coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZ
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointZM()

GAIAGEO_DECLARE void gaiaMakePointZM ( double  x,
double  y,
double  z,
double  m,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a PointZM (BLOB-Geometry)

Parameters
xPoint X coordinate.
yPoint Y coordinate.
zPoint Z coordinate.
mPoint M coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZMEx
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMakePointZMEx()

GAIAGEO_DECLARE void gaiaMakePointZMEx ( int  tiny_point,
double  x,
double  y,
double  z,
double  m,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing a PointZM (BLOB-Geometry or BLOB-TinyPoint)

Parameters
tiny_pointif set to TRUE the POINT Geometry will be encoded by using the TinyPoint BLOB format.
xPoint X coordinate.
yPoint Y coordinate.
zPoint Z coordinate.
mPoint M coordinate.
sridthe SRID to be set for the Point.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZM
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaMemFseek()

GAIAGEO_DECLARE int gaiaMemFseek ( gaiaMemFilePtr  mem,
long  offset 
)

Repositioning a Memory File.

Parameters
mempointer to the Memry File object.
offsetfile offset relative to the start of file
Returns
0 on success; -1 on failure.
See also
gaiaFseek

◆ gaiaMemRead()

GAIAGEO_DECLARE size_t gaiaMemRead ( void *  ptr,
size_t  bytes,
gaiaMemFilePtr  mem 
)

Reads from a Memory File.

Parameters
ptrpointer to the output buffer.
bytesnumeber of bytes to read.
mempointer to the Memory File object.
Returns
the number of bytes read.
See also
gaiaMemFseek

◆ gaiaOpenDbfRead()

GAIAGEO_DECLARE void gaiaOpenDbfRead ( gaiaDbfPtr  dbf,
const char *  path,
const char *  charFrom,
const char *  charTo 
)

Open a DBF File in read mode.

Parameters
dbfpointer to the DBF File object.
pathpathname to the corresponding file-system file.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfWrite, gaiaOpenZipDbf, gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
Note
on failure the object member Valid will be set to 0; and the object member LastError will contain the appropriate error message.

◆ gaiaOpenDbfWrite()

GAIAGEO_DECLARE void gaiaOpenDbfWrite ( gaiaDbfPtr  dbf,
const char *  path,
const char *  charFrom,
const char *  charTo 
)

Open a DBF File in write mode.

Parameters
dbfpointer to the DBF File object.
pathpathname to the corresponding file-system file.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader, gaiaOpenDbfWriteEx
Note
simply calls gaiaOpenDbfWriteEx() by specifying GAIA_DBF_COLNAME_LOWERCASE

◆ gaiaOpenDbfWriteEx()

GAIAGEO_DECLARE void gaiaOpenDbfWriteEx ( gaiaDbfPtr  dbf,
const char *  path,
const char *  charFrom,
const char *  charTo,
int  colname_case 
)

Open a DBF File in write mode,- extended.

Parameters
dbfpointer to the DBF File object.
pathpathname to the corresponding file-system file.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
colname_caseone between GAIA_DBF_COLNAME_LOWERCASE, GAIA_DBF_COLNAME_UPPERCASE or GAIA_DBF_COLNAME_CASE_IGNORE.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader, gaiaOpenDbfWrite
Note
on failure the object member Valid will be set to 0; and the object member LastError will contain the appropriate error message.

◆ gaiaOpenShpRead()

GAIAGEO_DECLARE void gaiaOpenShpRead ( gaiaShapefilePtr  shp,
const char *  path,
const char *  charFrom,
const char *  charTo 
)

Open a Shapefile in read mode.

Parameters
shppointer to the Shapefile object.
pathabstract pathname to the corresponding file-system files.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpWrite, gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
Note
on failure the object member Valid will be set to 0; and the object member LastError will contain the appropriate error message.
the abstract pathname should not contain any suffix at all.

◆ gaiaOpenShpWrite()

GAIAGEO_DECLARE void gaiaOpenShpWrite ( gaiaShapefilePtr  shp,
const char *  path,
int  shape,
gaiaDbfListPtr  list,
const char *  charFrom,
const char *  charTo 
)

Open a Shapefile in write mode.

Parameters
shppointer to the Shapefile object.
pathabstract pathname to the corresponding file-system files.
shapethe SHAPE code; expected to be one of GAIA_SHP_POINT, GAIA_SHP_POLYLINE, GAIA_SHP_POLYGON, GAIA_SHP_MULTIPOINT, GAIA_SHP_POINTZ, GAIA_SHP_POLYLINEZ, GAIA_SHP_POLYGONZ, GAIA_SHP_MULTIPOINTZ, GAIA_SHP_POINTM, GAIA_SHP_POLYLINEM, GAIA_SHP_POLYGONM, GAIA_SHP_MULTIPOINTM
listpointer to DBF List object representing the corresponding data attributes.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders, gaiaOpenShpWriteEx
Note
simply calls gaiaOpenShpWriteEx() by specifying GAIA_DBF_COLNAME_LOWERCASE

◆ gaiaOpenShpWriteEx()

GAIAGEO_DECLARE void gaiaOpenShpWriteEx ( gaiaShapefilePtr  shp,
const char *  path,
int  shape,
gaiaDbfListPtr  list,
const char *  charFrom,
const char *  charTo,
int  colname_case 
)

Open a Shapefile in write mode - extended.

Parameters
shppointer to the Shapefile object.
pathabstract pathname to the corresponding file-system files.
shapethe SHAPE code; expected to be one of GAIA_SHP_POINT, GAIA_SHP_POLYLINE, GAIA_SHP_POLYGON, GAIA_SHP_MULTIPOINT, GAIA_SHP_POINTZ, GAIA_SHP_POLYLINEZ, GAIA_SHP_POLYGONZ, GAIA_SHP_MULTIPOINTZ, GAIA_SHP_POINTM, GAIA_SHP_POLYLINEM, GAIA_SHP_POLYGONM, GAIA_SHP_MULTIPOINTM
listpointer to DBF List object representing the corresponding data attributes.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
colname_caseone between GAIA_DBF_COLNAME_LOWERCASE, GAIA_DBF_COLNAME_UPPERCASE or GAIA_DBF_COLNAME_CASE_IGNORE.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders, gaiaOpenShpWrite
Note
on failure the object member Valid will be set to 0; and the object member LastError will contain the appropriate error message.
the abstract pathname should not contain any suffix at all.

◆ gaiaOpenZipDbf()

GAIAGEO_DECLARE gaiaDbfPtr gaiaOpenZipDbf ( const char *  zip_path,
const char *  filename,
const char *  charFrom,
const char *  charTo 
)

Open a DBF File contained within a Zipfile (just for checking its fields)

Parameters
zip_pathpath of the Zipfile.
filenamefilename of the DB file within the Zipfile.
charFromGNU ICONV name identifying the input charset encoding.
charToGNU ICONV name identifying the output charset encoding.
Returns
dbf pointer to the DBF File object. NULL on error.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfWrite, gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
Note
you are responsible to destroy (before or after) any allocated DBF File.
you should phisically open the DBF File in read or write mode before performing any actual I/O operation.

◆ gaiaOutBareKml()

GAIAGEO_DECLARE void gaiaOutBareKml ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom,
int  precision 
)

Encodes a Geometry object into KML notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
precisiondecimal digits to be used for coordinates
See also
gaiaParseKml, gaiaOutFullKml
Note
this function will export the simplest KML notation (no descriptions).

◆ gaiaOutBufferInitialize()

GAIAGEO_DECLARE void gaiaOutBufferInitialize ( gaiaOutBufferPtr  buf)

Initializes a dynamically growing Text output buffer.

Parameters
bufpointer to gaiaOutBufferStruct structure
See also
gaiaOutBufferReset, gaiaAppendToOutBuffer
Note
Text notations representing Geometry objects may easily require a huge storage amount: the gaiaOutBufferStruct automatically supports a dynamically growing output buffer.
You are required to initialize this structure before attempting any further operation; and you are responsible to cleanup any related memory allocation when it's any longer required.
Examples
demo2.c.

◆ gaiaOutBufferReset()

GAIAGEO_DECLARE void gaiaOutBufferReset ( gaiaOutBufferPtr  buf)

Resets a dynamically growing Text output buffer to its initial (empty) state.

Parameters
bufpointer to gaiaOutBufferStruct structure
See also
gaiaOutBufferInitialize, gaiaAppendToOutBuffer
Note
You are required to initialize this structure before attempting any further operation: this function will release any related memory allocation.
Examples
demo2.c.

◆ gaiaOutFullKml()

GAIAGEO_DECLARE void gaiaOutFullKml ( gaiaOutBufferPtr  out_buf,
const char *  name,
const char *  desc,
gaiaGeomCollPtr  geom,
int  precision 
)

Encodes a Geometry object into KML notation.

Parameters
out_bufpointer to dynamically growing Text buffer
nametext string to be set as KML name
desctext string to se set as KML description
geompointer to Geometry object
precisiondecimal digits to be used for coordinates
See also
gaiaParseKml, gaiaOutBareKml
Note
this function will export the simplest KML notation (no descriptions).

◆ gaiaOutGeoJSON()

GAIAGEO_DECLARE void gaiaOutGeoJSON ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom,
int  precision,
int  options 
)

Encodes a Geometry object into GeoJSON notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
precisiondecimal digits to be used for coordinates
optionsGeoJSON specific options
See also
gaiaParseGeoJSON
Note
options can assume the following values:
  • 1 = BBOX, no CRS
  • 2 = no BBOX, short form CRS
  • 3 = BBOX, short form CRS
  • 4 = no BBOX, long form CRS
  • 5 = BBOX, long form CRS
  • any other value: no BBOX and no CRS

◆ gaiaOutGml()

GAIAGEO_DECLARE void gaiaOutGml ( gaiaOutBufferPtr  out_buf,
int  version,
int  precision,
gaiaGeomCollPtr  geom 
)

Encodes a Geometry object into GML notation.

Parameters
out_bufpointer to dynamically growing Text buffer
versionGML version
precisiondecimal digits to be used for coordinates
geompointer to Geometry object
See also
gaiaParseGml
Note
if version is set to 3, then GMLv3 will be used; in any other case GMLv2 will be assumed by default.

◆ gaiaOutLinestringZ()

GAIAGEO_DECLARE void gaiaOutLinestringZ ( gaiaOutBufferPtr  out_buf,
gaiaLinestringPtr  linestring 
)

Encodes a WKT 3D Linestring [XYZ].

Parameters
out_bufpointer to dynamically growing Text buffer
linestringpointer to Linestring object
See also
gaiaOutPointZ, gaiaOutPolygonZ, gaiaOutLinestringZex
Remarks
mainly intended for internal usage.

◆ gaiaOutLinestringZex()

GAIAGEO_DECLARE void gaiaOutLinestringZex ( gaiaOutBufferPtr  out_buf,
gaiaLinestringPtr  linestring,
int  precision 
)

Encodes a WKT 3D Linestring [XYZ].

Parameters
out_bufpointer to dynamically growing Text buffer
linestringpointer to Linestring object
precisiondecimal digits to be used for coordinates
See also
gaiaOutPointZ, gaiaOutPolygonZ
Remarks
mainly intended for internal usage.

◆ gaiaOutPointZ()

GAIAGEO_DECLARE void gaiaOutPointZ ( gaiaOutBufferPtr  out_buf,
gaiaPointPtr  point 
)

Encodes a WKT 3D Point [XYZ].

Parameters
out_bufpointer to dynamically growing Text buffer
pointpointer to Point object
See also
gaiaOutLinestringZ, gaiaOutPolygonZ, gaiaOutPointZex
Remarks
mainly intended for internal usage.

◆ gaiaOutPointZex()

GAIAGEO_DECLARE void gaiaOutPointZex ( gaiaOutBufferPtr  out_buf,
gaiaPointPtr  point,
int  precision 
)

Encodes a WKT 3D Point [XYZ].

Parameters
out_bufpointer to dynamically growing Text buffer
pointpointer to Point object
precisiondecimal digits to be used for coordinates
See also
gaiaOutLinestringZ, gaiaOutPolygonZ
Remarks
mainly intended for internal usage.

◆ gaiaOutPolygonZ()

GAIAGEO_DECLARE void gaiaOutPolygonZ ( gaiaOutBufferPtr  out_buf,
gaiaPolygonPtr  polygon 
)

Encodes a WKT 3D Polygon [XYZ].

Parameters
out_bufpointer to dynamically growing Text buffer
polygonpointer to Point object
See also
gaiaOutPointZ, gaiaOutLinestringZ, gaiaOutPolygonZex
Remarks
mainly intended for internal usage.

◆ gaiaOutPolygonZex()

GAIAGEO_DECLARE void gaiaOutPolygonZex ( gaiaOutBufferPtr  out_buf,
gaiaPolygonPtr  polygon,
int  precision 
)

Encodes a WKT 3D Polygon [XYZ].

Parameters
out_bufpointer to dynamically growing Text buffer
polygonpointer to Point object
precisiondecimal digits to be used for coordinates
See also
gaiaOutPointZ, gaiaOutLinestringZ
Remarks
mainly intended for internal usage.

◆ gaiaOutSvg()

GAIAGEO_DECLARE void gaiaOutSvg ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom,
int  relative,
int  precision 
)

Encodes a Geometry object into SVG notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
relativeflag: relative or absolute coordinates
precisiondecimal digits to be used for coordinates
Note
if relative is set to 1, then SVG relative coords will be used: in any other case SVG absolute coords will be assumed by default.

◆ gaiaOutWkt()

GAIAGEO_DECLARE void gaiaOutWkt ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom 
)

Encodes a Geometry object into WKT notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
See also
gaiaParseWkt, gaiaOutWktStrict, gaiaParseEWKT, gaiaToEWKT, gaiaOutWktEx
Note
this function will apply 3D WKT encoding as internally intended by SpatiaLite: not necessarily intended by other OGC-like implementations.
Anyway, 2D WKT is surely standard and safely interoperable.
Examples
demo2.c.

◆ gaiaOutWktEx()

GAIAGEO_DECLARE void gaiaOutWktEx ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom,
int  precision 
)

Encodes a Geometry object into WKT notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
precisiondecimal digits to be used for coordinates
See also
gaiaParseWkt, gaiaOutWktStrict, gaiaParseEWKT, gaiaToEWKT
Note
this function will apply 3D WKT encoding as internally intended by SpatiaLite: not necessarily intended by other OGC-like implementations.
Anyway, 2D WKT is surely standard and safely interoperable.

◆ gaiaOutWktStrict()

GAIAGEO_DECLARE void gaiaOutWktStrict ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom,
int  precision 
)

Encodes a Geometry object into strict 2D WKT notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
precisiondecimal digits to be used for coordinates
See also
gaiaParseWkt, gaiaOutWkt, gaiaParseEWKT, gaiaToEWKT
Note
this function will apply strict 2D WKT encoding, so to be surely standard and safely interoperable.
Dimensions will be automatically casted to 2D [XY] when required.

◆ gaiaParseEWKT()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseEWKT ( const unsigned char *  in_buffer)

Creates a Geometry object from EWKT notation.

Parameters
in_bufferpointer to EWKT buffer
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaParseWkt, gaiaOutWkt, gaiaOutWktStrict, gaiaToEWKT
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaParseGeoJSON()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGeoJSON ( const unsigned char *  in_buffer)

Creates a Geometry object from GeoJSON notation.

Parameters
in_bufferpointer to GeoJSON buffer
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaOutGeoJSON
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaParseGml()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml ( const unsigned char *  in_buffer,
sqlite3 *  sqlite_handle 
)

Creates a Geometry object from GML notation.

Parameters
in_bufferpointer to GML buffer
sqlite_handlehandle to current DB connection
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaParseGml_r, gaiaOutGml
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.
not reentrant and thread unsafe.

◆ gaiaParseGml_r()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml_r ( const void *  p_cache,
const unsigned char *  in_buffer,
sqlite3 *  sqlite_handle 
)

Creates a Geometry object from GML notation.

Parameters
p_cachea memory pointer returned by spatialite_alloc_connection()
in_bufferpointer to GML buffer
sqlite_handlehandle to current DB connection
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaParseGml, gaiaOutGml
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.
reentrant and thread-safe.

◆ gaiaParseHexEWKB()

GAIAGEO_DECLARE unsigned char* gaiaParseHexEWKB ( const unsigned char *  blob_hex,
int *  blob_size 
)

Translates an EWKB notation from hexadecimal into binary.

Parameters
blob_hexpointer to EWKB input buffer (hexadecimal text string)
blob_sizelenght (in bytes) of the input buffer; if succesfull will contain the lenght of the returned output buffer.
Returns
the pointer to the newly created EWKB binary buffer: NULL on failure.
See also
gaiaToWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
Note
you are responsible to destroy (before or after) any buffer allocated by gaiaParseHexEWKB()

◆ gaiaParseKml()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseKml ( const unsigned char *  in_buffer)

Creates a Geometry object from KML notation.

Parameters
in_bufferpointer to KML buffer
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaOutBareKml, gaiaOutFullKml
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaParseWkt()

GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseWkt ( const unsigned char *  in_buffer,
short  type 
)

Creates a Geometry object from WKT notation.

Parameters
in_bufferpointer to WKT buffer
typethe expected Geometry Class Type
if actual type defined in WKT doesn't corresponds to this, an error will be raised.
Returns
the pointer to the newly created Geometry object: NULL on failure
See also
gaiaOutWkt, gaiaOutWktStrict, gaiaParseEWKT, gaiaToEWKT
Note
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.

◆ gaiaReadDbfEntity()

GAIAGEO_DECLARE int gaiaReadDbfEntity ( gaiaDbfPtr  dbf,
int  current_row,
int *  deleted 
)

Reads a record from a DBF File object.

Parameters
dbfpointer to the DBF File object.
current_rowthe row number identifying the record to be read.
deletedon completion this variable will contain 0 if the record just read is valid: any other value if the record just read is marked as logically deleted.
Returns
0 on failure: any other value on success.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite, gaiaFlushDbfHeader
Note
on completion the DBF File First member will point to the linked list containing the corresponding data attributes [both data formats and values].
Remarks
the DBF File object should be opened in read mode.

◆ gaiaReadDbfEntity_ex()

GAIAGEO_DECLARE int gaiaReadDbfEntity_ex ( gaiaDbfPtr  dbf,
int  current_row,
int *  deleted,
int  text_dates 
)

Reads a record from a DBF File object.

Parameters
dbfpointer to the DBF File object.
current_rowthe row number identifying the record to be read.
deletedon completion this variable will contain 0 if the record
text_datesis TRUE all DBF dates will be considered as TEXT just read is valid: any other value if the record just read is marked as logically deleted.
Returns
0 on failure: any other value on success.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite, gaiaFlushDbfHeader
Note
on completion the DBF File First member will point to the linked list containing the corresponding data attributes [both data formats and values].
Remarks
the DBF File object should be opened in read mode.

◆ gaiaReadShpEntity()

GAIAGEO_DECLARE int gaiaReadShpEntity ( gaiaShapefilePtr  shp,
int  current_row,
int  srid 
)

Reads a feature from a Shapefile object.

Parameters
shppointer to the Shapefile object.
current_rowthe row number identifying the feature to be read.
sridfeature's SRID
Returns
0 on failure: any other value on success. -1 when the corresponding DBF record is marked as DELETED.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
Note
on completion the Shapefile's Dbf member will contain the feature read:
  • the Dbf->Geometry member will contain the corresponding Geometry
  • and the Dbf->First member will point to the linked list containing the corresponding data attributes [both data formats and values].
Remarks
the Shapefile object should be opened in read mode.

◆ gaiaReadShpEntity_ex()

GAIAGEO_DECLARE int gaiaReadShpEntity_ex ( gaiaShapefilePtr  shp,
int  current_row,
int  srid,
int  text_dates 
)

Reads a feature from a Shapefile object.

Parameters
shppointer to the Shapefile object.
current_rowthe row number identifying the feature to be read.
sridfeature's SRID
text_datesis TRUE all DBF dates will be considered as TEXT
Returns
0 on failure: any other value on success.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
Note
on completion the Shapefile's Dbf member will contain the feature read:
  • the Dbf->Geometry member will contain the corresponding Geometry
  • and the Dbf->First member will point to the linked list containing the corresponding data attributes [both data formats and values].
Remarks
the Shapefile object should be opened in read mode.

◆ gaiaReadWktFromZipShp()

GAIAGEO_DECLARE char* gaiaReadWktFromZipShp ( const char *  zip_path,
const char *  basename 
)

Attempting to get a WKT from the .PRJ member of a given zipped Shapefile.

Parameters
zip_pathabsolute or relativ pathname leading to the Zipfile.
basenamename of the Shapefile (excluding any .shp, .shx or .dbf suffix)
Returns
the returned WKT expression from the .prj member of the zipped Shapefile or NULL on failure
Note
the WKT expression corresponds to dynamically allocated memory: so you are responsible to free() it before or after.

◆ gaiaResetDbfEntity()

GAIAGEO_DECLARE void gaiaResetDbfEntity ( gaiaDbfListPtr  list)

Resets a DBF List object to its initial empty state.

Parameters
listpointer to the DBF List object.
See also
gaiaFreeValue
Note
any DBF Field associated to the List object will be reset to its initial empty state (i.e. no value at all).

◆ gaiaSetDoubleValue()

GAIAGEO_DECLARE void gaiaSetDoubleValue ( gaiaDbfFieldPtr  field,
double  value 
)

Sets a DOUBLE current value for a DBF Field object.

Parameters
fieldpointer to DBF Field object.
valuedouble value to be set.
See also
gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetStrValue

◆ gaiaSetIntValue()

GAIAGEO_DECLARE void gaiaSetIntValue ( gaiaDbfFieldPtr  field,
sqlite3_int64  value 
)

Sets an INTEGER current value for a DBF Field object.

Parameters
fieldpointer to DBF Field object.
valueinteger value to be set.
See also
gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue, gaiaSetNullValue, gaiaSetDoubleValue, gaiaSetStrValue

◆ gaiaSetNullValue()

GAIAGEO_DECLARE void gaiaSetNullValue ( gaiaDbfFieldPtr  field)

Sets a NULL current value for a DBF Field object.

Parameters
fieldpointer to DBF Field object
See also
gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue, gaiaSetIntValue, gaiaSetDoubleValue, gaiaSetStrValue

◆ gaiaSetStrValue()

GAIAGEO_DECLARE void gaiaSetStrValue ( gaiaDbfFieldPtr  field,
char *  str 
)

Sets a TEXT current value for a DBF Field object.

Parameters
fieldpointer to DBF Field object.
strtext string value to be set.
See also
gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue

◆ gaiaShpAnalyze()

GAIAGEO_DECLARE void gaiaShpAnalyze ( gaiaShapefilePtr  shp)

Prescans a Shapefile object gathering informations.

Parameters
shppointer to the Shapefile object.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaReadShpEntity, gaiaWriteShpEntity, gaiaFlushShpHeaders
Note
on completion the Shapefile's EffectiveType will containt the Geometry type corresponding to features actually found.
Remarks
the Shapefile object should be opened in read mode.

◆ gaiaTextReaderAlloc()

GAIAGEO_DECLARE gaiaTextReaderPtr gaiaTextReaderAlloc ( const char *  path,
char  field_separator,
char  text_separator,
char  decimal_separator,
int  first_line_titles,
const char *  encoding 
)

Creates a Text Reader object.

Parameters
pathto the corresponding file-system file.
field_separatorthe character acting as a separator between adjacent fields.
text_separatorthe character used to quote text strings.
decimal_separatorthe character used as a separator between integer and decimal digits for real numeric values.
first_line_titles0 if the first line contains regular values: any other value if the first line contains column names.
encodingGNU ICONV name identifying the input charset encoding.
Returns
the pointer to the newly created Text Reader object: NULL on failure
See also
gaiaTextReaderDestroy, gaiaTextReaderParse, gaiaTextReaderGetRow, gaiaTextReaderFetchField
Note
you are responsible to destroy (before or after) any allocated Text Reader object.

◆ gaiaTextReaderDestroy()

GAIAGEO_DECLARE void gaiaTextReaderDestroy ( gaiaTextReaderPtr  reader)

Destroys a Text Reader object.

Parameters
readerpointer to Text Reader object.
See also
gaiaTextReaderAlloc, gaiaTextReaderParse, gaiaTextReaderGetRow, gaiaTextReaderFetchField

◆ gaiaTextReaderFetchField()

GAIAGEO_DECLARE int gaiaTextReaderFetchField ( gaiaTextReaderPtr  reader,
int  field_num,
int *  type,
const char **  value 
)

Retrieves an individual field value from the current Line.

Parameters
readerpointer to Text Reader object.
field_numrelative field [aka column] index: first field has index 0.
typeon completion this variable will contain the value type.
valueon completion this variable will contain the current field value.
Returns
0 on failure: any other value on success.
See also
gaiaTextReaderAlloc, gaiaTextReaderDestroy, gaiaTextReaderParse, gaiaTextReaderGetRow

◆ gaiaTextReaderGetRow()

GAIAGEO_DECLARE int gaiaTextReaderGetRow ( gaiaTextReaderPtr  reader,
int  row_num 
)

Reads a line from a Text Reader object.

Parameters
readerpointer to Text Reader object.
row_numthe Line Number identifying the Line to be read.
Returns
0 on failure: any other value on success.
See also
gaiaTextReaderAlloc, gaiaTextReaderDestroy, gaiaTextReaderParse, gaiaTextReaderFetchField
Note
this function will load the requested Line into the current buffer: you can then use gaiaTextReaderFetchField in order to retrieve any individual field [aka column] value.

◆ gaiaTextReaderParse()

GAIAGEO_DECLARE int gaiaTextReaderParse ( gaiaTextReaderPtr  reader)

Prescans the external file associated to a Text Reade object.

Parameters
readerpointer to Text Reader object.
Returns
0 on failure: any other value on success.
See also
gaiaTextReaderAlloc, gaiaTextReaderDestroy, gaiaTextReaderGetRow, gaiaTextReaderFetchField
Note
this preliminary step is required so to ensure:
  • file consistency: checking expected formatting rules.
  • identifying the number / type / name of fields [aka columns].
  • identifying the actual number of lines within the file.

◆ gaiaToCompressedBlobWkb()

GAIAGEO_DECLARE void gaiaToCompressedBlobWkb ( gaiaGeomCollPtr  geom,
unsigned char **  result,
int *  size 
)

Creates a Compressed BLOB-Geometry corresponding to a Geometry object.

Parameters
geompointer to the Geometry object.
resulton completion will containt a pointer to Compressed BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaToSpatiaLiteBlobWkb
Note
this function will apply compression to any Linestring / Ring found within the Geometry to be encoded.
the returned BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaToEWKB()

GAIAGEO_DECLARE void gaiaToEWKB ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom 
)

Encodes a Geometry object into EWKB notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
See also
gaiaFromWkb, gaiaToWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
Note
this function will produce strictly conformat EWKB; you can safely use this for PostGIS data exchange.

◆ gaiaToEWKT()

GAIAGEO_DECLARE void gaiaToEWKT ( gaiaOutBufferPtr  out_buf,
gaiaGeomCollPtr  geom 
)

Encodes a Geometry object into EWKT notation.

Parameters
out_bufpointer to dynamically growing Text buffer
geompointer to Geometry object
See also
gaiaParseWkt, gaiaOutWkt, gaiaOutWktStrict, gaiaParseEWKT
Note
this function will apply PostGIS own EWKT encoding.

◆ gaiaToFgf()

GAIAGEO_DECLARE void gaiaToFgf ( gaiaGeomCollPtr  geom,
unsigned char **  result,
int *  size,
int  coord_dims 
)

Encodes a Geometry object into FGF notation.

Parameters
geompointer to Geometry object
resulton completion will containt a pointer to the FGF buffer [BLOB]: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
coord_dimsone of: GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM
See also
gaiaFromFgf
Note
the returned BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaToHexWkb()

GAIAGEO_DECLARE char* gaiaToHexWkb ( gaiaGeomCollPtr  geom)

Encodes a Geometry object into (hex) WKB notation.

Parameters
geompointer to Geometry object
Returns
the pointer to a text buffer containing WKB translated into plain hexadecimal: NULL on failure.
See also
gaiaFromWkb, gaiaToWkb, gaiaFromEWKB, gaiaToEWKB
Note
the returned buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaToSpatiaLiteBlobWkb()

GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkb ( gaiaGeomCollPtr  geom,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry corresponding to a Geometry object.

Parameters
geompointer to the Geometry object.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].
Examples
demo3.c, and demo4.c.

◆ gaiaToSpatiaLiteBlobWkbEx()

GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx ( gaiaGeomCollPtr  geom,
unsigned char **  result,
int *  size,
int  gpkg_mode 
)

Creates a BLOB-Geometry corresponding to a Geometry object.

Parameters
geompointer to the Geometry object.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
gpkg_modeif set to TRUE will always return GPKG Geometry-BLOBs
See also
gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb, gaiaToSpatiaLiteBlobWkbEx2
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaToSpatiaLiteBlobWkbEx2()

GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx2 ( gaiaGeomCollPtr  geom,
unsigned char **  result,
int *  size,
int  gpkg_mode,
int  tiny_point 
)

Creates a BLOB-Geometry corresponding to a Geometry object.

Parameters
geompointer to the Geometry object.
resulton completion will containt a pointer to BLOB-Geometry: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
gpkg_modeif set to TRUE will always return GPKG Geometry-BLOBs
tiny_pointif set to TRUE all POINT Geometries will be encoded by using the TinyPoint BLOB format.
See also
gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb, gaiaToSpatiaLiteBlobWkbEx
Note
the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaToWkb()

GAIAGEO_DECLARE void gaiaToWkb ( gaiaGeomCollPtr  geom,
unsigned char **  result,
int *  size 
)

Encodes a Geometry object into WKB notation.

Parameters
geompointer to Geometry object
resulton completion will containt a pointer to the WKB buffer [BLOB]: NULL on failure.
sizeon completion this variable will contain the BLOB's size (in bytes)
See also
gaiaFromWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
Note
this function will apply 3D WKB encoding as internally intended by SpatiaLite: not necessarily intended by other OGC-like implementations.
Anyway, 2D WKB is surely standard and safely interoperable.
the returned BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding].

◆ gaiaWriteDbfEntity()

GAIAGEO_DECLARE int gaiaWriteDbfEntity ( gaiaDbfPtr  dbf,
gaiaDbfListPtr  entity 
)

Writes a record into a DBF File object.

Parameters
dbfpointer to the DBF File object.
entitypointer to DBF List object containing Fields and corresponding values.
Returns
0 on failure: any other value on success.
See also
gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite, gaiaReadDbfEntity, gaiaFlushDbfHeader
Remarks
the DBF File object should be opened in write mode.

◆ gaiaWriteShpEntity()

GAIAGEO_DECLARE int gaiaWriteShpEntity ( gaiaShapefilePtr  shp,
gaiaDbfListPtr  entity 
)

Writes a feature into a Shapefile object.

Parameters
shppointer to the Shapefile object.
entitypointer to DBF List object containing both Geometry and Field values.
Returns
0 on failure: any other value on success.
See also
gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite, gaiaReadShpEntity, gaiaShpAnalyze, gaiaFlushShpHeaders
Remarks
the Shapefile object should be opened in write mode.

◆ gaiaZipfileDbfN()

GAIAGEO_DECLARE char* gaiaZipfileDbfN ( const char *  zip_path,
int  idx 
)

Will return the filename of the Nth DBF file from within a given Zipfile.

Parameters
zip_pathabsolute or relativ pathname leading to the Zipfile.
idxindex (1-based) of the DBF file
Returns
the filename of the Nth DBF file or NULL on failure
Note
the returned filename corresponds to dynamically allocated memory: so you are responsible to free() it before or after.

◆ gaiaZipfileNumDBF()

GAIAGEO_DECLARE int gaiaZipfileNumDBF ( const char *  zip_path,
int *  count 
)

Will return the number of DBF files from within a given Zipfile.

Parameters
zip_pathabsolute or relativ pathname leading to the Zipfile.
counton success will contain the number of DBF files
Returns
0 on failure; any other value on success.

◆ gaiaZipfileNumSHP()

GAIAGEO_DECLARE int gaiaZipfileNumSHP ( const char *  zip_path,
int *  count 
)

Will return the number of Shapefiles from within a given Zipfile.

Parameters
zip_pathabsolute or relativ pathname leading to the Zipfile.
counton success will contain the number of Shapefiles
Returns
0 on failure; any other value on success.

◆ gaiaZipfileShpN()

GAIAGEO_DECLARE char* gaiaZipfileShpN ( const char *  zip_path,
int  idx 
)

Will return the basename of the Nth Shapefile from within a given Zipfile.

Parameters
zip_pathabsolute or relativ pathname leading to the Zipfile.
idxindex (1-based) of the Shapefile
Returns
the basename of the Nth Shapefile or NULL on failure
Note
the returned basename corresponds to dynamically allocated memory: so you are responsible to free() it before or after.