SpatiaLite [v.2.2] C APIs reference list

back to main page

functions supporting data endianness

Synopsis
int gaiaEndianArch ( void );

return 0 if CPU uses a big-endian architecture, or 1 if CPU uses a little-endian architecture
int gaiaImport16 ( const unsigned char *p, int endian_mode, int arch_endiannes );

return an int from the 16-bits buffer pointed by p
endian_mode has to be 1 (if the buffer is expected to contain a little-endian encoded value), or 0 (if buffer is big-endian encoded)
arch_endiannes is expected to be the result returned by gaiaEndianArch()
int gaiaImport32 ( const unsigned char *p, int endian_mode, int arch_endiannes );

return an int from the 32-bits buffer pointed by p
endian_mode has to be 1 (if the buffer is expected to contain a little-endian encoded value), or 0 (if buffer is big-endian encoded)
arch_endiannes is expected to be the result returned by gaiaEndianArch()
double gaiaImport64 ( const unsigned char *p, double endian_mode, int arch_endiannes );

return an int from the 64-bits buffer pointed by p
endian_mode has to be 1 (if the buffer is expected to contain a little-endian encoded value), or 0 (if buffer is big-endian encoded)
arch_endiannes is expected to be the result returned by gaiaEndianArch()
void gaiaExport16 ( unsigned char *p, short value, int endian_mode, int arch_endiannes );

stores value into the 16-bits buffer pointed by p
endian_mode has to be 1 (if the buffer has to store a little-endian encoded value) or 0 (if buffer has to store a big-endian encoded value)
arch_endiannes is expected to be the result returned by gaiaEndianArch()
void gaiaExport32 ( unsigned char *p, int value, int endian_mode, int arch_endiannes );

stores value into the 32-bits buffer pointed by p
endian_mode has to be 1 (if the buffer has to store a little-endian encoded value) or 0 (if buffer has to store a big-endian encoded value)
arch_endiannes is expected to be the result returned by gaiaEndianArch()
void gaiaExport64 ( unsigned char *p, double value, int endian_mode, int arch_endiannes );

stores value into the 64-bits buffer pointed by p
endian_mode has to be 1 (if the buffer has to store a little-endian encoded value) or 0 (if buffer has to store a big-endian encoded value)
arch_endiannes is expected to be the result returned by gaiaEndianArch()

general handling: POINT objects

Synopsis
typedef struct gaiaPointStruct {
    double
X;
    double
Y;
    struct gaiaPointStruct *
Next;
    struct gaiaPointStruct *
Prev;
}
gaiaPoint;
typedef gaiaPoint *
gaiaPointPtr;
  • X and Y contain the point coordinates; you can directly access these variables
  • Prev and Next are used in order to implement a double-linked list of Points
gaiaPointPtr gaiaAllocPoint ( double x, double y );

allocates a new Point object, returning a pointer to it; can return NULL if some error occurred
x and y are the coordinates identifying the point
void gaiaFreePoint ( gaiaPointPtr p );

destroys the Point object pointed by p, thus freeing any related memory allocation

general handling: Linestring objects

Synopsis
typedef struct gaiaLinestringStruct {
    int
Points;
    double *
Coords;
    double
MinX;
    double
MinY;
    double
MaxX;
    double
MaxY;
    struct gaiaLinestringStruct *
Next;
}
gaiaLinestring;
typedef gaiaLinestring *
gaiaLinestringPtr;
  • Points is the number of vertices stored into the following array
  • Coords is an array storing coordinates for vertices; you are expected to use the gaiaSetPoint() and gaiaGetPoints() macros in order to access them
  • MinX, MinY, MaxX and MaxY corresponds to the MBR related to this Linestring
  • Next is used in order to implement a linked list of Linestrings
gaiaLinestringPtr gaiaAllocLinestring ( int points );

allocates a new Linestring object [yet uninitialized] returning a pointer to it; can return NULL if some error occurred
points is the number of vertices to be allocated for the Linestring
gaiaLinestringPtr gaiaCloneLinestring ( gaiaLinestringPtr p );

duplicates the existing Linestring object pointed by p, returning a pointer to the new Linestring
void gaiaFreeLinestring ( gaiaLinestringPtr p );

destroys the Linestring object pointed by p, thus freeing any related memory allocation
void gaiaMbrLinestring ( gaiaLinestringPtr p );

