[pktools] 26/375: before xmas holidays, see Changelog

Bas Couwenberg sebastic at xs4all.nl
Wed Dec 3 21:53:55 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch upstream-master
in repository pktools.

commit 7fa96571d550f8ca611d15a968390ea6dacbdd5e
Author: Pieter Kempeneers <kempenep at gmail.com>
Date:   Fri Dec 21 18:51:25 2012 +0100

    before xmas holidays, see Changelog
---
 ChangeLog                        |   7 ++
 aclocal.m4                       |  14 +--
 configure                        | 254 +++++++++++++++++----------------------
 src/algorithms/SensorModel.h     |  28 ++++-
 src/apps/Makefile.am             |   5 +-
 src/apps/Makefile.in             |  40 +++---
 src/apps/pkascii2img.cc          |  20 +--
 src/apps/pkascii2ogr.cc          |   6 +-
 src/apps/pkcreatect.cc           |   4 +-
 src/apps/pkinfo.cc               |  15 ++-
 src/apps/pklas2img.cc            |  28 +++--
 src/apps/pksensormodel.cc        |  40 +++---
 src/imageclasses/ImgWriterOgr.cc | 179 ++++++++++++++++++---------
 src/imageclasses/ImgWriterOgr.h  |   2 +-
 14 files changed, 371 insertions(+), 271 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5df163c..3cfd117 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,9 +44,14 @@ version 2.4
 	in addition to internal setNoData member variable, also support GDALSetNoData
  - ImgWriterGdal.cc
 	in addition to internal setNoData member variable, also support GDALSetNoData
+ - ImgWriterOGR.h
+	renamed ascii2shape to ascii2ogr, support csv file in ascii2ogr
+ - ImgWriterOGR.cc
+	renamed ascii2shape to ascii2ogr, support csv file in ascii2ogr
  - pkinfo
 	support of nodata value when calculating histogram and image statistics
 	options min and max are now set with -min (--min) and -max (--max)
+	option min and max now per default empty and can be set individually for calculating histogram
  - pkfilter
 	bug solved in update of progress bar
 	support of standard deviation
@@ -60,3 +65,5 @@ version 2.4
 	tool to create simple vector files from coordinates in ASCII file (points or polygon)
  - pksensormodel
 	tool to model pushbroom sensor
+ - pkascii2ogr
+	support csv input file
diff --git a/aclocal.m4 b/aclocal.m4
index 0e0a984..1f01ab1 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
+[m4_warning([this file was generated for autoconf 2.67.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -47,8 +47,7 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
 # ----------------------------------
 AC_DEFUN([PKG_PROG_PKG_CONFIG],
 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
-m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
@@ -94,8 +93,7 @@ m4_define([_PKG_CONFIG],
     pkg_cv_[]$1="$$1"
  elif test -n "$PKG_CONFIG"; then
     PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes ],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
 		     [pkg_failed=yes])
  else
     pkg_failed=untried
@@ -143,9 +141,9 @@ if test $pkg_failed = yes; then
    	AC_MSG_RESULT([no])
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
         else 
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
diff --git a/configure b/configure
index 71ee5ee..5ea37c6 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for pktools 2.4.
+# Generated by GNU Autoconf 2.67 for pktools 2.4.
 #
 # Report bugs to <kempenep at gmail.com>.
 #
@@ -91,7 +91,6 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -217,18 +216,11 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -1155,7 +1147,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
   esac
@@ -1470,7 +1462,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 pktools configure 2.4
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.67
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1516,7 +1508,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_compile
@@ -1554,7 +1546,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
@@ -1591,7 +1583,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_cpp
@@ -1604,10 +1596,10 @@ fi
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -1674,7 +1666,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -1683,7 +1675,7 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_mongrel
 
@@ -1724,7 +1716,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_run
@@ -1738,7 +1730,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1756,7 +1748,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_compile
 
@@ -1792,7 +1784,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_cpp
@@ -1834,7 +1826,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_run
@@ -1847,10 +1839,10 @@ fi
 ac_fn_cxx_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -1917,7 +1909,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -1926,7 +1918,7 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_cxx_check_header_mongrel
 
@@ -1939,7 +1931,7 @@ ac_fn_cxx_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1980,7 +1972,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_cxx_check_type
 cat >config.log <<_ACEOF
@@ -1988,7 +1980,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by pktools $as_me 2.4, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   $ $0 $@
 
@@ -2246,7 +2238,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
 
@@ -2383,7 +2375,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if ${ac_cv_path_install+:} false; then :
+if test "${ac_cv_path_install+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2470,11 +2462,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2560,7 +2552,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
+if test "${ac_cv_prog_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2600,7 +2592,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2653,7 +2645,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if ${ac_cv_path_mkdir+:} false; then :
+  if test "${ac_cv_path_mkdir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2704,7 +2696,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
+if test "${ac_cv_prog_AWK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2744,7 +2736,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2858,7 +2850,7 @@ fi
 set dummy gdal-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GDAL_CONFIG+:} false; then :
+if test "${ac_cv_path_GDAL_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GDAL_CONFIG in
@@ -2899,7 +2891,7 @@ else
 set dummy gdal-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GDAL_CONFIG+:} false; then :
+if test "${ac_cv_path_GDAL_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GDAL_CONFIG in
@@ -3065,7 +3057,7 @@ if test -z "$CXX"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CXX+:} false; then :
+if test "${ac_cv_prog_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
@@ -3109,7 +3101,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
@@ -3273,7 +3265,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C++ compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3316,7 +3308,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3375,7 +3367,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C++ compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
     fi
   fi
 fi
@@ -3386,7 +3378,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
+if test "${ac_cv_objext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3427,7 +3419,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -3437,7 +3429,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if ${ac_cv_cxx_compiler_gnu+:} false; then :
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3474,7 +3466,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
 $as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if ${ac_cv_prog_cxx_g+:} false; then :
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -3622,7 +3614,7 @@ depcc="$CXX"  am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -3750,7 +3742,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -3790,7 +3782,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
 set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -3855,7 +3847,7 @@ fi
 set dummy gdal-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GDAL_CONFIG+:} false; then :
+if test "${ac_cv_path_GDAL_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GDAL_CONFIG in
@@ -3896,7 +3888,7 @@ else
 set dummy gdal-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GDAL_CONFIG+:} false; then :
+if test "${ac_cv_path_GDAL_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GDAL_CONFIG in
@@ -4040,7 +4032,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -4080,7 +4072,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -4133,7 +4125,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -4173,7 +4165,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -4232,7 +4224,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -4276,7 +4268,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -4331,7 +4323,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -4360,7 +4352,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4397,7 +4389,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
+if test "${ac_cv_prog_cc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -4475,7 +4467,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -4574,7 +4566,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4710,7 +4702,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
+  if test "${ac_cv_prog_CPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -4826,7 +4818,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -4838,7 +4830,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
+if test "${ac_cv_path_GREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4901,7 +4893,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
+if test "${ac_cv_path_EGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4968,7 +4960,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5098,7 +5090,7 @@ done
 for ac_header in gdal.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "gdal.h" "ac_cv_header_gdal_h" "$ac_includes_default"
