SpatiaLite  4.2.0
 All Data Structures Files Functions Variables Typedefs Macros Pages
Typedefs | Functions
gg_wfs.h File Reference

WFS support. More...

Go to the source code of this file.

Typedefs

typedef struct gaia_wfs_catalog gaiaWFScatalog
 
typedef gaiaWFScatalog * gaiaWFScatalogPtr
 
typedef struct gaia_wfs_item gaiaWFSitem
 
typedef gaiaWFSitem * gaiaWFSitemPtr
 
typedef struct gaia_wfs_schema gaiaWFSschema
 
typedef gaiaWFSschema * gaiaWFSschemaPtr
 
typedef struct gaia_wfs_column gaiaWFScolumn
 
typedef gaiaWFScolumn * gaiaWFScolumnPtr
 

Functions

SPATIALITE_DECLARE int load_from_wfs (sqlite3 *sqlite, const char *path_or_url, const char *alt_describe_uri, const char *layer_name, int swap_axes, const char *table, const char *pk_column_name, int spatial_index, int *rows, char **err_msg, void(*progress_callback)(int, void *), void *callback_ptr)
 Loads data from some WFS source. More...
 
SPATIALITE_DECLARE int load_from_wfs_paged (sqlite3 *sqlite, const char *path_or_url, const char *alt_describe_uri, const char *layer_name, int swap_axes, const char *table, const char *pk_column_name, int spatial_index, int page_size, int *rows, char **err_msg, void(*progress_callback)(int, void *), void *callback_ptr)
 Loads data from some WFS source (using WFS paging) More...
 
SPATIALITE_DECLARE
gaiaWFScatalogPtr 
create_wfs_catalog (const char *path_or_url, char **err_msg)
 Creates a Catalog for some WFS service. More...
 
SPATIALITE_DECLARE void destroy_wfs_catalog (gaiaWFScatalogPtr handle)
 Destroys a WFS-Catalog object freeing any allocated resource. More...
 
SPATIALITE_DECLARE const char * get_wfs_base_request_url (gaiaWFScatalogPtr handle)
 Return the base URL for any WFS-GetFeature call. More...
 
SPATIALITE_DECLARE const char * get_wfs_base_describe_url (gaiaWFScatalogPtr handle)
 Return the base URL for any WFS-DescribeFeatureType call. More...
 
SPATIALITE_DECLARE char * get_wfs_request_url (gaiaWFScatalogPtr handle, const char *name, const char *version, int srid, int max_features)
 Return a GetFeature URL (GET) More...
 
SPATIALITE_DECLARE char * get_wfs_describe_url (gaiaWFScatalogPtr handle, const char *name, const char *version)
 Return a DescribeFeatureType URL (GET) More...
 
SPATIALITE_DECLARE int get_wfs_catalog_count (gaiaWFScatalogPtr handle)
 Return the total count of items (aka Layers) defined within a WFS-Catalog object. More...
 
SPATIALITE_DECLARE gaiaWFSitemPtr get_wfs_catalog_item (gaiaWFScatalogPtr handle, int index)
 Return the pointer to some specific Layer defined within a WFS-Catalog object. More...
 
SPATIALITE_DECLARE const char * get_wfs_item_name (gaiaWFSitemPtr handle)
 Return the name corresponding to some WFS-Item (aka Layer) object. More...
 
SPATIALITE_DECLARE const char * get_wfs_item_title (gaiaWFSitemPtr handle)
 Return the title corresponding to some WFS-Item (aka Layer) object. More...
 
SPATIALITE_DECLARE const char * get_wfs_item_abstract (gaiaWFSitemPtr handle)
 Return the abstract corresponding to some WFS-Item (aka Layer) object. More...
 
SPATIALITE_DECLARE int get_wfs_layer_srid_count (gaiaWFSitemPtr handle)
 Return the total count of SRIDs supported by a WFS-Item object. More...
 
SPATIALITE_DECLARE int get_wfs_layer_srid (gaiaWFSitemPtr handle, int index)
 Return one of the SRIDs supported by a WFS-Item object. More...
 
SPATIALITE_DECLARE int get_wfs_keyword_count (gaiaWFSitemPtr handle)
 Return the total count of Keywords associated to a WFS-Item object. More...
 