updates the MBR of Linestring pointed by p
int gaiaLinestringEquals ( gaiaLinestringPtr line1 , gaiaLinestringPtr line2);

return 1 if the two Linestrings pointed by line1 and line2 are spatially equivalent; otherwise will return 0

general handling: RING objects

Synopsis
typedef struct gaiaRingStruct {
    int
Points;
    double *
Coords;
    int
Clockwise;
    double
MinX;
    double
MinY;
    double
MaxX;
    double
MaxY;
    struct gaiaRingStruct *
Next;
}
gaiaRing;
typedef gaiaRing *
gaiaRingPtr;
  • Points is the number of vertices stored into the following array
  • Coords is an array storing coordinates for vertices; you are expected to use the gaiaSetPoint() and gaiaGetPoints() macros in order to access them
  • Clockwise has a value 1 if this ring has clockwise direction; otherwise the ring has counterclockwise direction
  • MinX, MinY, MaxX and MaxY corresponds to the MBR related to this Ring
  • Next is used in order to implement a linked list of Rings
gaiaRingPtr gaiaAllocRing ( int points );

allocates a new Ring object [yet uninitialized] returning a pointer to it; can return NULL if some error occurred
points is the number of vertices to be allocated for the Ring
gaiaRingPtr gaiaCloneRing ( gaiaRingPtr p );

duplicates the existing Ring object pointed by p, returning a pointer to the new Ring
void gaiaFreeRing ( gaiaRingPtr p );

destroys the Ring object pointed by p, thus freeing any related memory allocation
void gaiaMbrRing ( gaiaRingPtr p );

updates the MBR of Ring pointed by p
double gaiaMeasureArea ( gaiaRingPtr p );

return the area of Ring pointed by p
void gaiaRingCentroid ( gaiaRingPtr p , double * x , double * y );

determines the centroid of Ring pointed by p
after execution x and y will contain the centroid's coordinates
void gaiaClockwise ( gaiaRingPtr p );

determines the direction of Ring pointed by p
after execution p->Clockwise will contain the current value for direction
void gaiaIsPointOnRingSurface ( gaiaRingPtr p , double x , double y );

returns 1 if the point identified by x and y falls on surface of Ring pointed by p
otherwise will return 0

general handling: common functions for both LINESTRING and RING objects

Synopsis
void gaiaSetPoint ( double * coords , int index , double x , double y );

sets the coordinates for the Linestring or Ring vertex
coords is a pointer to a Linestring or Ring coordinate's array
index is the array index identifying the vertex to be set
x and y are the coordinates

Caveat: this one is not really function, but is implemented as a macro
void gaiaGetPoint ( double * coords , int index , double * x , double * y );

gets the coordinates for the Linestring or Ring vertex
coords is a pointer to a Linestring or Ring coordinate's array
index is the array index identifying the vertex to be retrieved
after execution x and y will contain the coordinates

Caveat: this one is not really function, but is implemented as a macro
double gaiaMeasureLength ( double * coords , int points );

return the geometric length for a Linestring or Ring
coords is a pointer to a Linestring or Ring coordinate's array
points is the number of vertices stored into the coordinate's array
double gaiaMinDistance ( double x , double y , double * coords , int points );

return the minimum distance intercurring between a Point and a Linestring or Ring
x and y are the coordinates identifying the Point
coords is a pointer to a Linestring or Ring coordinate's array
points is the number of vertices stored into the coordinate's array

general handling: POLYGON objects

Synopsis
typedef struct gaiaPolygonStruct {
    gaiaRingPtr
Exterior;
    int
NumInteriors;
    gaiaRingPtr
Interiors;
    double
MinX;
    double
MinY;
    double
MaxX;
    double
MaxY;
    struct gaiaPolygonStruct *
Next;
}
gaiaPolygon;
typedef gaiaPolygon *
gaiaPolygonPtr;
  • Exterior is a pointer to the exterior ring
  • NumInteriors is the number of interior rings stored in the following array
  • Interiors is an array storing the interior rings; it can be NULL as well, because a Polygon can have any arbitrary number of interior rings, this including 0
  • MinX, MinY, MaxX and MaxY corresponds to the MBR related to this Polygon
  • Next is used in order to implement a linked list of Polygons
gaiaPolygonPtr gaiaAllocPolygon ( int points , int num_interiors );