-if test "x$ac_cv_header_gdal_h" = xyes; then :
+if test "x$ac_cv_header_gdal_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_GDAL_H 1
 _ACEOF
@@ -5120,14 +5112,13 @@ fi
 
 
 
-
 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 	if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -5170,7 +5161,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -5251,7 +5242,6 @@ if test -n "$FANN_CFLAGS"; then
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_FANN_CFLAGS=`$PKG_CONFIG --cflags "fann >= 2.1.0" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -5268,7 +5258,6 @@ if test -n "$FANN_LIBS"; then
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_FANN_LIBS=`$PKG_CONFIG --libs "fann >= 2.1.0" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -5288,9 +5277,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        FANN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fann >= 2.1.0" 2>&1`
+	        FANN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fann >= 2.1.0" 2>&1`
         else
-	        FANN_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fann >= 2.1.0" 2>&1`
+	        FANN_PKG_ERRORS=`$PKG_CONFIG --print-errors "fann >= 2.1.0" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$FANN_PKG_ERRORS" >&5
@@ -5394,7 +5383,6 @@ if test -n "$NLOPT_CFLAGS"; then
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_NLOPT_CFLAGS=`$PKG_CONFIG --cflags "nlopt >= 2.1.0" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -5411,7 +5399,6 @@ if test -n "$NLOPT_LIBS"; then
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_NLOPT_LIBS=`$PKG_CONFIG --libs "nlopt >= 2.1.0" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -5431,9 +5418,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        NLOPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "nlopt >= 2.1.0" 2>&1`
+	        NLOPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "nlopt >= 2.1.0" 2>&1`
         else
-	        NLOPT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "nlopt >= 2.1.0" 2>&1`
+	        NLOPT_PKG_ERRORS=`$PKG_CONFIG --print-errors "nlopt >= 2.1.0" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$NLOPT_PKG_ERRORS" >&5
@@ -5492,7 +5479,6 @@ if test -n "$GSL_CFLAGS"; then
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_GSL_CFLAGS=`$PKG_CONFIG --cflags "gsl >= 1.14" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -5509,7 +5495,6 @@ if test -n "$GSL_LIBS"; then
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_GSL_LIBS=`$PKG_CONFIG --libs "gsl >= 1.14" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -5529,9 +5514,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        GSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gsl >= 1.14" 2>&1`
+	        GSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gsl >= 1.14" 2>&1`
         else