SPATIALITE_DECLARE const char * get_wfs_keyword (gaiaWFSitemPtr handle, int index)
 Return one of the Keywords supported by a WFS-Item object. More...
 
SPATIALITE_DECLARE gaiaWFSschemaPtr create_wfs_schema (const char *path_or_url, const char *layer_name, char **err_msg)
 Creates a Schema representing some WFS Layer. More...
 
SPATIALITE_DECLARE void destroy_wfs_schema (gaiaWFSschemaPtr handle)
 Destroys a WFS-schema object freeing any allocated resource. More...
 
SPATIALITE_DECLARE int get_wfs_schema_geometry_info (gaiaWFSschemaPtr handle, const char **name, int *type, int *srid, int *dims, int *nullable)
 Return the infos describing some WFS-GeometryColumn object. More...
 
SPATIALITE_DECLARE int get_wfs_schema_column_count (gaiaWFSschemaPtr handle)
 Return the total count of items (aka Columns) defined within a WFS-Schema object. More...
 
SPATIALITE_DECLARE gaiaWFScolumnPtr get_wfs_schema_column (gaiaWFSschemaPtr handle, int index)
 Return the pointer to some specific Column defined within a WFS-Schema object. More...
 
SPATIALITE_DECLARE int get_wfs_schema_column_info (gaiaWFScolumnPtr handle, const char **name, int *type, int *nullable)
 Return the infos describing some WFS-Column object. More...
 
SPATIALITE_DECLARE void reset_wfs_http_connection (void)
 Resets the libxml2 "nano HTTP": useful when changing the HTTP_PROXY settings. More...
 

Detailed Description

WFS support.

Function Documentation

SPATIALITE_DECLARE gaiaWFScatalogPtr create_wfs_catalog ( const char *  path_or_url,
char **  err_msg 
)

Creates a Catalog for some WFS service.

Parameters
path_or_urlpointer to some WFS-GetCapabilities XML Document (could be a pathname or an URL).
err_msgon completion will contain an error message (if any)
Returns
the pointer to the corresponding WFS-Catalog object: NULL on failure
See Also
destroy_wfs_catalog, get_wfs_catalog_count, get_wfs_catalog_item, load_from_wfs, reset_wfs_http_connection
Note
an eventual error message returned via err_msg requires to be deallocated by invoking free().
you are responsible to destroy (before or after) any WFS-Catalog returned by create_wfs_catalog().
SPATIALITE_DECLARE gaiaWFSschemaPtr create_wfs_schema ( const char *  path_or_url,
const char *  layer_name,
char **  err_msg 
)

Creates a Schema representing some WFS Layer.

Parameters
path_or_urlpointer to some WFS-DescribeFeatureType XML Document (could be a pathname or an URL).
err_msgon completion will contain an error message (if any)
Returns
the pointer to the corresponding WFS-Schema object: NULL on failure
See Also
destroy_wfs_schema,get_wfs_schema_column_count, get_wfs_schema_column_info, get_wfs_schema_geometry_info
Note
an eventual error message returned via err_msg requires to be deallocated by invoking free().
you are responsible to destroy (before or after) any WFS-Schema returned by create_wfs_schema().
SPATIALITE_DECLARE void destroy_wfs_catalog ( gaiaWFScatalogPtr  handle)

Destroys a WFS-Catalog object freeing any allocated resource.

Parameters
handlethe pointer to a valid WFS-Catalog returned by a previous call to create_wfs_catalog()
See Also
create_wfs_catalog
SPATIALITE_DECLARE void destroy_wfs_schema ( gaiaWFSschemaPtr  handle)

Destroys a WFS-schema object freeing any allocated resource.

Parameters
handlethe pointer to a valid WFS-Catalog returned by a previous call to create_wfs_schema()
See Also
create_wfs_schema
SPATIALITE_DECLARE const char* get_wfs_base_describe_url ( gaiaWFScatalogPtr  handle)

Return the base URL for any WFS-DescribeFeatureType call.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the base URL for any WFS-DescribeFeatureType call: NULL is undefined
See Also
create_wfs_catalog, get_wfs_base_request_url, get_wfs_describe_url
SPATIALITE_DECLARE const char* get_wfs_base_request_url ( gaiaWFScatalogPtr  handle)