allocates a Polygon object [yet uninitialized] returning a pointer to it; can return NULL if some error occurred
points is the number of vertices to be allocated for the exterior ring
num_interiors is the number of interior rings to be allocated
gaiaPolygonPtr gaiaCreatePolygon ( gaiaRingPtr exterior );

allocates a Polygon object returning a pointer to it; can return NULL if some error occurred
exterior has to point to an existing Ring assumed to be the exterior ring for this Polygon
gaiaPolygonPtr gaiaClonePolygon ( gaiaPolygonPtr p );

duplicates the existing Polygon object pointed by p, returning a pointer to the new Polygon
void gaiaFreePolygon ( gaiaPolygonPtr p );

destroys the Polygon object pointed by p, thus freeing any related memory allocation
void gaiaMbrPolygon( gaiaPolygonPtr p );

updates the MBR of Polygon pointed by p
gaiaRingPtr gaiaAddInteriorRing ( gaiaPolygonPtr p , int index , int points );

allocates the interior ring identified by index into Polygon pointed by p, returning a pointer to it
points is the number of vertices to be allocated for the interior ring
void gaiaInsertInteriorRing ( gaiaPolygonPtr p , gaiaRingPtr ring );

inserts the existing Ring pointed by ring into Polygon pointed by p, automatically extending the interior rings array and incrementing their number
ring is a pointer to an existing Ring assumed to be an interior ring for this Polygon
void gaiaIsPointOnPolygonSurface ( gaiaPolygonPtr p , double x , double y );

returns 1 if the point identified by x and y falls on surface of Polygon pointed by p
otherwise will return 0
int gaiaPolygonEquals ( gaiaPolygonPtr polyg1 , gaiaPolygonPtr polyg2);

return 1 if the two Polygons pointed by polyg1 and polyg2 are spatially equivalent; otherwise will return 0

general handling: GEOMETRY objects

Synopsis
typedef struct gaiaGeomCollStruct {
    int
Srid;
    gaiaPointPtr
FirstPoint;
    gaiaLinestringPtr
FirstLinestring;
    gaiaPolygonPtr
FirstPolygon;
    double
MinX;
    double
MinY;
    double
MaxX;
    double
MaxY;
}
gaiaGeomColl;
typedef gaiaGeomColl *
gaiaGeomCollPtr;
  • Srid identifies the SRID assigned to this Geometry; ; you can directly access this variable
  • FirstPoint is a pointer to the Points linked list
    it can be NULL if there isn't any Point in this Geometry
  • FirstLinestring is a pointer to the Linestrings linked list
    it can be NULL if there isn't any Linestring in this Geometry
  • FirstPolygon is a pointer to the Polygons linked list
    it can be NULL if there isn't any Polygon in this Geometry
  • MinX, MinY, MaxX and MaxY corresponds to the MBR related to this Geometry
gaiaGeomCollPtr gaiaAllocGeomColl ( void );

allocates a Geometry object [yet uninitialized] returning a pointer to it; can return NULL if some error occurred
gaiaGeomCollPtr gaiaCloneGeomColl ( gaiaGeomCollPtr p );

duplicates the existing Geometry object pointed by p, returning a pointer to the new Geometry
void gaiaFreeGeomColl ( gaiaGeomCollPtr p );

destroys the Geometry object pointed by p, thus freeing any related memory allocation
void gaiaMbrGeomColl ( gaiaGeomCollPtr p );

updates the MBR of Geometry pointed by p
void gaiaAddPointToGeomColl( gaiaGeomCollPtr p , double x , double y );

inserts a new Point into Geometry pointed by p
x and y are the coordinates identifying the point
gaiaLinestringPtr gaiaAddLinestringToGeomColl ( gaiaGeomCollPtr p , int points );

inserts a new [yet uninitialized] Linestring into Geometry pointed by p, returning a pointer to this Linestring
points is the number of vertices to be allocated for the Linestring
void gaiaInsertLinestringInGeomColl ( gaiaGeomCollPtr p , gaiaLinestring line );

inserts the existing Linestring pointed by line into Geometry pointed by p
gaiaPolygonPtr gaiaAddPolygonToGeomColl ( gaiaGeomCollPtr p , int points , int num_interiors );

inserts a new [yet uninitialized] Polygon into Geometry pointed by p, returning a pointer to this Polygon
points is the number of vertices to be allocated for the exterior ring
num_interiors is the number of interior rings to be allocated
gaiaPolygonPtr gaiaInsertPolygonInGeomColl ( gaiaGeomCollPtr p , gaiaRingPtr exterior );