-	        GSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gsl >= 1.14" 2>&1`
+	        GSL_PKG_ERRORS=`$PKG_CONFIG --print-errors "gsl >= 1.14" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$GSL_PKG_ERRORS" >&5
@@ -5575,7 +5560,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
 $as_echo_n "checking how to run the C++ preprocessor... " >&6; }
 if test -z "$CXXCPP"; then
-  if ${ac_cv_prog_CXXCPP+:} false; then :
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CXXCPP needs to be expanded
@@ -5691,7 +5676,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=cpp
@@ -5703,7 +5688,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5816,7 +5801,7 @@ fi
 for ac_header in string
 do :
   ac_fn_cxx_check_header_mongrel "$LINENO" "string" "ac_cv_header_string" "$ac_includes_default"
-if test "x$ac_cv_header_string" = xyes; then :
+if test "x$ac_cv_header_string" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_STRING 1
 _ACEOF
@@ -5828,7 +5813,7 @@ done
 for ac_header in iostream
 do :
   ac_fn_cxx_check_header_mongrel "$LINENO" "iostream" "ac_cv_header_iostream" "$ac_includes_default"
-if test "x$ac_cv_header_iostream" = xyes; then :
+if test "x$ac_cv_header_iostream" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_IOSTREAM 1
 _ACEOF
@@ -5840,7 +5825,7 @@ done
 
 # Checks for typedefs, structures, and compiler characteristics.
 ac_fn_cxx_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = xyes; then :
+if test "x$ac_cv_type_size_t" = x""yes; then :
 
 else
 
@@ -5928,21 +5913,10 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    if test "x$cache_file" != "x/dev/null"; then
+    test "x$cache_file" != "x/dev/null" &&
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-      if test ! -f "$cache_file" || test -h "$cache_file"; then
-	cat confcache >"$cache_file"
-      else
-        case $cache_file in #(
-        */* | ?:*)
-	  mv -f confcache "$cache_file"$$ &&
-	  mv -f "$cache_file"$$ "$cache_file" ;; #(
-        *)
-	  mv -f confcache "$cache_file" ;;
-	esac
-      fi
-    fi
+    cat confcache >$cache_file
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -6022,7 +5996,7 @@ if test -z "${USE_GSL_TRUE}" && test -z "${USE_GSL_FALSE}"; then
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: "${CONFIG_STATUS=./config.status}"
+: ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -6123,7 +6097,6 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -6431,7 +6404,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by pktools $as_me 2.4, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -6497,7 +6470,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 pktools config.status 2.4
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.67,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -6634,7 +6607,7 @@ do
     "src/fileclasses/Makefile") CONFIG_FILES="$CONFIG_FILES src/fileclasses/Makefile" ;;
     "src/apps/Makefile") CONFIG_FILES="$CONFIG_FILES src/apps/Makefile" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
 
@@ -6657,10 +6630,9 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp= ac_tmp=
+  tmp=
   trap 'exit_status=$?
-  : "${ac_tmp:=$tmp}"
-  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -6668,13 +6640,12 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -d "$tmp"
+  test -n "$tmp" && test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -6696,7 +6667,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -6724,7 +6695,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -6772,7 +6743,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -6804,7 +6775,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
   || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
@@ -6838,7 +6809,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+cat >"$tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -6850,8 +6821,8 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_tt"; then
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
     as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -6952,7 +6923,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -6971,7 +6942,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$ac_tmp/stdin";;
+      -) ac_f="$tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -6980,7 +6951,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -7006,8 +6977,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$ac_tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
   esac
@@ -7143,22 +7114,21 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
-  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
-      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$ac_tmp/stdin"
+  rm -f "$tmp/stdin"
   case $ac_file in
-  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
-  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
@@ -7169,20 +7139,20 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
-    } >"$ac_tmp/config.h" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$ac_tmp/config.h" "$ac_file" \
+      mv "$tmp/config.h" "$ac_file" \
 	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
diff --git a/src/algorithms/SensorModel.h b/src/algorithms/SensorModel.h
index 34fece3..6bebf9a 100644
--- a/src/algorithms/SensorModel.h
+++ b/src/algorithms/SensorModel.h
@@ -90,14 +90,34 @@ namespace SensorModel
     gsl::vector getBoresightAtt() const{return m_bcatt;};
     void setPolynome(const std::vector<double>& polynome) {m_polynome=polynome;};
     void setDatum(const std::string& theDatum="WGS84"){m_spatialref.SetWellKnownGeogCS(theDatum.c_str());};
-    double getZenith(const gsl::vector& att_platform) const{
+    double getZenith(const gsl::vector& att_platform, int row, int column) const{
       gsl::vector normallevel(3);
       gsl::vector normalplatform(3);
+
+      gsl::vector apl_deg=att_platform;
+      apl_deg+=m_bcatt;
+      gsl::vector apl_rad(3);
+      apl_rad[0]=deg2rad(apl_deg[0]);//roll
+      apl_rad[1]=deg2rad(apl_deg[1]);//pitch
+      apl_rad[2]=deg2rad(apl_deg[2]);//yaw
+
+      if(getModel()==PUSHBROOM){
+        gsl::vector scanAngle(2);
+        scanAngle=scanAngle_PB(row,column);
+        apl_rad[0]+=scanAngle[1];
+        apl_rad[1]+=scanAngle[0];
+      }
+      else if(getModel()==WHISKBROOM){
+        apl_rad[0]+=0;
+        apl_rad[1]=tan(scanAngle_WB(column));
+      }
+      else//not implemented?
+        assert(0);
       normallevel[0]=0;
       normallevel[1]=0;
       normallevel[2]=-1;
       gsl::matrix rotM(3,3);
-      rotM=getRz(deg2rad(att_platform[2]))*getRy(deg2rad(att_platform[1]))*getRx(deg2rad(att_platform[0]));
+      rotM=getRz(apl_rad[2])*getRy(apl_rad[1])*getRx(apl_rad[0]);
       normalplatform=rotM*normallevel;
       return rad2deg(acos(-normalplatform[2]));
     };
@@ -208,7 +228,7 @@ namespace SensorModel
       poCT->Transform(1,&lon,&lat);
     };
 
-  gsl::vector pECEF(const gsl::vector& pos, const gsl::vector& attitude, int row, int column) const{
+    gsl::vector pECEF(const gsl::vector& pos, const gsl::vector& attitude, int row, int column) const{
       gsl::vector A(3);
       gsl::matrix B(3,3);
       B.set_element(0,0,-sin(pos[1])*cos(pos[0]));
@@ -246,7 +266,7 @@ namespace SensorModel
     double scanAngle_WB(int column) const{
       return (-m_fov/2.0+column*(m_fov/(m_ncol-1)));
     };
-  gsl::vector SV(int row, int column, const gsl::vector& attitude, double z) const{
+    gsl::vector SV(int row, int column, const gsl::vector& attitude, double z) const{
       gsl::vector rv(3);
       gsl::matrix rotM(3,3);
       rotM=getRz(attitude[2])*getRy(attitude[1])*getRx(attitude[0]);
diff --git a/src/apps/Makefile.am b/src/apps/Makefile.am
index ee09a09..eb3120e 100644
--- a/src/apps/Makefile.am
+++ b/src/apps/Makefile.am
@@ -6,7 +6,7 @@ LDADD = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.a $(top_bui
 ###############################################################################
 
 # the program to build (the names of the final binaries)
-bin_PROGRAMS = pkinfo pkcrop pkreclass pkgetmask pksetmask pkcreatect pkdumpimg pkdumpogr pksieve pkstat pkstatogr pkegcs pkextract pkfillnodata pkfilter pkdsm2shadow pkmosaic pkndvi pkpolygonize pkascii2img pkdiff pkclassify_svm #pkascii2ogr pkgeom
+bin_PROGRAMS = pkinfo pkcrop pkreclass pkgetmask pksetmask pkcreatect pkdumpimg pkdumpogr pksieve pkstat pkstatogr pkegcs pkextract pkfillnodata pkfilter pkdsm2shadow pkmosaic pkndvi pkpolygonize pkascii2img pkdiff pkclassify_svm pkascii2ogr #pkxcorimg pkgeom
 if USE_FANN
 bin_PROGRAMS += pkclassify_nn
 pkclassify_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.h pkclassify_nn.cc
@@ -50,6 +50,7 @@ pkpolygonize_SOURCES = pkpolygonize.cc
 pkdiff_SOURCES = pkdiff.cc
 pkclassify_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkclassify_svm.cc
 pkascii2img_SOURCES = pkascii2img.cc
-#pkascii2ogr_SOURCES = pkascii2ogr.cc
+pkascii2ogr_SOURCES = pkascii2ogr.cc
+#pkxcorimg_SOURCES= pkxcorimg.cc
 #pkgeom_SOURCES = pkgeom.cc
 ###############################################################################
diff --git a/src/apps/Makefile.in b/src/apps/Makefile.in
index d314402..61c9158 100644
--- a/src/apps/Makefile.in
+++ b/src/apps/Makefile.in
@@ -39,8 +39,8 @@ bin_PROGRAMS = pkinfo$(EXEEXT) pkcrop$(EXEEXT) pkreclass$(EXEEXT) \
 	pkextract$(EXEEXT) pkfillnodata$(EXEEXT) pkfilter$(EXEEXT) \
 	pkdsm2shadow$(EXEEXT) pkmosaic$(EXEEXT) pkndvi$(EXEEXT) \
 	pkpolygonize$(EXEEXT) pkascii2img$(EXEEXT) pkdiff$(EXEEXT) \
-	pkclassify_svm$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
-	$(am__EXEEXT_3)
+	pkclassify_svm$(EXEEXT) pkascii2ogr$(EXEEXT) $(am__EXEEXT_1) \
+	$(am__EXEEXT_2) $(am__EXEEXT_3)
 @USE_FANN_TRUE at am__append_1 = pkclassify_nn
 @USE_LAS_TRUE at am__append_2 = pklas2img
 @USE_NLOPT_TRUE at am__append_3 = pksensormodel
@@ -67,6 +67,12 @@ am__DEPENDENCIES_1 =
 pkascii2img_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/algorithms/libalgorithms.a \
 	$(top_builddir)/src/imageclasses/libimageClasses.a
+am_pkascii2ogr_OBJECTS = pkascii2ogr.$(OBJEXT)
+pkascii2ogr_OBJECTS = $(am_pkascii2ogr_OBJECTS)
+pkascii2ogr_LDADD = $(LDADD)
+pkascii2ogr_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(top_builddir)/src/algorithms/libalgorithms.a \
+	$(top_builddir)/src/imageclasses/libimageClasses.a
 am__pkclassify_nn_SOURCES_DIST =  \
 	$(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.h \
 	pkclassify_nn.cc
@@ -224,17 +230,18 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(pkascii2img_SOURCES) $(pkclassify_nn_SOURCES) \
-	$(pkclassify_svm_SOURCES) $(pkcreatect_SOURCES) \
-	$(pkcrop_SOURCES) $(pkdiff_SOURCES) $(pkdsm2shadow_SOURCES) \
-	$(pkdumpimg_SOURCES) $(pkdumpogr_SOURCES) $(pkegcs_SOURCES) \
-	$(pkextract_SOURCES) $(pkfillnodata_SOURCES) \
-	$(pkfilter_SOURCES) $(pkgetmask_SOURCES) $(pkinfo_SOURCES) \
-	$(pklas2img_SOURCES) $(pkmosaic_SOURCES) $(pkndvi_SOURCES) \
-	$(pkpolygonize_SOURCES) $(pkreclass_SOURCES) \
-	$(pksensormodel_SOURCES) $(pksetmask_SOURCES) \
-	$(pksieve_SOURCES) $(pkstat_SOURCES) $(pkstatogr_SOURCES)
-DIST_SOURCES = $(pkascii2img_SOURCES) \
+SOURCES = $(pkascii2img_SOURCES) $(pkascii2ogr_SOURCES) \
+	$(pkclassify_nn_SOURCES) $(pkclassify_svm_SOURCES) \
+	$(pkcreatect_SOURCES) $(pkcrop_SOURCES) $(pkdiff_SOURCES) \
+	$(pkdsm2shadow_SOURCES) $(pkdumpimg_SOURCES) \
+	$(pkdumpogr_SOURCES) $(pkegcs_SOURCES) $(pkextract_SOURCES) \
+	$(pkfillnodata_SOURCES) $(pkfilter_SOURCES) \
+	$(pkgetmask_SOURCES) $(pkinfo_SOURCES) $(pklas2img_SOURCES) \
+	$(pkmosaic_SOURCES) $(pkndvi_SOURCES) $(pkpolygonize_SOURCES) \
+	$(pkreclass_SOURCES) $(pksensormodel_SOURCES) \
+	$(pksetmask_SOURCES) $(pksieve_SOURCES) $(pkstat_SOURCES) \
+	$(pkstatogr_SOURCES)
+DIST_SOURCES = $(pkascii2img_SOURCES) $(pkascii2ogr_SOURCES) \
 	$(am__pkclassify_nn_SOURCES_DIST) $(pkclassify_svm_SOURCES) \
 	$(pkcreatect_SOURCES) $(pkcrop_SOURCES) $(pkdiff_SOURCES) \
 	$(pkdsm2shadow_SOURCES) $(pkdumpimg_SOURCES) \
@@ -392,6 +399,7 @@ pkpolygonize_SOURCES = pkpolygonize.cc
 pkdiff_SOURCES = pkdiff.cc
 pkclassify_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkclassify_svm.cc
 pkascii2img_SOURCES = pkascii2img.cc
+pkascii2ogr_SOURCES = pkascii2ogr.cc
 all: all-am
 
 .SUFFIXES:
@@ -466,6 +474,9 @@ clean-binPROGRAMS:
 pkascii2img$(EXEEXT): $(pkascii2img_OBJECTS) $(pkascii2img_DEPENDENCIES) 
 	@rm -f pkascii2img$(EXEEXT)
 	$(CXXLINK) $(pkascii2img_OBJECTS) $(pkascii2img_LDADD) $(LIBS)
+pkascii2ogr$(EXEEXT): $(pkascii2ogr_OBJECTS) $(pkascii2ogr_DEPENDENCIES) 
+	@rm -f pkascii2ogr$(EXEEXT)
+	$(CXXLINK) $(pkascii2ogr_OBJECTS) $(pkascii2ogr_LDADD) $(LIBS)
 pkclassify_nn$(EXEEXT): $(pkclassify_nn_OBJECTS) $(pkclassify_nn_DEPENDENCIES) 
 	@rm -f pkclassify_nn$(EXEEXT)
 	$(pkclassify_nn_LINK) $(pkclassify_nn_OBJECTS) $(pkclassify_nn_LDADD) $(LIBS)
@@ -546,6 +557,7 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkascii2img.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkascii2ogr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkclassify_nn-pkclassify_nn.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkclassify_svm.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkcreatect.Po at am__quote@
@@ -826,7 +838,7 @@ uninstall-am: uninstall-binPROGRAMS
 	mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
 	uninstall-am uninstall-binPROGRAMS
 
-#pkascii2ogr_SOURCES = pkascii2ogr.cc
+#pkxcorimg_SOURCES= pkxcorimg.cc
 #pkgeom_SOURCES = pkgeom.cc
 ###############################################################################
 
diff --git a/src/apps/pkascii2img.cc b/src/apps/pkascii2img.cc
index 56490ad..03caf61 100644
--- a/src/apps/pkascii2img.cc
+++ b/src/apps/pkascii2img.cc
@@ -39,18 +39,18 @@ int main(int argc, char *argv[])
   Optionpk<bool> license_opt("lic","license","show license information",false);
   Optionpk<bool> help_opt("h","help","shows this help info",false);
   Optionpk<bool> todo_opt("\0","todo","introduce -uli -ulj to crop based on image coordinates",false);
-  Optionpk<std::string> input_opt("i","input","input ASCII file","");
-  Optionpk<string> output_opt("o", "output", "Output image file", "");
-  Optionpk<string> dataType_opt("ot", "otype", "Data type for output image ({Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}). Empty string: inherit type from input image", "");
+  Optionpk<std::string> input_opt("i","input","input ASCII file");
+  Optionpk<string> output_opt("o", "output", "Output image file");
+  Optionpk<string> dataType_opt("ot", "otype", "Data type for output image ({Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}). Empty string: inherit type from input image","Byte");
   Optionpk<string> imageType_opt("of", "oformat", "image type string (default: GTiff, see also gdal_translate)", "GTiff");
   Optionpk<string> option_opt("co", "co", "options: NAME=VALUE [-co COMPRESS=LZW] [-co INTERLEAVE=BAND]");
   Optionpk<double> ulx_opt("ulx", "ulx", "Upper left x value bounding box (in geocoordinates if georef is true)", 0.0);
   Optionpk<double> uly_opt("uly", "uly", "Upper left y value bounding box (in geocoordinates if georef is true)", 0.0);
   Optionpk<double> dx_opt("dx", "dx", "Output resolution in x (in meter) (default is 0.0: keep original resolution)", 0.0);
   Optionpk<double> dy_opt("dy", "dy", "Output resolution in y (in meter) (default is 0.0: keep original resolution)", 0.0);
-  Optionpk<string> projection_opt("p", "projection", "projection string (default is empty: no projection)", "");
-  Optionpk<string> colorTable_opt("ct", "ct", "color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid)", "");
-  Optionpk<string> description_opt("d", "description", "Set image description", "");
+  Optionpk<string> projection_opt("p", "projection", "projection string (default is empty: no projection)");
+  Optionpk<string> colorTable_opt("ct", "ct", "color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid)");
+  Optionpk<string> description_opt("d", "description", "Set image description");
   Optionpk<bool> verbose_opt("v", "verbose", "verbose (false)", false);
 
   version_opt.retrieveOption(argc,argv);
@@ -85,6 +85,8 @@ int main(int argc, char *argv[])
     cout << "usage: pkascii2img -i asciifile -o imgfile [OPTIONS]" << endl;
     exit(0);
   }
+  assert(input_opt.size());
+  assert(output_opt.size());
   ImgWriterGdal imgWriter;
   ifstream ifile(input_opt[0].c_str(),ios::in);
   //get number of lines
@@ -149,9 +151,9 @@ int main(int argc, char *argv[])
   }
 
   imgWriter.open(output_opt[0],ncol,nrow,1,dataType,imageType_opt[0],option_opt);
-  if(description_opt[0]!="")
+  if(description_opt.size())
     imgWriter.setImageDescription(description_opt[0]);
-  if(projection_opt[0]!=""){
+  if(projection_opt.size()){
     if(verbose_opt[0])
       cout << output_opt[0] << " is georeferenced." << endl;
     imgWriter.setGeoTransform(ulx_opt[0],uly_opt[0],dx_opt[0],dy_opt[0],0,0);
@@ -162,7 +164,7 @@ int main(int argc, char *argv[])
       cout << output_opt[0] << " is not georeferenced." << endl;
     assert(!imgWriter.isGeoRef());
   }
-  if(colorTable_opt[0]!=""){
+  if(colorTable_opt.size()){
     assert(imgWriter.getDataType()==GDT_Byte);
     imgWriter.setColorTable(colorTable_opt[0]);
   }
diff --git a/src/apps/pkascii2ogr.cc b/src/apps/pkascii2ogr.cc
index b56a305..6ab9c2c 100644
--- a/src/apps/pkascii2ogr.cc
+++ b/src/apps/pkascii2ogr.cc
@@ -48,6 +48,7 @@ int main(int argc, char *argv[])
   Optionpk<string> ftype_opt("ot", "ot", "Field type (Real, Integer, String) for each of the fields as defined by name","Real");
   Optionpk<string> itype_opt("of", "of", "image type string", "ESRI Shapefile");
   Optionpk<string> projection_opt("p", "projection", "use EPSG:<code> or Wkt string", "EPSG:4326");
+  Optionpk<char> fs_opt("fs","fs","field separator.",' ');
   Optionpk<int> verbose_opt("v", "verbose", "verbose (0)", 0);
 
   version_opt.retrieveOption(argc,argv);
@@ -63,6 +64,7 @@ int main(int argc, char *argv[])
   ftype_opt.retrieveOption(argc,argv);
   itype_opt.retrieveOption(argc,argv);
   projection_opt.retrieveOption(argc,argv);
+  fs_opt.retrieveOption(argc,argv);
   verbose_opt.retrieveOption(argc,argv);
 
   if(version_opt[0]){
@@ -111,9 +113,9 @@ int main(int argc, char *argv[])
   imgWriter.open(output_opt[0]);
   try{
     if(polygon_opt[0])
-      imgWriter.ascii2shape(input_opt[0], "New Layer", fname_opt, ftype, colX_opt[0], colY_opt[0], theProjection, wkbPolygon);
+      imgWriter.ascii2ogr(input_opt[0], "New Layer", fname_opt, ftype, colX_opt[0], colY_opt[0], theProjection, wkbPolygon, fs_opt[0]);
     else
-      imgWriter.ascii2shape(input_opt[0], "New Layer", fname_opt, ftype, colX_opt[0], colY_opt[0], theProjection, wkbPoint);
+      imgWriter.ascii2ogr(input_opt[0], "New Layer", fname_opt, ftype, colX_opt[0], colY_opt[0], theProjection, wkbPoint, fs_opt[0]);
   }
   catch(string errorString){
     cout << errorString << endl;
diff --git a/src/apps/pkcreatect.cc b/src/apps/pkcreatect.cc
index ae9e59b..b911e30 100644
--- a/src/apps/pkcreatect.cc
+++ b/src/apps/pkcreatect.cc
@@ -48,8 +48,8 @@ int main(int argc,char **argv) {
   Optionpk<string>  output_opt("o", "output", "Output image file", "");
   Optionpk<string>  legend_opt("l", "legend", "Create legend as png file", "");
   Optionpk<short>  dim_opt("dim", "dim", "number of columns and rows in legend.", 100);
-  Optionpk<double>  min_opt("m", "min", "minimum value", 0);
-  Optionpk<double>  max_opt("M", "max", "maximum value", 100);
+  Optionpk<double>  min_opt("min", "min", "minimum value", 0);
+  Optionpk<double>  max_opt("max", "max", "maximum value", 100);
   Optionpk<bool>  grey_opt("g", "grey", "grey scale", false);
   Optionpk<string>  colorTable_opt("ct", "ct", "color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid)", "");
   Optionpk<string> oformat_opt("of", "oformat", "Output image format (see also gdal_translate). Empty string: inherit from input image", "GTiff");
diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc
index 7d6d344..98e06af 100644
--- a/src/apps/pkinfo.cc
+++ b/src/apps/pkinfo.cc
@@ -53,8 +53,8 @@ int main(int argc, char *argv[])
   Optionpk<bool>  dy_opt("dy", "dy", "get resolution in y (in m)", false);
   Optionpk<bool>  minmax_opt("mm", "minmax", "Show min and max value of the image ", false);
   Optionpk<bool>  stat_opt("stat", "stat", "Show statistics (min,max, mean and stdDev of the image ", false);
-  Optionpk<double>  min_opt("min", "min", "Set minimum for histogram)", 0);
-  Optionpk<double>  max_opt("max", "max", "Set maximum for histogram)", 0);
+  Optionpk<double>  min_opt("min", "min", "Set minimum for histogram)");
+  Optionpk<double>  max_opt("max", "max", "Set maximum for histogram)");
   Optionpk<bool>  relative_opt("rel", "rel", "Calculate relative histogram in percentage", false);
   Optionpk<bool>  projection_opt("p", "projection", "Show projection of the image ", false);
   Optionpk<bool>  geo_opt("geo", "geo", "get geotransform:  ", false);
@@ -273,12 +273,11 @@ int main(int argc, char *argv[])
     }
     if(hist_opt[0]){
       assert(band_opt[0]<imgReader.nrOfBand());
-      if(min_opt[0]==max_opt[0])
-        imgReader.getMinMax(minValue,maxValue,band_opt[0]);
-      else{
+      imgReader.getMinMax(minValue,maxValue,band_opt[0]);
+      if(min_opt.size())
         minValue=min_opt[0];
+      if(max_opt.size())
         maxValue=max_opt[0];
-      }
       int nbin=nbin_opt[0];
       if(nbin_opt[0]==0)
 	nbin=maxValue-minValue+1;
@@ -323,11 +322,11 @@ int main(int argc, char *argv[])
     }
     else{
       int minCol,minRow;
-      if(min_opt[0]){
+      if(min_opt.size()){
         assert(band_opt[0]<imgReader.nrOfBand());
         std::cout << "--min " << imgReader.getMin(minCol, minRow,band_opt[0]);
       }
-      if(max_opt[0]){
+      if(max_opt.size()){
         assert(band_opt[0]<imgReader.nrOfBand());
         assert(band_opt[0]<imgReader.nrOfBand());
         std::cout << "--max " << imgReader.getMax(minCol, minRow,band_opt[0]);
diff --git a/src/apps/pklas2img.cc b/src/apps/pklas2img.cc
index 30395e3..fe26312 100644
--- a/src/apps/pklas2img.cc
+++ b/src/apps/pklas2img.cc
@@ -51,9 +51,9 @@ int main(int argc,char **argv) {
   Optionpk<short> maxIter_opt("\0", "maxIter", "Maximum number of iterations in post filter (default is 100)", 100.0);
   Optionpk<short> nbin_opt("nb", "nbin", "Number of percentile bins for calculating profile (=number of output bands) (default is 10)", 10.0);
   Optionpk<unsigned short> returns_opt("r", "returns", "number(s) of returns to include (use -r -1 for last return only). Default is 0 (include all returns)", 0);
-  Optionpk<string> composite_opt("c", "composite", "composite for multiple points in cell (min, max, median, mean, sum, first, last, profile). Default is last (overwrite cells with latest point", "last");
+  Optionpk<string> composite_opt("c", "composite", "composite for multiple points in cell (min, max, median, mean, sum, first, last, profile, number (point density)). Default is last (overwrite cells with latest point", "last");
   Optionpk<string> filter_opt("fir", "filter", "filter las points (single,multiple,all). Default is all", "all");
-  Optionpk<string> postFilter_opt("pf", "pfilter", "filter las points (etew_min,promorph (progressive morphological filter),bunting (adapted promorph),open,close,none) . Default is none", "none");
+  Optionpk<string> postFilter_opt("pf", "pfilter", "post processing filter (etew_min,promorph (progressive morphological filter),bunting (adapted promorph),open,close,none) . Default is none", "none");
   Optionpk<short> dimx_opt("\0", "dimX", "Dimension X of postFilter (default is 3)", 3);
   Optionpk<short> dimy_opt("\0", "dimY", "Dimension Y of postFilter (default is 3)", 3);
   Optionpk<string> output_opt("o", "output", "Output image file", "");
@@ -65,8 +65,8 @@ int main(int argc,char **argv) {
   Optionpk<string> otype_opt("ot", "otype", "Data type for output image ({Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}). Empty string: inherit type from input image", "Byte");
   Optionpk<string> oformat_opt("of", "oformat", "Output image format (see also gdal_translate). Empty string: inherit from input image", "GTiff");
   Optionpk<string> option_opt("co", "co", "options: NAME=VALUE [-co COMPRESS=LZW] [-co INTERLEAVE=BAND]", "INTERLEAVE=BAND");
-  Optionpk<double> dx_opt("dx", "dx", "Output resolution in x (in meter) (default is 0.0: keep original resolution)", 0.0);
-  Optionpk<double> dy_opt("dy", "dy", "Output resolution in y (in meter) (default is 0.0: keep original resolution)", 0.0);
+  Optionpk<double> dx_opt("dx", "dx", "Output resolution in x (in meter)", 1.0);
+  Optionpk<double> dy_opt("dy", "dy", "Output resolution in y (in meter)", 1.0);
   Optionpk<string> colorTable_opt("ct", "ct", "color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid)", "");
   Optionpk<short> verbose_opt("v", "verbose", "verbose (default is 0)", 0);
 
@@ -128,6 +128,7 @@ int main(int argc,char **argv) {
   double progress=0;
 
   Vector2d<vector<float> > inputData;//row,col,point
+
    
   ImgReaderGdal maskReader;
   ImgWriterGdal outputWriter;
@@ -235,6 +236,12 @@ int main(int argc,char **argv) {
 
   inputData.clear();
   inputData.resize(nrow,ncol);
+  Vector2d<float> outputData(nrow,ncol);
+  for(int irow=0;irow<nrow;++irow)
+    for(int icol=0;icol<ncol;++icol)
+      outputData[irow][icol]=0;
+
+
   std::cout << "Reading " << input_opt.size() << " las files" << std::endl;
   pfnProgress(progress,pszMessage,pProgressArg);
   for(int iinput=0;iinput<input_opt.size();++iinput){
@@ -296,7 +303,9 @@ int main(int argc,char **argv) {
       assert(irow<nrow);
       assert(icol>=0);
       assert(icol<ncol);
-      if(attribute_opt[0]=="z")
+      if(composite_opt[0]=="number")
+        outputData[irow][icol]+=1;
+      else if(attribute_opt[0]=="z")
         inputData[irow][icol].push_back(thePoint.GetZ());
       else if(attribute_opt[0]=="intensity")
         inputData[irow][icol].push_back(thePoint.GetIntensity());
@@ -321,14 +330,15 @@ int main(int argc,char **argv) {
   progress=0;
   pfnProgress(progress,pszMessage,pProgressArg);
   Histogram hist;
-  //fill in inputData in outputData
-  Vector2d<float> outputData(nrow,ncol);
+  //fill inputData in outputData
   if(composite_opt[0]=="profile"){
     assert(postFilter_opt[0]=="none");
     // for(int iband=0;iband<nband;++iband)
       // outputProfile[iband].resize(nrow,ncol);
   }
   for(int irow=0;irow<nrow;++irow){
+    if(composite_opt[0]=="number")
+      continue;//outputData already set
     Vector2d<float> outputProfile(nband,ncol);
     for(int icol=0;icol<ncol;++icol){
       std::vector<float> profile;
@@ -383,7 +393,7 @@ int main(int argc,char **argv) {
         // assert(outputProfile[iband].size()==outputWriter.nrOfRow());
         assert(outputProfile[iband].size()==outputWriter.nrOfCol());
         try{
-          outputWriter.writeData(outputProfile[iband],theType,irow,iband);
+          outputWriter.writeData(outputProfile[iband],GDT_Float32,irow,iband);
         }
         catch(std::string errorString){
           cout << errorString << endl;
@@ -505,7 +515,7 @@ int main(int argc,char **argv) {
       try{
         assert(outputData.size()==outputWriter.nrOfRow());
         assert(outputData[0].size()==outputWriter.nrOfCol());
-        outputWriter.writeData(outputData[irow],theType,irow,0);
+        outputWriter.writeData(outputData[irow],GDT_Float32,irow,0);
       }
       catch(std::string errorString){
         cout << errorString << endl;
diff --git a/src/apps/pksensormodel.cc b/src/apps/pksensormodel.cc
index 54194ca..d7a44d3 100644
--- a/src/apps/pksensormodel.cc
+++ b/src/apps/pksensormodel.cc
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
   Optionpk<double> x_opt("x","x","gcp x coordinate)");
   Optionpk<double> y_opt("y","y","gcp y coordinate)");
   Optionpk<double> z_opt("z","z","gcp z coordinate in m)");
-  Optionpk<double> errorZ_opt("ez","ez","offset (error) in z coordinate of the GCP",0);
+  Optionpk<double> errorZ_opt("ez","ez","offset (error) in z coordinate of the GCP");
   Optionpk<int> col_opt("c","col","column of the pixel on CCD");
   Optionpk<int> row_opt("r","row","row of the pixel on CCD");
   Optionpk<double> roll_opt("roll","roll","platform attitude roll");
@@ -489,17 +489,19 @@ int main(int argc, char *argv[])
     assert(col_opt.size()>ipoint);
     theDataModel.pushRow(row_opt[ipoint]);
     theDataModel.pushCol(col_opt[ipoint]);
-    if(x_opt.size()>ipoint){
-      assert(y_opt.size()>ipoint);
-      assert(z_opt.size()>ipoint);
+    if(z_opt.size()>ipoint){
+      // assert(x_opt.size()>ipoint);
+      // assert(y_opt.size()>ipoint);
       gsl::vector thePosGCP(3);
-      if(gcprad_opt[0]){
-        thePosGCP[0]=theModel.rad2deg(x_opt[ipoint]);
-        thePosGCP[1]=theModel.rad2deg(y_opt[ipoint]);
-      }
-      else{
-        thePosGCP[0]=x_opt[ipoint];
-        thePosGCP[1]=y_opt[ipoint];
+      if(x_opt.size()>ipoint&&y_opt.size()>ipoint){
+        if(gcprad_opt[0]){
+          thePosGCP[0]=theModel.rad2deg(x_opt[ipoint]);
+          thePosGCP[1]=theModel.rad2deg(y_opt[ipoint]);
+        }
+        else{
+          thePosGCP[0]=x_opt[ipoint];
+          thePosGCP[1]=y_opt[ipoint];
+        }
       }
       thePosGCP[2]=z_opt[ipoint];
       if(s_srs_opt[0]!=4326)
@@ -538,6 +540,7 @@ int main(int argc, char *argv[])
   }
 
   //todo: remove GCP points with error above threshold
+  unsigned int nremoved=0;
   if(threshold_opt[0]>0){
     for(int ipoint=0;ipoint<vID.size();++ipoint){
       if(verbose_opt[0]>1)
@@ -551,6 +554,7 @@ int main(int argc, char *argv[])
       if(e>=theDataModel.getThreshold()){
         vID.erase(vID.begin()+ipoint);
         theDataModel.erase(ipoint);
+        ++nremoved;
       }
     }
     if(!theDataModel.getSize())
@@ -628,11 +632,11 @@ int main(int argc, char *argv[])
 
     gsl::vector pos_calc;
     gsl::vector pos_gcp;
-    if(theDataModel.getSize())
+    if(x_opt.size())
       pos_gcp=theDataModel.getPosGCP(ipoint);
     else
       pos_gcp=theDataModel.getPos(ipoint);
-    if(errorZ_opt[0]!=0)
+    if(errorZ_opt.size())
       pos_calc=theDataModel.getModel().getPos(pos_platform,att_platform,theDataModel.getRow(ipoint),theDataModel.getCol(ipoint),theDataModel.getHeight(ipoint)+errorZ_opt[0]);
     else
       pos_calc=theDataModel.getPos(ipoint);
@@ -652,16 +656,22 @@ int main(int argc, char *argv[])
     if(output_opt.size()){
       outputStream << setprecision(12) << vID[ipoint] << " " << theDataModel.getRow(ipoint) << " " << theDataModel.getCol(ipoint) << " " << pos_calc[0] << " " << pos_calc[1] << " " << pos_calc[2] << " " << gcpss.str();
       if(getzenith_opt[0])
-        outputStream << " " << theDataModel.getModel().getZenith(att_platform);
+        outputStream << " " << theDataModel.getModel().getZenith(att_platform,theDataModel.getRow(ipoint),theDataModel.getCol(ipoint));
       outputStream << std::endl;
     }
     else{
       std::cout << setprecision(12) << vID[ipoint] << " " << theDataModel.getRow(ipoint) << " " << theDataModel.getCol(ipoint) << " " << pos_calc[0] << " " << pos_calc[1] << " " << pos_calc[2] << " " << gcpss.str();
       if(getzenith_opt[0])
-        std::cout << " " << theDataModel.getModel().getZenith(att_platform);
+        std::cout << " " << theDataModel.getModel().getZenith(att_platform,theDataModel.getRow(ipoint),theDataModel.getCol(ipoint));
       std::cout << std::endl;
     }
   }
+  if(verbose_opt[0]){
+    if(output_opt.size())
+      outputStream << "Number of GCP above threshold removed: " << nremoved << std::endl;
+    else
+      std::cout << "Number of GCP above threshold removed: " << nremoved << std::endl;
+  }
   if(mean_opt[0]){
     double theMean=0;
     double theVar=0;
diff --git a/src/imageclasses/ImgWriterOgr.cc b/src/imageclasses/ImgWriterOgr.cc
index 0ed887d..86193fc 100644
--- a/src/imageclasses/ImgWriterOgr.cc
+++ b/src/imageclasses/ImgWriterOgr.cc
@@ -394,7 +394,7 @@ int ImgWriterOgr::getFeatureCount() const
   return(getLayer()->GetFeatureCount());
 }
 
-int ImgWriterOgr::ascii2shape(const string& filename, const string &layername, const vector<string>& fieldName, const vector<OGRFieldType>& fieldType, short colX, short colY, const string& theProjection, const OGRwkbGeometryType& eGType)
+int ImgWriterOgr::ascii2ogr(const string& filename, const string &layername, const vector<string>& fieldName, const vector<OGRFieldType>& fieldType, short colX, short colY, const string& theProjection, const OGRwkbGeometryType& eGType, const char fs)
 {
   char     **papszOptions=NULL;
   createLayer(layername, theProjection, eGType, papszOptions);
@@ -416,66 +416,135 @@ int ImgWriterOgr::ascii2shape(const string& filename, const string &layername, c
   OGRFeature *polyFeature;
   if(eGType!=wkbPoint)
     polyFeature=createFeature();
-  while(getline(fpoints,line)){
-    OGRFeature *pointFeature;
-    if(eGType==wkbPoint)
-      pointFeature=createFeature();
-    OGRPoint thePoint;
-    bool skip=false;
-    istringstream ist(line);
-    string value;
-    int colId=0;
-    int fieldId=0;
-    while(ist >> value){
-      if(colId==colX)
-	thePoint.setX(atof(value.c_str()));
-      else if(colId==colY)
-	thePoint.setY(atof(value.c_str()));
+
+
+  if(fs>' '&&fs<='~'){//field separator is a regular character (minimum ASCII code is space, maximum ASCII code is tilde)
+    string csvRecord;
+    while(getline(fpoints,csvRecord)){//read a line
+      OGRFeature *pointFeature;
+      if(eGType==wkbPoint)
+        pointFeature=createFeature();
+      OGRPoint thePoint;
+      bool skip=false;
+      istringstream csvstream(csvRecord);
+      string value;
+      int colId=0;
+      int fieldId=0;
+      while(getline(csvstream,value,fs)){//read a column
+        if(colId==colX)
+          thePoint.setX(atof(value.c_str()));
+        else if(colId==colY)
+          thePoint.setY(atof(value.c_str()));
+        else{
+          switch(fieldType[fieldId]){
+          case(OFTReal):
+            if(eGType==wkbPoint)
+              pointFeature->SetField(fieldId,atof(value.c_str()));
+            else if(firstPoint.IsEmpty())
+              polyFeature->SetField(fieldId,atof(value.c_str()));
+            break;
+          case(OFTInteger):
+            if(eGType==wkbPoint)
+              pointFeature->SetField(fieldId,atoi(value.c_str()));
+            else if(firstPoint.IsEmpty())
+              polyFeature->SetField(fieldId,atof(value.c_str()));
+            break;
+          case(OFTString):
+            if(eGType==wkbPoint)
+              pointFeature->SetField(fieldId,value.c_str());
+            else if(firstPoint.IsEmpty())
+              polyFeature->SetField(fieldId,atof(value.c_str()));
+            break;
+          default:
+            break;
+          }
+          ++fieldId;
+        }
+        ++colId;
+      }
+      if(colId!=fieldId+2){
+        ostringstream ess;
+        ess << "Error: colId = " << colId << " is different from fieldId+2 = " << fieldId;
+        throw(ess.str());
+      }
+      if(eGType==wkbPoint){
+        pointFeature->SetGeometry( &thePoint );
+        if(createFeature(pointFeature)!=OGRERR_NONE){
+          string errorString="Failed to create feature in shapefile";
+          throw(errorString);
+          OGRFeature::DestroyFeature( pointFeature );
+        }
+      }
       else{
-        switch(fieldType[fieldId]){
-        case(OFTReal):
-	  if(eGType==wkbPoint)
-	    pointFeature->SetField(fieldId,atof(value.c_str()));
-	  else if(firstPoint.IsEmpty())
-	    polyFeature->SetField(fieldId,atof(value.c_str()));
-          break;
-        case(OFTInteger):
-	  if(eGType==wkbPoint)
-	    pointFeature->SetField(fieldId,atoi(value.c_str()));
-	  else if(firstPoint.IsEmpty())
-	    polyFeature->SetField(fieldId,atof(value.c_str()));
-          break;
-        case(OFTString):
-	  if(eGType==wkbPoint)
-	    pointFeature->SetField(fieldId,value.c_str());
-	  else if(firstPoint.IsEmpty())
-	    polyFeature->SetField(fieldId,atof(value.c_str()));
-          break;
-        default:
-          break;
+        if(firstPoint.IsEmpty()){
+          firstPoint=thePoint;
         }
-        ++fieldId;
+        theRing.addPoint(&thePoint);
       }
-      ++colId;
     }
-    if(colId!=fieldId+2){
-      ostringstream ess;
-      ess << "Error: colId = " << colId << " is different from fieldId+2 = " << fieldId;
-      throw(ess.str());
-    }
-    if(eGType==wkbPoint){
-      pointFeature->SetGeometry( &thePoint );
-      if(createFeature(pointFeature)!=OGRERR_NONE){
-	string errorString="Failed to create feature in shapefile";
-	throw(errorString);
-	OGRFeature::DestroyFeature( pointFeature );
+  }
+  else{//space or tab delimited fields
+    while(getline(fpoints,line)){
+      OGRFeature *pointFeature;
+      if(eGType==wkbPoint)
+        pointFeature=createFeature();
+      OGRPoint thePoint;
+      bool skip=false;
+      istringstream ist(line);
+      string value;
+      int colId=0;
+      int fieldId=0;
+      while(ist >> value){
+        if(colId==colX)
+          thePoint.setX(atof(value.c_str()));
+        else if(colId==colY)
+          thePoint.setY(atof(value.c_str()));
+        else{
+          switch(fieldType[fieldId]){
+          case(OFTReal):
+            if(eGType==wkbPoint)
+              pointFeature->SetField(fieldId,atof(value.c_str()));
+            else if(firstPoint.IsEmpty())
+              polyFeature->SetField(fieldId,atof(value.c_str()));
+            break;
+          case(OFTInteger):
+            if(eGType==wkbPoint)
+              pointFeature->SetField(fieldId,atoi(value.c_str()));
+            else if(firstPoint.IsEmpty())
+              polyFeature->SetField(fieldId,atof(value.c_str()));
+            break;
+          case(OFTString):
+            if(eGType==wkbPoint)
+              pointFeature->SetField(fieldId,value.c_str());
+            else if(firstPoint.IsEmpty())
+              polyFeature->SetField(fieldId,atof(value.c_str()));
+            break;
+          default:
+            break;
+          }
+          ++fieldId;
+        }
+        ++colId;
       }
-    }
-    else{
-      if(firstPoint.IsEmpty()){
-	firstPoint=thePoint;
+      if(colId!=fieldId+2){
+        ostringstream ess;
+        ess << "Error: colId = " << colId << " is different from fieldId+2 = " << fieldId;
+        throw(ess.str());
+      }
+      if(eGType==wkbPoint){
+        pointFeature->SetGeometry( &thePoint );
+        if(createFeature(pointFeature)!=OGRERR_NONE){
+          string errorString="Failed to create feature in shapefile";
+          throw(errorString);
+          OGRFeature::DestroyFeature( pointFeature );
+        }
+      }
+      else{
+        if(firstPoint.IsEmpty()){
+          firstPoint=thePoint;
+        }
+        theRing.addPoint(&thePoint);
       }
-      theRing.addPoint(&thePoint);
     }
   }
   if(eGType!=wkbPoint){
diff --git a/src/imageclasses/ImgWriterOgr.h b/src/imageclasses/ImgWriterOgr.h
index 5005111..c512945 100644
--- a/src/imageclasses/ImgWriterOgr.h
+++ b/src/imageclasses/ImgWriterOgr.h
@@ -44,7 +44,7 @@ public:
   ~ImgWriterOgr(void);
   void open(const string& filename, const string& imageType="ESRI Shapefile");
   void close(void);
-  int ascii2shape(const string& filename, const string &layername, const vector<string>& fieldName, const vector<OGRFieldType>& fieldType, short colX=1, short colY=2, const string& theProjection="", const OGRwkbGeometryType& eGType=wkbPoint);
+  int ascii2ogr(const string& filename, const string &layername, const vector<string>& fieldName, const vector<OGRFieldType>& fieldType, short colX=1, short colY=2, const string& theProjection="", const OGRwkbGeometryType& eGType=wkbPoint, const char fs=' ');
   OGRLayer* createLayer(const string& layername="New layer", const string& theProjection="", const OGRwkbGeometryType& eGType=wkbUnknown, char** papszOptions=NULL);
   OGRLayer* copyLayer(OGRLayer* poSrcLayer, const string& layername, char** papszOptions=NULL);
   void createField(const string& fieldname, const OGRFieldType& fieldType, int theLayer=-1);//default: get back layer

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git



More information about the Pkg-grass-devel mailing list