Return the base URL for any WFS-GetFeature call.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the base URL for any WFS-GetFeature call: NULL is undefined
See Also
create_wfs_catalog, get_wfs_base_describe_url, get_wfs_request_url
SPATIALITE_DECLARE int get_wfs_catalog_count ( gaiaWFScatalogPtr  handle)

Return the total count of items (aka Layers) defined within a WFS-Catalog object.

Parameters
handlethe pointer to a valid WFS-Catalog returned by a previous call to create_wfs_catalog()
Returns
the total count of items (aka Layers) defined within a WFS-Catalog object: a negative number if the WFS-Catalog isn't valid
See Also
create_wfs_catalog, get_wfs_catalog_item
SPATIALITE_DECLARE gaiaWFSitemPtr get_wfs_catalog_item ( gaiaWFScatalogPtr  handle,
int  index 
)

Return the pointer to some specific Layer defined within a WFS-Catalog object.

Parameters
handlethe pointer to a valid WFS-Catalog returned by a previous call to create_wfs_catalog()
indexthe relative index identifying the required WFS-Layer (the first Item in the WFS-Catalaog object has index ZERO).
Returns
the pointer to the required WFS-Layer object: NULL if the passed index isn't valid
See Also
create_wfs_catalog, get_wfs_catalog_count, get_wfs_item_name, get_wfs_item_title, get_wfs_item_abstract, get_wfs_layer_srid_count, get_wfs_layer_srid, get_wfs_keyword_count, get_wfs_keyword
SPATIALITE_DECLARE char* get_wfs_describe_url ( gaiaWFScatalogPtr  handle,
const char *  name,
const char *  version 
)

Return a DescribeFeatureType URL (GET)

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
namethe NAME uniquely identifying the required WFS layer.
versioncould be "1.0.0" or "1.1.0"; if NULL or invalid "1.1.0" will be assumed.
Returns
the DescribeFeatureType URL: NULL if any error is found.
See Also
get_wfs_base_describe_url, get_wfs_request_url
Note
you are responsible to destroy (before or after) any allocated memory returned by get_wfs_describe_url().
SPATIALITE_DECLARE const char* get_wfs_item_abstract ( gaiaWFSitemPtr  handle)

Return the abstract corresponding to some WFS-Item (aka Layer) object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the abstract corresponding to the WFS-Layer object
See Also
get_wfs_item_name, get_wfs_item_title, get_wfs_layer_srid_count, get_wfs_layer_srid, get_wfs_keyword_count, get_wfs_keyword
SPATIALITE_DECLARE const char* get_wfs_item_name ( gaiaWFSitemPtr  handle)

Return the name corresponding to some WFS-Item (aka Layer) object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the name corresponding to the WFS-Layer object
See Also
get_wfs_layer_title, get_wfs_layer_abstract, get_wfs_layer_srid_count, get_wfs_layer_srid, get_wfs_keyword_count, get_wfs_keyword
SPATIALITE_DECLARE const char* get_wfs_item_title ( gaiaWFSitemPtr  handle)

Return the title corresponding to some WFS-Item (aka Layer) object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the title corresponding to the WFS-Layer object
See Also
get_wfs_item_name, get_wfs_item_abstract, get_wfs_layer_srid_count, get_wfs_layer_srid, get_wfs_keyword_count, get_wfs_keyword
SPATIALITE_DECLARE const char* get_wfs_keyword ( gaiaWFSitemPtr  handle,
int  index 
)

Return one of the Keywords supported by a WFS-Item object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
indexthe relative index identifying the required Keyword (the first Keyword associated to a WFS-Item object has index ZERO).
Returns
the Keyword value: NULL if the required Keyword isn't defined.
See Also
get_wfs_item_name, get_wfs_item_title, get_wfs_item_abstract, get_wfs_layer_srid_count, get_wfs_layer_srid, get_wfs_layer_keyword
SPATIALITE_DECLARE int get_wfs_keyword_count ( gaiaWFSitemPtr  handle)

Return the total count of Keywords associated to a WFS-Item object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the total count of Keyword associated to a WFS-Item object: a negative number if the WFS-Item isn't valid
See Also
get_wfs_item_name, get_wfs_item_title, get_wfs_item_abstract, get_wfs_layer_srid_count, get_wfs_layer_srid, get_wfs_layer_keyword
SPATIALITE_DECLARE int get_wfs_layer_srid ( gaiaWFSitemPtr  handle,
int  index 
)