inserts a new Polygon into Geometry pointed by p, returning a pointer to this Polygon
exterior is a pointer to an existing Ring assumed to be the exterior ring for this Polygon
int gaiaIsEmpty ( gaiaGeomCollPtr geom );

return 1 if Geometry pointed by geom is empty, i.e. contains no elementary Geometry
return 0 if not
int gaiaDimension ( gaiaGeomCollPtr geom );

return the dimension for Geometry pointed by geom; this can be:
  • -1 if Geometry in invalid or empty
  • 0 if Geometry is of Point or MultiPoint class
  • 1 if Geometry is of Linestring or MultiLinestring class
  • 2 if Geometry is of Polygon or MultiPolygon class
int gaiaGeometryType ( gaiaGeomCollPtr geom );
int
gaiaGeometryAliasType ( gaiaGeomCollPtr geom );

return the class for Geometry pointed by geom; this can be:
  • GAIA_UNKNOWN if Geometry in invalid or empty
  • GAIA_POINT
  • GAIA_LINESTRING
  • GAIA_POLYGON
  • GAIA_MULTIPOINT
  • GAIA_MULTILINESTRING
  • GAIA_MULTIPOLYGON
  • GAIA_GEOMETRYCOLLECTION
the second function assumes each elementary class to be equivalent to its Multixxx correspective

general handling: DynamicLine objects

Synopsis
typedef struct gaiaDynamicLineStruct {
    gaiaPointPtr
FirstPoint;
    gaiaPointPtr
LastPoint;
}
gaiaDynamicLine;
typedef gaiaDynamicLine *
gaiaDynamicLinePtr;
  • FirstPoint and LastPoint are pointers to the Points double linked list
    they can be NULL if there isn't any Point in this DynamicLine
gaiaDynamicLinePtr gaiaAllocDynamicLine ( void );

allocates an empty DynamicLine object returning a pointer to it; can return NULL if some error occurred
gaiaDynamicLinePtr gaiaCreateDynamicLine ( double * coords , int points );

transforms a Linestring or Ring into a DynamicLine object returning a pointer to it; can return NULL if some error occurred
coords is a pointer to a Linestring or Ring coordinate's array
points is the number of vertices stored into the coordinate's array
gaiaDynamicLinePtr gaiaCloneDynamicLine ( gaiaDynamicLinePtr p );

duplicates the existing DynamicLine object pointed by p, returning a pointer to the new DynamicLine
void gaiaFreeDynamicLine ( gaiaDynamicLinePtr p );

destroys the DynamicLine object pointed by p, thus freeing any related memory allocation
gaiaPointPtr gaiaAppendPointToDynamicLine ( gaiaDynamicLinePtr p , double x , double y );

inserts a new Point at the end of the DynamicLine object pointed by p, returning a pointer to this Point
x and y are the coordinates identifying the point
gaiaPointPtr gaiaPrependPointToDynamicLine ( gaiaDynamicLinePtr p , double x , double y );

inserts a new Point at the beginning of the DynamicLine object pointed by p, returning a pointer to this Point
x and y are the coordinates identifying the point
gaiaPointPtr gaiaDynamicLineInsertAfter ( gaiaDynamicLinePtr p , gaiaPointPtr ref_point , double x , double y );

inserts a new Point on the DynamicLine object pointed by p, returning a pointer to this Point
new point is inserted immediately after the Point pointed by ref_point; this ref_point has to be a point already inserted into the DynamicLine
x and y are the coordinates identifying the point to be inserted
gaiaPointPtr gaiaDynamicLineInsertBefore ( gaiaDynamicLinePtr p , gaiaPointPtr ref_point , double x , double y );

inserts a new Point on the DynamicLine object pointed by p, returning a pointer to this Point
new point is inserted immediately before the Point pointed by ref_point; this ref_point has to be a point already inserted into the DynamicLine
x and y are the coordinates identifying the point to be inserted
void gaiaDynamicLineDeletePoint ( gaiaDynamicLinePtr p , gaiaPointPtr point );

deletes an existing Point from the DynamicLine object pointed by p
point is a pointer identifying a point already inserted into the DynamicLine
gaiaDynamicLinePtr gaiaReverseDynamicLine ( gaiaDynamicLinePtr p );

