Changeset: 94e5fe036240 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94e5fe036240
Added Files:
        sql/backends/monet5/vaults/shp/75_shp.mal
        sql/backends/monet5/vaults/shp/75_shp.sql
        sql/backends/monet5/vaults/shp/Makefile.ag
        sql/backends/monet5/vaults/shp/shp.c
        sql/backends/monet5/vaults/shp/shp.h
        sql/backends/monet5/vaults/shp/shp.mal
Modified Files:
        configure.ag
        sql/backends/monet5/vaults/Makefile.ag
Branch: default
Log Message:

Added the ESRI Shapefile vault


diffs (truncated from 1107 to 300 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -170,6 +170,13 @@ AC_ARG_ENABLE(lidar,
        enable_lidar=$enableval,
        enable_lidar=$dft_lidar)
 
+dft_shp=auto
+AC_ARG_ENABLE(shp,
+       AS_HELP_STRING([--enable-shp],
+               [enable support for ESRI Shapefiles (default=auto)]),
+       enable_shp=$enableval,
+       enable_shp=$dft_shp)
+
 dft_sql=yes
 AC_ARG_ENABLE(sql,
        AS_HELP_STRING([--enable-sql],
@@ -2677,6 +2684,81 @@ AM_CONDITIONAL(HAVE_LIDAR, test "x$enabl
 
 AC_MSG_CHECKING(['enable lidar: $enable_lidar'])
 
+# gdal
+org_have_gdal="auto"
+have_gdal=$org_have_gdal
+AC_ARG_WITH(gdal,
+       AS_HELP_STRING([--with-gdal=DIR],
+               [gdal library is installed in DIR]),
+               [have_gdal="$withval"], [have_gdal="auto"])
+# first autoconf for distributions that added a .pc file themselves (Fedora)
+if test "x$have_gdal" != xno; then
+       case "$have_gdal" in
+       auto|yes)
+               PKG_CHECK_MODULES([GDAL], [gdal], [have_gdal="pkgconf"], 
[have_gdal="$have_gdal"])
+               ;;
+       *)
+               GDAL_CFLAGS="-I$have_gdal/include"
+               GDAL_LIBS="-L$have_gdal/lib"
+               ;;
+       esac
+fi
+# try to detect it manually like upstream provides it
+if test "x$have_gdal" != xno && test "x$have_gdal" != xpkgconf; then
+       save_CPPFLAGS="$CPPFLAGS"
+       save_LDFLAGS="$LDFLAGS"
+       save_LIBS="$LIBS"
+       CPPFLAGS="$CPPFLAGS $GDAL_CFLAGS"
+       LDFLAGS="$LDFLAGS $GDAL_LIBS"
+       LIBS=""
+       found_gdal_h=yes
+       AC_CHECK_HEADER(gdal.h,,
+               AC_CHECK_HEADER(gdal/gdal.h,
+                       [if test "x$GDAL_CFLAGS" = x; then
+                               GDAL_CFLAGS="-I/usr/include/gdal"
+                       else
+                               GDAL_CFLAGS="$GDAL_CFLAGS/gdal"
+                       fi
+                       CPPFLAGS="$save_CPPFLAGS $GDAL_CFLAGS"],
+                       [found_gdal_h=no]))
+       if test "x$found_gdal_h" = xyes; then
+               AC_CHECK_LIB(gdal, GDALAllRegister,
+                       [AC_DEFINE(HAVE_GDAL, 1, [Define if you have the gdal 
library])
+                               have_gdal=yes
+                               LIBS="$LIBS -lgdal"],
+                       [ if test "x$have_gdal" != xauto; then 
AC_MSG_ERROR([-lgdal library not found]); fi
+                               have_gdal=no; why_have_gdal="(gdal library not 
found)" ],
+                       [$MATH_LIBS])
+       else
+               if test "x$have_gdal" != xauto; then AC_MSG_ERROR([gdal.h 
header not found]); fi
+               have_gdal=no; why_have_gdal="(gdal.h header not found)"
+       fi
+       GDAL_LIBS="$GDAL_LIBS $LIBS"
+       LDFLAGS="$save_LDFLAGS"
+       CPPFLAGS="$save_CPPFLAGS"
+       LIBS="$save_LIBS"
+       if test "x$have_gdal" != "xyes"; then
+               GDAL_CFLAGS=""
+               GDAL_LIBS=""
+       fi
+fi
+
+AC_SUBST(gdal_CFLAGS, $GDAL_CFLAGS)
+AC_SUBST(gdal_LIBS, $GDAL_LIBS)
+AM_CONDITIONAL(HAVE_GDAL, test x"$have_gdal" != xno)
+
+# if shp is enabled and gdal was not found abort
+if test "x$have_gdal" = xno; then
+       if test "x$enable_shp" = xyes; then
+               AC_MSG_ERROR([gdal library required for ESRI shape file module])
+       fi
+       # no gdal, so don't compile shp
+       enable_shp=no
+       if test "x$disable_shp" = x; then
+               disable_shp=${why_have_shp:-"(gdal library required for shape 
file module)"}
+       fi
+fi
+AM_CONDITIONAL(HAVE_SHP, test x"$enable_shp" != xno)
 
 PKG_CHECK_MODULES([atomic_ops], [atomic_ops], [have_atomic_ops="yes"],
        [have_atomic_ops="no"; why_have_atomic_ops="(atomic_ops library not 
found)"])
@@ -3519,6 +3601,7 @@ for comp in \
        'readline     ' \
        'rubygem      ' \
        'samtools     ' \
+       'shp          ' \
        'sphinxclient ' \
        'unixodbc     ' \
        'valgrind     ' \
diff --git a/sql/backends/monet5/vaults/Makefile.ag 
b/sql/backends/monet5/vaults/Makefile.ag
--- a/sql/backends/monet5/vaults/Makefile.ag
+++ b/sql/backends/monet5/vaults/Makefile.ag
@@ -4,7 +4,7 @@
 #
 # Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
 
-SUBDIRS = HAVE_SAMTOOLS?bam HAVE_FITS?fits HAVE_LIDAR?lidar HAVE_NETCDF?netcdf
+SUBDIRS = HAVE_SAMTOOLS?bam HAVE_FITS?fits HAVE_LIDAR?lidar HAVE_NETCDF?netcdf 
HAVE_SHP?shp
 
 INCLUDES = ../../../include \
           ../../../common \
diff --git a/sql/backends/monet5/vaults/shp/75_shp.mal 
b/sql/backends/monet5/vaults/shp/75_shp.mal
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/vaults/shp/75_shp.mal
@@ -0,0 +1,20 @@
+# The contents of this file are subject to the MonetDB Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.monetdb.org/Legal/MonetDBLicense
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is the MonetDB Database System.
+#
+# The Initial Developer of the Original Code is CWI.
+# Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+# Copyright August 2008-2015 MonetDB B.V.
+# All Rights Reserved.
+
+# This loads the MonetDB/SQL module
+library shp;
+include shp;
diff --git a/sql/backends/monet5/vaults/shp/75_shp.sql 
b/sql/backends/monet5/vaults/shp/75_shp.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/vaults/shp/75_shp.sql
@@ -0,0 +1,20 @@
+# The contents of this file are subject to the MonetDB Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.monetdb.org/Legal/MonetDBLicense
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is the MonetDB Database System.
+#
+# The Initial Developer of the Original Code is CWI.
+# Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+# Copyright August 2008-2015 MonetDB B.V.
+# All Rights Reserved.
+
+# This loads the MonetDB/SQL module
+library shp;
+include shp;
diff --git a/sql/backends/monet5/vaults/shp/Makefile.ag 
b/sql/backends/monet5/vaults/shp/Makefile.ag
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/vaults/shp/Makefile.ag
@@ -0,0 +1,51 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
+
+INCLUDES = ../ \
+       ../../ \
+       ../../../../include \
+          ../../../../common \
+          ../../../../storage \
+          ../../../../server \
+          ../../../../../monetdb5/modules/atoms \
+          ../../../../../monetdb5/modules/kernel \
+          ../../../../../monetdb5/mal \
+          ../../../../../monetdb5/modules/mal \
+          ../../../../../monetdb5/optimizer \
+          ../../../../../monetdb5/scheduler \
+          ../../../../../clients/mapilib \
+          ../../../../../common/options \
+          ../../../../../common/stream \
+          ../../../../../common/utils \
+          ../../../../../gdk \
+          $(READLINE_INCS) \
+          $(GDAL_CFLAGS)
+
+lib__shp = {
+       MODULE
+       DIR = libdir/monetdb5
+       SOURCES = shp.c shp.h
+       LIBS = ../../../../../monetdb5/tools/libmonetdb5 \
+              $(GDAL_LIBS)
+}
+
+headers_lidarmal = {
+       HEADERS = mal
+       DIR = libdir/monetdb5
+       SOURCES = shp.mal
+}
+
+headers_lidarsql = {
+       HEADERS = sql
+       DIR = libdir/monetdb5/createdb
+       SOURCES = 75_shp.sql
+}
+
+headers_lidarautoload = {
+       HEADERS = mal
+       DIR = libdir/monetdb5/autoload
+       SOURCES = 75_shp.mal
+}
diff --git a/sql/backends/monet5/vaults/shp/shp.c 
b/sql/backends/monet5/vaults/shp/shp.c
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/vaults/shp/shp.c
@@ -0,0 +1,746 @@
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.monetdb.org/Legal/MonetDBLicense
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2014 MonetDB B.V.
+ * All Rights Reserved.
+*/
+
+#include <monetdb_config.h>
+#include <string.h>
+/*#include <gdal.h>*/
+/*#include <ogr_api.h>*/
+#include "sql_mvc.h"
+#include "sql.h"
+#include <stdlib.h>
+#include "shp.h"
+#include "sql_scenario.h"
+#include "mal_exception.h"
+
+#include <geom.h>
+
+/* FIXME: the use of the 'rs' schema should be reconsidered so that the geotiff
+ * catalog can be integrated into the SQL catalog.
+ * When removing the 'rs' schame, the code of client/mapiclient/dump.c MUST be
+ * adapted accordingly.
+ */
+
+/*#define BUFSIZ 524288*/
+
+/*void getMBB(char * source) {
+       SBNSearchHandle handle;
+       char * name;
+       int i;
+
+       name = malloc((strlen(source) + 1) * sizeof(char));
+       for (i=0 ; i<strlen(source) + 1 ; i++) {
+               if (i == strlen(source)) {
+                       name[i] = '\0';
+               }
+               else if (i == strlen(source) - 1) {
+                       name[i] = 'n';
+               }
+               else if (i == strlen(source) - 2) {
+                       name[i] = 'b';
+               }
+               else if (i == strlen(source) - 3) {
+                       name[i] = 's';
+               }
+               else {
+                       name[i] = source[i];
+               }
+       }
+       handle = SBNOpenDiskTree(source, NULL);
+}*/
+
+GDALWConnection * GDALWConnect(char * source) {
+       GDALWConnection * conn = NULL;
+       OGRFeatureDefnH featureDefn;
+       int fieldCount, i;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to