Return one of the SRIDs supported by a WFS-Item object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
indexthe relative index identifying the required SRID (the first SRID value supported by a WFS-Item object has index ZERO).
Returns
the SRID-value: a negative number if the required SRID-value isn't defined.
See Also
get_wfs_item_name, get_wfs_item_title, get_wfs_item_abstract, get_wfs_layer_srid_count, get_wfs_keyword_count, get_wfs_keyword
SPATIALITE_DECLARE int get_wfs_layer_srid_count ( gaiaWFSitemPtr  handle)

Return the total count of SRIDs supported by a WFS-Item object.

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
Returns
the total count of SRIDs supported by a WFS-Item object: a negative number if the WFS-Item isn't valid
See Also
get_wfs_item_name, get_wfs_item_title, get_wfs_item_abstract, get_wfs_layer_srid, get_wfs_keyword_count, get_wfs_keyword
SPATIALITE_DECLARE char* get_wfs_request_url ( gaiaWFScatalogPtr  handle,
const char *  name,
const char *  version,
int  srid,
int  max_features 
)

Return a GetFeature URL (GET)

Parameters
handlethe pointer to a valid WFS-Item returned by a previous call to get_wfs_catalog_item().
namethe NAME uniquely identifying the required WFS layer.
versioncould be "1.0.0" or "1.1.0"; if NULL or invalid "1.1.0" will be assumed.
sridthe preferred SRS to be used for WFS geometries; if negative or mismatching will be simply ignored.
max_featuresthe WFS MAXFEATURES argument; any negative or zero value will be ignored.
Returns
the GetFeature URL: NULL if any error is found.
See Also
get_wfs_base_request_url, get_wfs_describe_url
Note
you are responsible to destroy (before or after) any allocated memory returned by get_wfs_request_url().
SPATIALITE_DECLARE gaiaWFScolumnPtr get_wfs_schema_column ( gaiaWFSschemaPtr  handle,
int  index 
)

Return the pointer to some specific Column defined within a WFS-Schema object.

Parameters
handlethe pointer to a valid WFS-Schema returned by a previous call to create_wfs_schema()
indexthe relative index identifying the required WFS-Column (the first Item in the WFS-Schema object has index ZERO).
Returns
the pointer to the required WFS-Column object: NULL if the passed index isn't valid
See Also
create_wfs_schema, get_wfs_schema_geometry_info, get_wfs_schema_column_count, get_wfs_schema_column_info
SPATIALITE_DECLARE int get_wfs_schema_column_count ( gaiaWFSschemaPtr  handle)

Return the total count of items (aka Columns) defined within a WFS-Schema object.

Parameters
handlethe pointer to a valid WFS-Schema returned by a previous call to create_wfs_schema()
Returns
the total count of items (aka Columns) defined within a WFS-Schema object: a negative number if the WFS-Schema isn't valid
See Also
create_wfs_schema, get_wfs_schema_geometry_info, get_wfs_schema_column, get_wfs_schema_column_info
SPATIALITE_DECLARE int get_wfs_schema_column_info ( gaiaWFScolumnPtr  handle,
const char **  name,
int *  type,
int *  nullable 
)

Return the infos describing some WFS-Column object.

Parameters
handlethe pointer to a valid WFS-Column returned by a previous call to get_wfs_schema_column().
nameon completion will contain a pointer to the Column name
typeon completion will contain the datatype set for the Column; could be one of SQLITE_TEXT, SQLITE_INTEGER or SQLITE_FLOAT
nullableon completion will contain a Boolean value; if TRUE the Column may contain NULL-values.
Returns
TRUE on success, FALSE if any error is encountered
See Also
get_wfs_schema_column, get_wfs_schema_geometry_info
SPATIALITE_DECLARE int get_wfs_schema_geometry_info ( gaiaWFSschemaPtr  handle,
const char **  name,
int *  type,
int *  srid,
int *  dims,
int *  nullable 
)

Return the infos describing some WFS-GeometryColumn object.