duplicates the existing DynamicLine object pointed by p, returning a pointer to the new DynamicLine
vertices in the new DynamicLine will be in reverse ordered
gaiaDynamicLinePtr gaiaDynamicLineSplitBefore ( gaiaDynamicLinePtr p , gaiaPointPtr point );

splits the existing DynamicLine object pointed by p in two halves, returning a pointer to a new DynamicLine containing one half of the splitted line; the original line pointed by p will then contain the other half
point is a pointer identifying a point already inserted into the DynamicLine; this point will be the first point of the second half after splitting
gaiaDynamicLinePtr gaiaDynamicLineSplitAfter ( gaiaDynamicLinePtr p , gaiaPointPtr point );

splits the existing DynamicLine object pointed by p in two halves, returning a pointer to a new DynamicLine containing one half of the splitted line; the original line pointed by p will then contain the other half
point is a pointer identifying a point already inserted into the DynamicLine; this point will be the last point of the first half after splitting
gaiaDynamicLinePtr gaiaDynamicLineJoinAfter ( gaiaDynamicLinePtr org_line , gaiaPointPtr point , gaiaDynamicLinePtr join_line );

merges two existing DynamicLines objects pointed by org_line and join_line, returning a pointer to a new DynamicLine containing the merged line
point is a pointer identifying a point already inserted into org_line; the entire join_line will be inserted immediately after this point
gaiaDynamicLinePtr gaiaDynamicLineJoinBefore ( gaiaDynamicLinePtr org_line , gaiaPointPtr point , gaiaDynamicLinePtr join_line );

merges two existing DynamicLines objects pointed by org_line and join_line, returning a pointer to a new DynamicLine containing the merged line
point is a pointer identifying a point already inserted into org_line; the entire join_line will be inserted immediately before this point
gaiaPointPtr gaiaDynamicLineFindByCoords ( gaiaDynamicLinePtr p , double x , double y );

return a pointer to a Point already inserted into DynamicLines objects pointed by p; can return NULL if no such Point exists
x and y are the coordinates identifying the point to be searched for
gaiaPointPtr gaiaDynamicLineFindByCoords ( gaiaDynamicLinePtr p , int index );

return a pointer to a Point already inserted into DynamicLines objects pointed by p; can return NULL if no such Point exists
index is the relative position identifying the point

supporting WKT and WKB formats

Synopsis
gaiaGeomCollPtr gaiaParseWkt ( const unsigned char wkt , short mode );

return a pointer to a Geometry object corresponding to WKT expression pointed by wkt; can return NULL if some error occurred
mode can be used in order to restrict expected Geometry class, as follows:
  • setting mode to -1 any Geometry class can be accepted to be valid
  • setting mode to GAIA_POINT only a Geometry belonging to the Point class can be accepted to be valid
  • setting mode to GAIA_MULTIPOINT only a Geometry belonging to the MultiPoint class can be accepted to be valid
  • setting mode to GAIA_LINESTRING only a Geometry belonging to the Linestring class can be accepted to be valid
  • setting mode to GAIA_MULTILINESTRING only a Geometry belonging to the MultiLinestring class can be accepted to be valid
  • setting mode to GAIA_POLYGON only a Geometry belonging to the Polygon class can be accepted to be valid
  • setting mode to GAIA_MULTIPOLYGON only a Geometry belonging to the MultiPolygon class can be accepted to be valid
  • setting mode to GAIA_GEOMETRYCOLLECTION only q Geometry belonging to the GeometryCollection class can be accepted to be valid
void gaiaOutWkt ( gaiaGeomCollPtr geom , char ** wkt );

builds the WKT expression representing the Geometry object pointed by geom
WKT expressions can be very long, so after execution *wkt will point to temporary storage; you then have to free() this temporary storage when it's any longer needed
gaiaGeomCollPtr gaiaFromWkb ( const unsigned char * wkb , unsigned int wkb_size );

return a pointer to a Geometry object corresponding to WKB buffer pointed by wkb with a wkb_size length
can return NULL if some error occurred
void gaiaToWkb ( gaiaGeomCollPtr geom , unsigned char ** wkb , int * wkb_size );

builds the WKB buffer representing the Geometry object pointed by geom
WKB buffers can be very long, so after execution *wkb will point to temporary storage of wkb_size length; you then have to free() this temporary storage when it's any longer needed
char * gaiaToHexWkb ( gaiaGeomCollPtr geom );

