SpatiaLite  4.1.0
 All Data Structures Files Functions Variables Typedefs Macros Pages
spatialite.h
Go to the documentation of this file.
1 /*
2  spatialite.h -- Gaia spatial support for SQLite
3 
4  version 4.1, 2013 May 8
5 
6  Author: Sandro Furieri a.furieri@lqt.it
7 
8  ------------------------------------------------------------------------------
9 
10  Version: MPL 1.1/GPL 2.0/LGPL 2.1
11 
12  The contents of this file are subject to the Mozilla Public License Version
13  1.1 (the "License"); you may not use this file except in compliance with
14  the License. You may obtain a copy of the License at
15  http://www.mozilla.org/MPL/
16 
17 Software distributed under the License is distributed on an "AS IS" basis,
18 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19 for the specific language governing rights and limitations under the
20 License.
21 
22 The Original Code is the SpatiaLite library
23 
24 The Initial Developer of the Original Code is Alessandro Furieri
25 
26 Portions created by the Initial Developer are Copyright (C) 2008-2013
27 the Initial Developer. All Rights Reserved.
28 
29 Contributor(s):
30 
31 Alternatively, the contents of this file may be used under the terms of
32 either the GNU General Public License Version 2 or later (the "GPL"), or
33 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
34 in which case the provisions of the GPL or the LGPL are applicable instead
35 of those above. If you wish to allow use of your version of this file only
36 under the terms of either the GPL or the LGPL, and not to allow others to
37 use your version of this file under the terms of the MPL, indicate your
38 decision by deleting the provisions above and replace them with the notice
39 and other provisions required by the GPL or the LGPL. If you do not delete
40 the provisions above, a recipient may use your version of this file under
41 the terms of any one of the MPL, the GPL or the LGPL.
42 
43 */
44 
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 #ifdef _WIN32
52 #ifdef DLL_EXPORT
53 #define SPATIALITE_DECLARE __declspec(dllexport)
54 #else
55 #define SPATIALITE_DECLARE extern
56 #endif
57 #else
58 #define SPATIALITE_DECLARE __attribute__ ((visibility("default")))
59 #endif
60 #endif
61 
62 #ifndef _SPATIALITE_H
63 #ifndef DOXYGEN_SHOULD_SKIP_THIS
64 #define _SPATIALITE_H
65 #endif
66 
67 
68 #ifdef __cplusplus
69 extern "C"
70 {
71 #endif
72 
73 #include <spatialite/gaiageo.h>
74 
78  SPATIALITE_DECLARE const char *spatialite_version (void);
79 
86  SPATIALITE_DECLARE void *spatialite_alloc_connection (void);
87 
102  SPATIALITE_DECLARE void spatialite_init (int verbose);
103 
117  SPATIALITE_DECLARE void spatialite_init_ex (sqlite3 * db_handle, void *ptr,
118  int verbose);
119 
126  SPATIALITE_DECLARE void spatialite_init_geos (void);
127 
138  SPATIALITE_DECLARE void spatialite_cleanup (void);
139 
151  SPATIALITE_DECLARE void spatialite_cleanup_ex (void *ptr);
152 
168  SPATIALITE_DECLARE int dump_shapefile (sqlite3 * sqlite, char *table,
169  char *column, char *shp_path,
170  char *charset, char *geom_type,
171  int verbose, int *rows,
172  char *err_msg);
173 
197  SPATIALITE_DECLARE int load_shapefile (sqlite3 * sqlite, char *shp_path,
198  char *table, char *charset, int srid,
199  char *column, int coerce2d,
200  int compressed, int verbose,
201  int spatial_index, int *rows,
202  char *err_msg);
203 
240  SPATIALITE_DECLARE int load_shapefile_ex (sqlite3 * sqlite, char *shp_path,
241  char *table, char *charset,
242  int srid, char *geo_column,
243  char *gtype, char *pk_column,
244  int coerce2d, int compressed,
245  int verbose, int spatial_index,
246  int *rows, char *err_msg);
247 
266  SPATIALITE_DECLARE int load_dbf (sqlite3 * sqlite, char *dbf_path,
267  char *table, char *charset, int verbose,
268  int *rows, char *err_msg);
269 
287  SPATIALITE_DECLARE int load_dbf_ex (sqlite3 * sqlite, char *dbf_path,
288  char *table, char *pk_column,
289  char *charset, int verbose, int *rows,
290  char *err_msg);
291 
292 
304  SPATIALITE_DECLARE int dump_dbf (sqlite3 * sqlite, char *table,
305  char *dbf_path, char *charset,
306  char *err_msg);
307 
321  SPATIALITE_DECLARE int load_XL (sqlite3 * sqlite, const char *path,
322  const char *table,
323  unsigned int worksheetIndex,
324  int first_titles, unsigned int *rows,
325  char *err_msg);
326 
334  SPATIALITE_DECLARE double math_round (double value);
335 
343  SPATIALITE_DECLARE sqlite3_int64 math_llabs (sqlite3_int64 value);
344 
360  SPATIALITE_DECLARE int spatial_ref_sys_init (sqlite3 * sqlite, int verbose);
361 
374  SPATIALITE_DECLARE int spatial_ref_sys_init2 (sqlite3 * sqlite, int mode,
375  int verbose);
376 
385  SPATIALITE_DECLARE int insert_epsg_srid (sqlite3 * sqlite, int srid);
386 
398  SPATIALITE_DECLARE int
399  is_kml_constant (sqlite3 * sqlite, char *table, char *column);
400 
414  SPATIALITE_DECLARE int dump_kml (sqlite3 * sqlite, char *table,
415  char *geom_col, char *kml_path,
416  char *name_col, char *desc_col,
417  int precision);
418 
431  SPATIALITE_DECLARE void check_duplicated_rows (sqlite3 * sqlite,
432  char *table,
433  int *dupl_count);
434 
446  SPATIALITE_DECLARE void remove_duplicated_rows (sqlite3 * sqlite,
447  char *table);
448 
466  SPATIALITE_DECLARE void elementary_geometries (sqlite3 * sqlite,
467  char *inTable,
468  char *geometry,
469  char *outTable, char *pKey,
470  char *multiId);
471 
492  SPATIALITE_DECLARE int dump_geojson (sqlite3 * sqlite, char *table,
493  char *geom_col, char *outfile_path,
494  int precision, int option);
495 
517  SPATIALITE_DECLARE int update_layer_statistics (sqlite3 * sqlite,
518  const char *table,
519  const char *column);
520 
543  SPATIALITE_DECLARE gaiaGeomCollPtr gaiaGetLayerExtent (sqlite3 * handle,
544  const char *table,
545  const char *geometry,
546  int mode);
547 
570  SPATIALITE_DECLARE gaiaVectorLayersListPtr gaiaGetVectorLayersList (sqlite3
571  *
572  handle,
573  const
574  char
575  *table,
576  const
577  char
578  *geometry,
579  int
580  mode);
581 
589  SPATIALITE_DECLARE void gaiaFreeVectorLayersList (gaiaVectorLayersListPtr
590  ptr);
591 
605  SPATIALITE_DECLARE int gaiaDropTable (sqlite3 * sqlite, const char *table);
606 
628  SPATIALITE_DECLARE int check_geometry_column (sqlite3 * sqlite,
629  const char *table,
630  const char *geom,
631  const char *report_path,
632  int *n_rows, int *n_invalids,
633  char **err_msg);
634 
652  SPATIALITE_DECLARE int check_all_geometry_columns (sqlite3 * sqlite,
653  const char *output_dir,
654  int *n_invalids,
655  char **err_msg);
656 
686  SPATIALITE_DECLARE int sanitize_geometry_column (sqlite3 * sqlite,
687  const char *table,
688  const char *geom,
689  const char *tmp_table,
690  const char *report_path,
691  int *n_invalids,
692  int *n_repaired,
693  int *n_discarded,
694  int *n_failures,
695  char **err_msg);
696 
719  SPATIALITE_DECLARE int sanitize_all_geometry_columns (sqlite3 * sqlite,
720  const char
721  *tmp_prefix,
722  const char
723  *output_dir,
724  int *not_repaired,
725  char **err_msg);
726 
727 #ifdef __cplusplus
728 }
729 #endif
730 
731 #endif /* _SPATIALITE_H */