Parameters
handlethe pointer to a valid WFS-Schema returned by a previous call to create_wfs_schema().
nameon completion will contain a pointer to the GeometryColumn name
typeon completion will contain the GeometryType set for the Column; could be one of GAIA_POINT, GAIA_LINESTRING, GAIA_POLYGON, GAIA_MULTIPOINT, GAIA_MULTILINESTRING, GAIA_MULTIPOLYGON or GAIA_GEOMETRYCOLLECTION
sridon completion will contain the SRID-value set for the GeometryColumn
dimson completion will contain the dimensions (2 or 3) set for the GeometryColumn
nullableon completion will contain a Boolean value; if TRUE the Column may contain NULL-values.
Returns
TRUE on success, FALSE if any error is encountered or if the WFS-Schema hasn't any Geometry-Column defined.
See Also
create_wfs_schema, get_wfs_schema_column_count, get_wfs_schema_column, get_wfs_schema_column_info
SPATIALITE_DECLARE int load_from_wfs ( sqlite3 *  sqlite,
const char *  path_or_url,
const char *  alt_describe_uri,
const char *  layer_name,
int  swap_axes,
const char *  table,
const char *  pk_column_name,
int  spatial_index,
int *  rows,
char **  err_msg,
void(*)(int, void *)  progress_callback,
void *  callback_ptr 
)

Loads data from some WFS source.

Parameters
sqlitehandle to current DB connection
path_or_urlpointer to some WFS-GetFeature XML Document (could be a pathname or an URL).
alt_describe_urian alternative URI for DescribeFeatureType to be used if no one is found within the XML document returned by GetFeature.
layer_namethe name of the WFS layer.
swap_axesif TRUE the X and Y axes will be swapped
tablethe name of the table to be created
pk_columnname of the Primary Key column; if NULL or mismatching then "PK_UID" will be assumed by default.
spatial_indexif TRUE an R*Tree Spatial Index will be created
rowson completion will contain the total number of actually imported rows
err_msgon completion will contain an error message (if any)
progress_callbackpointer to a callback function to be invoked immediately after processing each WFS page (could be NULL)
callback_ptran arbitrary pointer (to be passed as the second argument by the callback function).
See Also
create_wfs_catalog, load_from_wfs_paged, reset_wfs_http_connection
Returns
0 on failure, any other value on success
Note
an eventual error message returned via err_msg requires to be deallocated by invoking free()
please note: this one simply is a convenience method, and exactly corresponds to load_from_wfs_paged() setting a negative page size.
SPATIALITE_DECLARE int load_from_wfs_paged ( sqlite3 *  sqlite,
const char *  path_or_url,
const char *  alt_describe_uri,
const char *  layer_name,
int  swap_axes,
const char *  table,
const char *  pk_column_name,
int  spatial_index,
int  page_size,
int *  rows,
char **  err_msg,
void(*)(int, void *)  progress_callback,
void *  callback_ptr 
)

Loads data from some WFS source (using WFS paging)

Parameters
sqlitehandle to current DB connection
path_or_urlpointer to some WFS-GetFeature XML Document (could be a pathname or an URL).
alt_describe_urian alternative URI for DescribeFeatureType to be used if no one is found within the XML document returned by GetFeature.
layer_namethe name of the WFS layer.
swap_axesif TRUE the X and Y axes will be swapped
tablethe name of the table to be created
pk_columnname of the Primary Key column; if NULL or mismatching then "PK_UID" will be assumed by default.
spatial_indexif TRUE an R*Tree Spatial Index will be created
page_sizemax number of features for each single WFS call; if zero or negative a single monolithic page is assumed (i.e. paging will not be applied).
rowson completion will contain the total number of actually imported rows
err_msgon completion will contain an error message (if any)
progress_callbackpointer to a callback function to be invoked immediately after processing each WFS page (could be NULL)
callback_ptran arbitrary pointer (to be passed as the second argument by the callback function).
See Also
create_wfs_catalog, load_from_wfs, reset_wfs_http_connection
Returns
0 on failure, any other value on success
Note
an eventual error message returned via err_msg requires to be deallocated by invoking free()
the progress_callback function must have this signature: void myfunct(int count, void *ptr);
and will cyclically report how many features have been processed since the initial call start.
SPATIALITE_DECLARE void reset_wfs_http_connection ( void  )

Resets the libxml2 "nano HTTP": useful when changing the HTTP_PROXY settings.

See Also
create_wfs_catalog, load_from_wfs, load_from_wfs_paged