return a string corresponding to hexadecimal WKB representing the Geometry object pointed by geom
hexadecimal WKB strings can be very long, so returned string will point to temporary storage; you then have to free() this temporary storage when it's any longer needed

supporting SpatiaLite BLOB-Geometry internal format

Synopsis
gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkb ( const unsigned char * blob_wkb , unsigned int blob_size );

return a pointer to a Geometry object corresponding to a SpatiaLite BLOB buffer pointed by blob_wkb with a blob_size length
can return NULL if some error occurred
void gaiaToSpatiaLiteBlobWkb ( gaiaGeomCollPtr geom , unsigned char ** blob_wkb , int * blob_size );

builds a SpatiaLite BLOB buffer representing the Geometry object pointed by geom
SpatiaLite BLOBS buffers can be very long, so after execution *blob_wkb will point to temporary storage of blob_size length; you then have to free() this temporary storage when it's any longer needed
void gaiaMakePoint ( double x , double y , int srid , unsigned char ** blob_wkb , int * blob_size );

builds a SpatiaLite BLOB buffer representing a Point-class Geometry object
after execution *blob_wkb will point to temporary storage of blob_size length; you then have to free() this temporary storage when it's any longer needed
x and y are the coordinates of the Point assigned to the Reference System identified by srid
void gaiaBuildMbr ( double x1 , double y1 , double x2 , double y2 , int srid , unsigned char ** blob_wkb , int * blob_size );

builds a SpatiaLite BLOB buffer representing a Polygon-class Geometry object
after execution *blob_wkb will point to temporary storage of blob_size length; you then have to free() this temporary storage when it's any longer needed
[x1 y1] and [x2 y2] are the coordinates of two Points, assumed to identify a rectangle's diagonal; then an MBR assigned to the Reference System identified by srid will be constructed
void gaiaBuildCircleMbr ( double cx , double cy , double radius , int srid , unsigned char ** blob_wkb , int * blob_size );

builds a SpatiaLite BLOB buffer representing a Polygon-class Geometry object
after execution *blob_wkb will point to temporary storage of blob_size length; you then have to free() this temporary storage when it's any longer needed
[cx cy] are the coordinates of a Point assumed to identify the centre for a circle of given radius; then an MBR assigned to the Reference System identified by srid will be constructed
gaiaGeomCollPtr gaiaFromSpatiaLiteBlobMbr ( const unsigned char * blob_wkb , unsigned int blob_size );

return a pointer to a Geometry object corresponding to a SpatiaLite BLOB buffer pointed by blob_wkb with a blob_size length
can return NULL if some error occurred
this function will not return the whole Geometry, but will return a Polygon representing its MBR
int gaiaGetMbrMinX ( const unsigned char * blob_wkb , unsigned int blob_size , double * value );
int gaiaGetMbrMaxX ( const unsigned char * blob_wkb , unsigned int blob_size , double * value );
int gaiaGetMbrMinY ( const unsigned char * blob_wkb , unsigned int blob_size , double * value );
int gaiaGetMbrMaxY ( const unsigned char * blob_wkb , unsigned int blob_size , double * value );

return 1 on success, or 0 on failure
after execution value will contain required coordinate for MBR associated to a SpatiaLite BLOB buffer pointed by blob_wkb with a blob_size length

evaluating MBRs relationships

Synopsis
int gaiaMbrsContains ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaMbrsDisjoint ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaMbrsEqual ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaMbrsIntersects ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaMbrsOverlaps ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaMbrsTouches ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaMbrsWithin ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );

return 1 if the required spatial relation is satisfied, or 0 if not
geom1 and geom2 are pointers referencing the Geometries whose MBRs are to be compared

Reference System transformation [PROJ.4 wrapping]


the following functions are available only if the SpatiaLite library has been built using --enable-proj=yes
Synopsis
double gaiaRadsToDegs ( double rads );

converts an angle measured in radians into corresponding degrees
double gaiaRadsToDegs ( double rads );

converts an angle measured in degrees into corresponding radians
gaiaGeomCollPtr gaiaTransform ( gaiaGeomCollPtr geom , char * proj_from , char * proj_to );

return a new Geometry (may be, an empty one) representing the transformation of Geometry pointed by geom from one Reference System to a different one
can return NULL if some error occurred
the strings proj_from and proj_to are expected to contain geodetic parameters for the origin Reference System and the destination one

advanced Spatial analysis [GEOS wrapping]


the following functions are available only if the SpatiaLite library has been built using --enable-geos=yes
Synopsis
int gaiaIsSimple ( gaiaGeomCollPtr geom );

return 1 if Geometry pointed by geom is simple, i.e. has no punctures, auto-intersections etc
return 0 if not
return -1 if some error occurred
int gaiaIsClosed ( gaiaGeomCollPtr geom );

return 1 if Geometry pointed by geom identifies a closed figure
return 0 if not
return -1 if some error occurred
int gaiaIsRing ( gaiaGeomCollPtr geom );

return 1 if Geometry pointed by geom can be used as a Ring, i.e. is both closed and simple
return 0 if not
return -1 if some error occurred
int gaiaIsValid ( gaiaGeomCollPtr geom );

return 1 if Geometry pointed by geom is a valid one
return 0 if not
return -1 if some error occurred
int gaiaGeomCollLength ( gaiaGeomCollPtr geom , double * length );

return 1 on success, or 0 on failure
after execution length contain the geometric length of Geometry pointed by geom
int gaiaGeomCollArea ( gaiaGeomCollPtr geom , double * area );

return 1 on success, or 0 on failure
after execution area contain the geometric area of Geometry pointed by geom
gaiaGeomCollPtr gaiaBoundary ( gaiaGeomCollPtr geom );
return a new Geometry (may be, an empty one) representing the boundary for Geometry pointed by geom
can return NULL if some error occurred
int gaiaGeomCollCentroid ( gaiaGeomCollPtr geom , double * x , double * y );

return 1 on success, or 0 on failure
after execution x and y will contain the coordinates identifying to centroid corresponding to Geometry pointed by geom
int gaiaGeomCollPointOnSurface ( gaiaGeomCollPtr geom , double * x , double * y );

return 1 on success, or 0 on failure
after execution x and y will contain the coordinates identifying a Point guaranteed to lay on the surface of Geometry pointed by geom
int gaiaGeomCollContains ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollDisjoint ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollEquals ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollIntersects ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollOverlaps ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollCrosses ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollTouches ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
int gaiaGeomCollWithin ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );

return 1 if the required spatial relation is satisfied, or 0 if not
geom1 and geom2 are pointers referencing the Geometries to compare
int gaiaGeomCollRelate ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 , const char * matrix_pattern );

return 1 if the required spatial relation is satisfied, or 0 if not
geom1 and geom2 are pointers referencing the Geometries to compare applying the required matrix_pattern
gaiaGeomCollPtr gaiaGeomCollIntersection ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
gaiaGeomCollPtr gaiaGeomCollUnion ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
gaiaGeomCollPtr gaiaGeomCollDifference ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );
gaiaGeomCollPtr gaiaGeomCollSymDifference ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 );

return a new Geometry (may be, an empty one) representing the result of required Spatial boolean operation
can return NULL if some error occurred
geom1 and geom2 are pointers referencing the Geometries to be used as operands for the required Spatial boolean operation
int gaiaGeomCollDistance ( gaiaGeomCollPtr geom1 , gaiaGeomCollPtr geom2 , double * dist );

return 1 on success, or 0 on failure
after execution dist will contain the distance intercurring between the two Geometries pointed by geom1 and geom2
gaiaGeomCollPtr gaiaConvexHull ( gaiaGeomCollPtr geom );

return a new Geometry (may be, an empty one) representing the convex hull for Geometry pointed by geom
can return NULL if some error occurred
gaiaGeomCollPtr gaiaBuffer ( gaiaGeomCollPtr geom , double radius , double points );

return a new Geometry (may be, an empty one) representing the GIS buffer for Geometry pointed by geom
can return NULL if some error occurred
radius specifies the buffer's radius; points specifies the number of vertices to be used when generating circles or circle arcs related to the buffer
gaiaGeomCollPtr gaiaGeomCollSimplify ( gaiaGeomCollPtr geom , double tolerance );
gaiaGeomCollPtr gaiaGeomCollSimplifyPreserveTopology ( gaiaGeomCollPtr geom , double tolerance );


return a new Geometry representing a simplified version of Geometry pointed by geom
can return NULL if some error occurred
simplification will apply the Douglas-Peukert algorithm; tolerance is the tolerance factor required by this algorithm
the second function will take extra cares in order to fully preserve the original topology
back to main page