[Git][debian-gis-team/pktools][master] 6 commits: New upstream version 2.6.7.4+ds
Bas Couwenberg
gitlab at salsa.debian.org
Sun Aug 19 15:12:01 BST 2018
Bas Couwenberg pushed to branch master at Debian GIS Project / pktools
Commits:
93a15c23 by Bas Couwenberg at 2018-08-19T12:26:09Z
New upstream version 2.6.7.4+ds
- - - - -
1507a9a2 by Bas Couwenberg at 2018-08-19T12:26:20Z
Merge tag 'upstream/2.6.7.4+ds'
Upstream version 2.6.7.4+ds
- - - - -
9dc5e129 by Bas Couwenberg at 2018-08-19T12:26:34Z
New upstream release.
- - - - -
9acb8744 by Bas Couwenberg at 2018-08-19T12:28:21Z
Drop gdal-c++11.patch, applied upstream.
- - - - -
ea246eaa by Bas Couwenberg at 2018-08-19T13:54:06Z
Update symbols for amd64.
- - - - -
6730a90c by Bas Couwenberg at 2018-08-19T13:54:06Z
Set distribution to unstable.
- - - - -
8 changed files:
- CMakeLists.txt
- debian/changelog
- debian/libalgorithms1.symbols
- debian/libimageclasses1.symbols
- debian/liblasclasses1.symbols
- − debian/patches/gdal-c++11.patch
- debian/patches/series
- src/apps/pkdiff.cc
Changes:
=====================================
CMakeLists.txt
=====================================
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,7 +35,7 @@ set (PROJECT_SOURCE_DIR src)
# The version number.
set (PKTOOLS_VERSION_MAJOR 2)
set (PKTOOLS_VERSION_MINOR 6)
-set (PKTOOLS_VERSION_PATCH 7.3)
+set (PKTOOLS_VERSION_PATCH 7.4)
set (PKTOOLS_VERSION "${PKTOOLS_VERSION_MAJOR}.${PKTOOLS_VERSION_MINOR}.${PKTOOLS_VERSION_PATCH}")
set (PKTOOLS_PACKAGE_VERSION "${PKTOOLS_VERSION_MAJOR}.${PKTOOLS_VERSION_MINOR}.${PKTOOLS_VERSION_PATCH}")
set (PKTOOLS_PACKAGE_STRING "PKTOOLS ${PKTOOLS_VERSION_MAJOR}.${PKTOOLS_VERSION_MINOR}.${PKTOOLS_VERSION_PATCH}")
@@ -164,7 +164,7 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${PKTOOLS_COMMON_CXX_FLAGS}")
if (CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER}" MATCHES "clang")
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,11 @@
-pktools (2.6.7.3+ds-4) UNRELEASED; urgency=medium
+pktools (2.6.7.4+ds-1) unstable; urgency=medium
+ * New upstream release.
* Bump Standards-Version to 4.2.0, no changes.
+ * Drop gdal-c++11.patch, applied upstream.
+ * Update symbols for amd64.
- -- Bas Couwenberg <sebastic at debian.org> Sun, 05 Aug 2018 20:43:19 +0200
+ -- Bas Couwenberg <sebastic at debian.org> Sun, 19 Aug 2018 14:27:45 +0200
pktools (2.6.7.3+ds-3) unstable; urgency=medium
=====================================
debian/libalgorithms1.symbols
=====================================
--- a/debian/libalgorithms1.symbols
+++ b/debian/libalgorithms1.symbols
@@ -1,4 +1,4 @@
-# SymbolsHelper-Confirmed: 2.6.7.3 amd64
+# SymbolsHelper-Confirmed: 2.6.7.4 amd64
libalgorithms.so.1 libalgorithms1 #MINVER#
(optional=templinst|arch=alpha amd64 arm64 kfreebsd-amd64 mips64el ppc64 ppc64el s390x sparc64)_Z11string2typeIiET_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE at Base 2.6.4
_Z12compareClassRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_ at Base 2.6.4
@@ -239,21 +239,18 @@ libalgorithms.so.1 libalgorithms1 #MINVER#
(optional=templinst)_ZNK8Vector2dIdE3sumEv at Base 2.5.2
(optional=templinst)_ZNKSt5ctypeIcE8do_widenEc at Base 2.5.2
(optional=templinst|arch=hppa x32)_ZNKSt6vectorI8Vector2dIfESaIS1_EE12_M_check_lenEjPKc at Base 2.6.7
- (optional=templinst)_ZNSt22__uninitialized_fill_nILb0EE15__uninit_fill_nIPSt6vectorIdSaIdEEmS4_EET_S6_T0_RKT1_ at Base 2.6.7.3
(optional=templinst)_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN11statfactory11StatFactory18INTERPOLATION_TYPEESt4lessIS5_ESaISt4pairIKS5_S8_EEEixEOS5_ at Base 2.6.7.3
(optional=templinst)_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN6filter11FILTER_TYPEESt4lessIS5_ESaISt4pairIKS5_S7_EEEixEOS5_ at Base 2.6.7.3
(optional=templinst)_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN8filter2d11FILTER_TYPEESt4lessIS5_ESaISt4pairIKS5_S7_EEEixEOS5_ at Base 2.6.7.3
(optional=templinst)_ZNSt3mapIliSt4lessIlESaISt4pairIKliEEEixEOl at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorI8Vector2dIfESaIS1_EE17_M_default_appendEm at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS5_S7_EERKS5_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED1Ev at Base 2.6.4
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev at Base 2.6.4
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEaSERKS7_ at Base 2.6.4
(optional=templinst|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64el !ppc64 !ppc64el !s390x !sparc64)_ZNSt6vectorIS_IdSaIdEESaIS1_EE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EEjRKS1_ at Base 2.6.4
(optional=templinst)_ZNSt6vectorIS_IdSaIdEESaIS1_EE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIS_IdSaIdEESaIS1_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EERKS1_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IdSaIdEESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IdSaIdEESaIS1_EE8_M_eraseEN9__gnu_cxx17__normal_iteratorIPS1_S3_EE at Base 2.5.2
(optional=templinst)_ZNSt6vectorIS_IdSaIdEESaIS1_EE9push_backERKS1_ at Base 2.6.7.3
@@ -261,13 +258,11 @@ libalgorithms.so.1 libalgorithms1 #MINVER#
(optional=templinst)_ZNSt6vectorIS_IdSaIdEESaIS1_EED2Ev at Base 2.5.2
(optional=templinst|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64el !ppc64 !ppc64el !s390x !sparc64)_ZNSt6vectorIS_IfSaIfEESaIS1_EE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EEjRKS1_ at Base 2.6.4
(optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EERKS1_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EE8_M_eraseEN9__gnu_cxx17__normal_iteratorIPS1_S3_EES7_ at Base 2.5.2
(optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EED1Ev at Base 2.5.2
(optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EED2Ev at Base 2.5.2
(optional=templinst)_ZNSt6vectorIS_IsSaIsEESaIS1_EE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIS_IsSaIsEESaIS1_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EERKS1_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IsSaIsEESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IsSaIsEESaIS1_EED1Ev at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IsSaIsEESaIS1_EED2Ev at Base 2.6.7.3
@@ -276,10 +271,7 @@ libalgorithms.so.1 libalgorithms1 #MINVER#
(optional=templinst|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64el !ppc64 !ppc64el !s390x !sparc64)_ZNSt6vectorIdSaIdEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPdS1_EEjRKd at Base 2.6.4
(optional=templinst)_ZNSt6vectorIdSaIdEE15_M_range_insertIN9__gnu_cxx17__normal_iteratorIPdS1_EEEEvS6_T_S7_St20forward_iterator_tag at Base 2.6.7
(optional=templinst)_ZNSt6vectorIdSaIdEE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIdSaIdEE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPdS1_EERKd at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_ at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIdSaIdEE6resizeEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIdSaIdEE6resizeEmd at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIdSaIdEE8_M_eraseEN9__gnu_cxx17__normal_iteratorIPdS1_EE at Base 2.6.2
(optional=templinst)_ZNSt6vectorIdSaIdEE8_M_eraseEN9__gnu_cxx17__normal_iteratorIPdS1_EES5_ at Base 2.5.2
(optional=templinst)_ZNSt6vectorIdSaIdEEC1ERKS1_ at Base 2.6.4
@@ -292,7 +284,6 @@ libalgorithms.so.1 libalgorithms1 #MINVER#
(optional=templinst|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64el !ppc64 !ppc64el !s390x !sparc64)_ZNSt6vectorIfSaIfEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPfS1_EEjRKf at Base 2.6.4
(optional=templinst)_ZNSt6vectorIfSaIfEE15_M_range_insertIN9__gnu_cxx17__normal_iteratorIPfS1_EEEEvS6_T_S7_St20forward_iterator_tag at Base 2.6.7
(optional=templinst)_ZNSt6vectorIfSaIfEE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIfSaIfEE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPfS1_EERKf at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIfSaIfEE8_M_eraseEN9__gnu_cxx17__normal_iteratorIPfS1_EES5_ at Base 2.5.2
(optional=templinst)_ZNSt6vectorIfSaIfEEaSERKS1_ at Base 2.6.7.3
=====================================
debian/libimageclasses1.symbols
=====================================
--- a/debian/libimageclasses1.symbols
+++ b/debian/libimageclasses1.symbols
@@ -1,4 +1,4 @@
-# SymbolsHelper-Confirmed: 2.6.7.3 amd64
+# SymbolsHelper-Confirmed: 2.6.7.4 amd64
libimageClasses.so.1 libimageclasses1 #MINVER#
(optional=templinst)_Z15getGDALDataTypeIdE12GDALDataTypev at Base 2.6.7
(optional=templinst)_Z15getGDALDataTypeIsE12GDALDataTypev at Base 2.6.7
@@ -134,19 +134,14 @@ libimageClasses.so.1 libimageclasses1 #MINVER#
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE8_M_eraseEN9__gnu_cxx17__normal_iteratorIPS5_S7_EE at Base 2.6.4
(optional=templinst)_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEaSERKS7_ at Base 2.6.4
(optional=templinst)_ZNSt6vectorIP12OGRFieldDefnSaIS1_EE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIPvSaIS0_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIPvSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_ at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EERKS1_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIS_IfSaIfEESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIdSaIdEE15_M_range_insertIN9__gnu_cxx17__normal_iteratorIPdS1_EEEEvS6_T_S7_St20forward_iterator_tag at Base 2.6.4
(optional=templinst)_ZNSt6vectorIdSaIdEE17_M_default_appendEm at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIdSaIdEE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPdS1_EERKd at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIdSaIdEEaSERKS1_ at Base 2.5.2
(optional=templinst)_ZNSt6vectorIfSaIfEE12emplace_backIJfEEEvDpOT_ at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIfSaIfEE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPfS1_EERKf at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_ at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorIiSaIiEE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPiS1_EERKi at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIsSaIsEE17_M_default_appendEm at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIsSaIsEE17_M_realloc_insertIJRKsEEEvN9__gnu_cxx17__normal_iteratorIPsS1_EEDpOT_ at Base 2.6.7.3
=====================================
debian/liblasclasses1.symbols
=====================================
--- a/debian/liblasclasses1.symbols
+++ b/debian/liblasclasses1.symbols
@@ -1,4 +1,4 @@
-# SymbolsHelper-Confirmed: 2.6.7.3 amd64
+# SymbolsHelper-Confirmed: 2.6.7.4 amd64
liblasClasses.so.1 liblasclasses1 #MINVER#
_ZN13FileReaderLas13readNextPointERN6liblas5PointE at Base 2.6.7
_ZN13FileReaderLas14addClassFilterERKSt6vectorItSaItEE at Base 2.5.2
@@ -50,14 +50,11 @@ liblasClasses.so.1 liblasclasses1 #MINVER#
_ZNK13FileReaderLas9getHeaderEv at Base 2.5.2
_ZNK13FileReaderLas9las2asciiERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb at Base 2.6.4
(optional=templinst)_ZNKSt5ctypeIcE8do_widenEc at Base 2.5.2
- (optional=templinst)_ZNSt6vectorIN5boost10shared_ptrIN6liblas7FilterIEEESaIS4_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS4_S6_EERKS4_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIN5boost10shared_ptrIN6liblas7FilterIEEESaIS4_EE17_M_realloc_insertIJRKS4_EEEvN9__gnu_cxx17__normal_iteratorIPS4_S6_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIN5boost10shared_ptrIN6liblas7FilterIEEESaIS4_EE17_M_realloc_insertIJS4_EEEvN9__gnu_cxx17__normal_iteratorIPS4_S6_EEDpOT_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIN5boost10shared_ptrIN6liblas7FilterIEEESaIS4_EED1Ev at Base 2.5.2
(optional=templinst)_ZNSt6vectorIN5boost10shared_ptrIN6liblas7FilterIEEESaIS4_EED2Ev at Base 2.5.2
- (optional=templinst)_ZNSt6vectorIN6liblas14ClassificationESaIS1_EE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPS1_S3_EERKS1_ at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorIN6liblas14ClassificationESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_ at Base 2.6.7.3
- (optional=templinst)_ZNSt6vectorItSaItEE17_M_realloc_insertEN9__gnu_cxx17__normal_iteratorIPtS1_EERKt at Base 2.6.7.3
(optional=templinst)_ZNSt6vectorItSaItEE17_M_realloc_insertIJRKtEEEvN9__gnu_cxx17__normal_iteratorIPtS1_EEDpOT_ at Base 2.6.7.3
_ZTI16LastReturnFilter at Base 2.5.2
_ZTIN5boost6detail15sp_counted_baseE at Base 2.5.2
=====================================
debian/patches/gdal-c++11.patch deleted
=====================================
--- a/debian/patches/gdal-c++11.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Description: Use C++11 for compatibility with GDAL 2.3.0.
-Author: Bas Couwenberg <sebastic at debian.org>
-Forwarded: https://savannah.nongnu.org/bugs/index.php?53725
-
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -166,7 +166,7 @@ else()
-
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${PKTOOLS_COMMON_CXX_FLAGS}")
- if (CMAKE_COMPILER_IS_GNUCXX)
-- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
-+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
- endif()
-
- elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER}" MATCHES "clang")
=====================================
debian/patches/series
=====================================
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,2 @@
spelling-errors2.patch
multiarch.patch
-gdal-c++11.patch
=====================================
src/apps/pkdiff.cc
=====================================
--- a/src/apps/pkdiff.cc
+++ b/src/apps/pkdiff.cc
@@ -39,15 +39,15 @@ along with pktools. If not, see <http://www.gnu.org/licenses/>.
Options: [-ln layer] [-b band] [-cm] [-lr attribute] [-c name -r value]* [-nodata value]* [-m mask] [-msknodata value]*
Advanced options:
- [-o output] [-f OGR format] [-lc attribute] [-bnd value [-hom] [-circ]] [-ct colortable] [-co NAME=VALUE]*
+ [-o output] [-f OGR format] [-lc attribute] [-bnd value [-hom] [-circ]] [-ct colortable] [-co NAME=VALUE]*
</code>
\section pkdiff_description Description
-The utility pkdiff compares two datasets. The reference can either be a raster or a vector, but the input must be a raster dataset.
-In case the reference is a raster dataset, a pixel by pixel comparison is performed. With no further options, the utility reports if the rasters are identical or different. If required, an output raster dataset can be written with a qualitative information per pixel: 0 (input=reference), 1 (input>reference) or 2 (input<reference).
-If, however, the reference is a vector dataset, it must consist of point features. Polygon features are automatically converted to the centroid points before analyzing.
+The utility pkdiff compares two datasets. The reference can either be a raster or a vector, but the input must be a raster dataset.
+In case the reference is a raster dataset, a pixel by pixel comparison is performed. With no further options, the utility reports if the rasters are identical or different. If required, an output raster dataset can be written with a qualitative information per pixel: 0 (input=reference), 1 (input>reference) or 2 (input<reference).
+If, however, the reference is a vector dataset, it must consist of point features. Polygon features are automatically converted to the centroid points before analyzing.
A typical use of the utility is to assess the accuracy of an input raster land cover map, based on a reference vector dataset. The reference dataset must contain an attribute (label) for each class. A confusion matrix is produced if the option -cm|--confusion is set. Here too, an output dataset can be written, which will be a vector dataset in this case. It contains the reference feature points with the extracted data value of the raster input dataset as a new attribute.
\section pkdiff_options Options
@@ -55,32 +55,32 @@ A typical use of the utility is to assess the accuracy of an input raster land c
- short option `-h` shows basic options only, long option `--help` shows all options
|short|long|type|default|description|
|-----|----|----|-------|-----------|
- | i | input | std::string | |Input raster dataset. |
- | ref | reference | std::string | |Reference (raster or vector) dataset |
- | ln | ln | std::string | |Layer name(s) in sample. Leave empty to select all (for vector reference datasets only) |
- | b | band | short | 0 |Input (reference) raster band. Optionally, you can define different bands for input and reference bands respectively: -b 1 -b 0. |
- | rmse | rmse | bool | false |Report root mean squared error |
- | reg | reg | bool | false |Report linear regression (Input = c0+c1*Reference) |
- | cm | confusion | bool | false |Create confusion matrix (to std out) |
- | lr | lref | std::string | label |Attribute name of the reference label (for vector reference datasets only) |
- | c | class | std::string | |List of class names. |
- | r | reclass | short | |List of class values (use same order as in classname option). |
- | nodata | nodata | double | |No data value(s) in input or reference dataset are ignored |
- | m | mask | std::string | |Use the first band of the specified file as a validity mask. Nodata values can be set with the option msknodata. |
- | msknodata | msknodata | double | 0 |Mask value(s) where image is invalid. Use negative value for valid data (example: use -t -1: if only -1 is valid value) |
- | o | output | std::string | |Output dataset (optional) |
- | f | f | std::string | SQLite |OGR format for output vector (for vector reference datasets only) |
- | of | oformat | std::string | GTiff |Output image format (see also gdal_translate).|
- | lc | lclass | std::string | class |Attribute name of the classified label (for vector reference datasets only) |
- | cmf | cmf | std::string | ascii |Format for confusion matrix (ascii or latex) |
- | cmo | cmo | std::string | |Output file for confusion matrix |
- | se95 | se95 | bool | false |Report standard error for 95 confidence interval |
- | bnd | boundary | short | 1 |Boundary for selecting the sample (for vector reference datasets only) |
- | hom | homogeneous | bool | false |Only take regions with homogeneous boundary into account (for reference datasets only) |
- | circ | circular | bool | false |Use circular boundary (for vector reference datasets only) |
- | ct | ct | std::string | |Color table in ASCII format having 5 columns: id R G B ALFA (0: transparent, 255: solid). |
- | co | co | std::string | |Creation option for output file. Multiple options can be specified. |
- | | commission | short | 2 |Value for commission errors: input label < reference label |
+ | i | input | std::string | |Input raster dataset. |
+ | ref | reference | std::string | |Reference (raster or vector) dataset |
+ | ln | ln | std::string | |Layer name(s) in sample. Leave empty to select all (for vector reference datasets only) |
+ | b | band | short | 0 |Input (reference) raster band. Optionally, you can define different bands for input and reference bands respectively: -b 1 -b 0. |
+ | rmse | rmse | bool | false |Report root mean squared error |
+ | reg | reg | bool | false |Report linear regression (Input = c0+c1*Reference) |
+ | cm | confusion | bool | false |Create confusion matrix (to std out) |
+ | lr | lref | std::string | label |Attribute name of the reference label (for vector reference datasets only) |
+ | c | class | std::string | |List of class names. |
+ | r | reclass | short | |List of class values (use same order as in classname option). |
+ | nodata | nodata | double | |No data value(s) in input or reference dataset are ignored |
+ | m | mask | std::string | |Use the first band of the specified file as a validity mask. Nodata values can be set with the option msknodata. |
+ | msknodata | msknodata | double | 0 |Mask value(s) where image is invalid. Use negative value for valid data (example: use -t -1: if only -1 is valid value) |
+ | o | output | std::string | |Output dataset (optional) |
+ | f | f | std::string | SQLite |OGR format for output vector (for vector reference datasets only) |
+ | of | oformat | std::string | GTiff |Output image format (see also gdal_translate).|
+ | lc | lclass | std::string | class |Attribute name of the classified label (for vector reference datasets only) |
+ | cmf | cmf | std::string | ascii |Format for confusion matrix (ascii or latex) |
+ | cmo | cmo | std::string | |Output file for confusion matrix |
+ | se95 | se95 | bool | false |Report standard error for 95 confidence interval |
+ | bnd | boundary | short | 1 |Boundary for selecting the sample (for vector reference datasets only) |
+ | hom | homogeneous | bool | false |Only take regions with homogeneous boundary into account (for reference datasets only) |
+ | circ | circular | bool | false |Use circular boundary (for vector reference datasets only) |
+ | ct | ct | std::string | |Color table in ASCII format having 5 columns: id R G B ALFA (0: transparent, 255: solid). |
+ | co | co | std::string | |Creation option for output file. Multiple options can be specified. |
+ | | commission | short | 2 |Value for commission errors: input label < reference label |
Usage: pkdiff -i input -ref reference
@@ -108,8 +108,8 @@ int main(int argc, char *argv[])
Optionpk<string> cmoutput_opt("cmo","cmo","Output file for confusion matrix");
Optionpk<bool> se95_opt("se95","se95","Report standard error for 95 confidence interval",false);
Optionpk<string> labelref_opt("lr", "lref", "Attribute name of the reference label (for vector reference datasets only)", "label");
- Optionpk<string> classname_opt("c", "class", "List of class names.");
- Optionpk<short> classvalue_opt("r", "reclass", "List of class values (use same order as in classname option).");
+ Optionpk<string> classname_opt("c", "class", "List of class names.");
+ Optionpk<short> classvalue_opt("r", "reclass", "List of class values (use same order as in classname option).");
Optionpk<string> output_opt("o", "output", "Output dataset (optional)");
Optionpk<string> ogrformat_opt("f", "f", "OGR format for output vector (for vector reference datasets only)","SQLite");
Optionpk<string> oformat_opt("of", "oformat", "Output image format (see also gdal_translate).","GTiff");
@@ -238,7 +238,7 @@ int main(int argc, char *argv[])
inputReader.getRange(inputRange,band_opt[0]);
inputReader.close();
// }
-
+
for(int iflag=0;iflag<nodata_opt.size();++iflag){
vector<short>::iterator fit;
fit=find(inputRange.begin(),inputRange.end(),static_cast<short>(nodata_opt[iflag]));
@@ -281,18 +281,25 @@ int main(int argc, char *argv[])
nvalidation[rc]=0;
}
}
-
+
bool isDifferent=false;
bool refIsRaster=false;
ImgReaderOgr referenceReaderOgr;
try{
referenceReaderOgr.open(reference_opt[0]);
+ double ulx,uly,lrx,lry;
+ if(!referenceReaderOgr.getExtent(ulx,uly,lrx,lry))
+ throw(std::string("Input is raster"));
referenceReaderOgr.close();
+ if(verbose_opt[0])
+ std::cout << "reference is vector dataset" << std::endl;
}
catch(string errorString){
//todo: sampleIsRaster will not work from GDAL 2.0!!?? (unification of driver for raster and vector datasets)
refIsRaster=true;
+ if(verbose_opt[0])
+ std::cout << "reference is raster dataset" << std::endl;
}
const char* pszMessage;
void* pProgressArg=NULL;
@@ -302,11 +309,11 @@ int main(int argc, char *argv[])
if(!refIsRaster){
for(int iinput=0;iinput<input_opt.size();++iinput){
if(verbose_opt[0])
- cout << "Processing input " << input_opt[iinput] << endl;
+ cout << "Processing input " << input_opt[iinput] << endl;
if(output_opt.size())
assert(reference_opt.size()==output_opt.size());
for(int iref=0;iref<reference_opt.size();++iref){
- cout << "reference " << reference_opt[iref] << endl;
+ cout << "reference " << reference_opt[iref] << endl;
// assert(reference_opt[iref].find(".shp")!=string::npos);
try{
inputReader.open(input_opt[iinput]);//,imagicX_opt[0],imagicY_opt[0]);
@@ -325,336 +332,336 @@ int main(int argc, char *argv[])
referenceRange=inputRange;
ImgWriterOgr ogrWriter;
- if(output_opt.size()){
- try{
- ogrWriter.open(output_opt[iref],ogrformat_opt[0]);
- }
- catch(string error){
- cerr << error << endl;
- exit(1);
- }
- }
- int nlayer=referenceReaderOgr.getDataSource()->GetLayerCount();
- for(int ilayer=0;ilayer<nlayer;++ilayer){
- progress=0;
- OGRLayer *readLayer=referenceReaderOgr.getLayer(ilayer);
- // readLayer = referenceReaderOgr.getDataSource()->GetLayer(ilayer);
- string currentLayername=readLayer->GetName();
- if(layer_opt.size())
- if(find(layer_opt.begin(),layer_opt.end(),currentLayername)==layer_opt.end())
- continue;
- if(!verbose_opt[0])
- pfnProgress(progress,pszMessage,pProgressArg);
- else
- cout << "processing layer " << readLayer->GetName() << endl;
-
- readLayer->ResetReading();
- OGRLayer *writeLayer;
- if(output_opt.size()){
- if(verbose_opt[0])
- cout << "creating output vector file " << output_opt[0] << endl;
- // assert(output_opt[0].find(".shp")!=string::npos);
- char **papszOptions=NULL;
- if(verbose_opt[0])
- cout << "creating layer: " << readLayer->GetName() << endl;
- // if(ogrWriter.createLayer(layername, referenceReaderOgr.getProjection(ilayer), referenceReaderOgr.getGeometryType(ilayer), papszOptions)==NULL)
- writeLayer=ogrWriter.createLayer(readLayer->GetName(), referenceReaderOgr.getProjection(ilayer), wkbPoint, papszOptions);
- assert(writeLayer);
- if(verbose_opt[0]){
- cout << "created layer" << endl;
- cout << "copy fields from " << reference_opt[iref] << endl;
- }
- ogrWriter.copyFields(referenceReaderOgr,ilayer,ilayer);
- //create extra field for classified label
- short theDim=boundary_opt[0];
- for(int windowJ=-theDim/2;windowJ<(theDim+1)/2;++windowJ){
- for(int windowI=-theDim/2;windowI<(theDim+1)/2;++windowI){
- if(disc_opt[0]&&(windowI*windowI+windowJ*windowJ>(theDim/2)*(theDim/2)))
- continue;
- ostringstream fs;
- if(theDim>1)
- fs << labelclass_opt[0] << "_" << windowJ << "_" << windowI;
- else
- fs << labelclass_opt[0];
- if(verbose_opt[0])
- cout << "creating field " << fs.str() << endl;
- ogrWriter.createField(fs.str(),OFTInteger,ilayer);
- }
- }
- }
- OGRFeature *readFeature;
- OGRFeature *writeFeature;
- int isample=0;
- unsigned int nfeatureInLayer=readLayer->GetFeatureCount();
- unsigned int ifeature=0;
- while( (readFeature = readLayer->GetNextFeature()) != NULL ){
- if(verbose_opt[0])
- cout << "sample " << ++isample << endl;
- //get x and y from readFeature
- double x,y;
- OGRGeometry *poGeometry;
- OGRPoint centroidPoint;
- OGRPoint *poPoint;
- poGeometry = readFeature->GetGeometryRef();
- // assert( poGeometry != NULL && wkbFlatten(poGeometry->getGeometryType()) == wkbPoint );
- if(poGeometry==NULL)
- continue;
- else if(wkbFlatten(poGeometry->getGeometryType()) == wkbMultiPolygon){
- OGRMultiPolygon readPolygon = *((OGRMultiPolygon *) poGeometry);
- readPolygon = *((OGRMultiPolygon *) poGeometry);
- readPolygon.Centroid(¢roidPoint);
- poPoint=¢roidPoint;
- }
- else if(wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon){
- OGRPolygon readPolygon=*((OGRPolygon *) poGeometry);
- readPolygon.Centroid(¢roidPoint);
- poPoint=¢roidPoint;
- }
- else if(wkbFlatten(poGeometry->getGeometryType()) == wkbPoint )
- poPoint = (OGRPoint *) poGeometry;
- else{
- std::cerr << "Warning: skipping feature (not of type point or polygon)" << std::endl;
- continue;
- }
- x=poPoint->getX();
- y=poPoint->getY();
- double inputValue;
- vector<double> inputValues;
- bool isHomogeneous=true;
- short maskValue;
- short outputValue;
- //read referenceValue from feature
- unsigned short referenceValue;
- string referenceClassName;
- if(classValueMap.size()){
- referenceClassName=readFeature->GetFieldAsString(readFeature->GetFieldIndex(labelref_opt[0].c_str()));
- referenceValue=classValueMap[referenceClassName];
- }
- else
- referenceValue=readFeature->GetFieldAsInteger(readFeature->GetFieldIndex(labelref_opt[0].c_str()));
- if(verbose_opt[0])
- cout << "reference value: " << referenceValue << endl;
-
- bool pixelFlagged=false;
- bool maskFlagged=false;
- for(int iflag=0;iflag<nodata_opt.size();++iflag){
- if(referenceValue==nodata_opt[iflag])
- pixelFlagged=true;
- }
- if(pixelFlagged)
- continue;
- double i_centre,j_centre;
- //input reader is georeferenced!
- inputReader.geo2image(x,y,i_centre,j_centre);
- // else{
- // i_centre=x;
- // j_centre=y;
- // }
- //nearest neighbour
- j_centre=static_cast<int>(j_centre);
- i_centre=static_cast<int>(i_centre);
- //check if j_centre is out of bounds
- if(static_cast<int>(j_centre)<0||static_cast<int>(j_centre)>=inputReader.nrOfRow())
- continue;
- //check if i_centre is out of bounds
- if(static_cast<int>(i_centre)<0||static_cast<int>(i_centre)>=inputReader.nrOfCol())
- continue;
-
- if(output_opt.size()){
- writeFeature = OGRFeature::CreateFeature(writeLayer->GetLayerDefn());
- assert(readFeature);
- int nfield=readFeature->GetFieldCount();
- writeFeature->SetGeometry(poPoint);
- if(verbose_opt[0])
- cout << "copying fields from " << reference_opt[0] << endl;
- assert(readFeature);
- assert(writeFeature);
- vector<int> panMap(nfield);
- vector<int>::iterator panit=panMap.begin();
- for(int ifield=0;ifield<nfield;++ifield)
- panMap[ifield]=ifield;
- writeFeature->SetFieldsFrom(readFeature,&(panMap[0]));
- // if(writeFeature->SetFrom(readFeature)!= OGRERR_NONE)
- // cerr << "writing feature failed" << endl;
- // if(verbose_opt[0])
- // cout << "feature written" << endl;
- }
- bool windowAllFlagged=true;
- bool windowHasFlag=false;
- short theDim=boundary_opt[0];
- for(int windowJ=-theDim/2;windowJ<(theDim+1)/2;++windowJ){
- for(int windowI=-theDim/2;windowI<(theDim+1)/2;++windowI){
- if(disc_opt[0]&&(windowI*windowI+windowJ*windowJ>(theDim/2)*(theDim/2)))
- continue;
- int j=j_centre+windowJ;
- //check if j is out of bounds
- if(static_cast<int>(j)<0||static_cast<int>(j)>=inputReader.nrOfRow())
- continue;
- int i=i_centre+windowI;
- //check if i is out of bounds
- if(static_cast<int>(i)<0||static_cast<int>(i)>=inputReader.nrOfCol())
- continue;
- if(verbose_opt[0])
- cout << setprecision(12) << "reading image value at x,y " << x << "," << y << " (" << i << "," << j << "), ";
- inputReader.readData(inputValue,i,j,band_opt[0]);
- inputValues.push_back(inputValue);
- if(inputValues.back()!=*(inputValues.begin()))
- isHomogeneous=false;
- if(verbose_opt[0])
- cout << "input value: " << inputValue << endl;
- pixelFlagged=false;
- for(int iflag=0;iflag<nodata_opt.size();++iflag){
- if(inputValue==nodata_opt[iflag]){
- pixelFlagged=true;
- break;
- }
- }
- maskFlagged=false;//(msknodata_opt[ivalue]>=0)?false:true;
- if(mask_opt.size()){
- maskReader.readData(maskValue,i,j,0);
- for(int ivalue=0;ivalue<msknodata_opt.size();++ivalue){
- if(msknodata_opt[ivalue]>=0){//values set in msknodata_opt are invalid
- if(maskValue==msknodata_opt[ivalue]){
- maskFlagged=true;
- break;
- }
- }
- else{//only values set in msknodata_opt are valid
- if(maskValue!=-msknodata_opt[ivalue])
- maskFlagged=true;
- else{
- maskFlagged=false;
- break;
- }
- }
- }
- }
- pixelFlagged=pixelFlagged||maskFlagged;
- if(pixelFlagged)
- windowHasFlag=true;
- else
- windowAllFlagged=false;//at least one good pixel in neighborhood
- }
- }
- //at this point we know the values for the entire window
-
- if(homogeneous_opt[0]){//only centre pixel
- int j=j_centre;
- int i=i_centre;
- //flag if not all pixels are homogeneous or if at least one pixel flagged
-
- if(!windowHasFlag&&isHomogeneous){
- if(output_opt.size())
- writeFeature->SetField(labelclass_opt[0].c_str(),static_cast<int>(inputValue));
- if(confusion_opt[0]){
- ++ntotalValidation;
- if(classValueMap.size()){
- assert(inputValue<nameVector.size());
- string className=nameVector[static_cast<unsigned short>(inputValue)];
- cm.incrementResult(type2string<short>(classValueMap[referenceClassName]),type2string<short>(classValueMap[className]),1);
- }
- else{
- int rc=distance(referenceRange.begin(),find(referenceRange.begin(),referenceRange.end(),static_cast<unsigned short>(referenceValue)));
- int ic=distance(inputRange.begin(),find(inputRange.begin(),inputRange.end(),static_cast<unsigned short>(inputValue)));
- assert(rc<nclass);
- assert(ic<nclass);
- ++nvalidation[rc];
- ++resultClass[rc][ic];
- if(verbose_opt[0]>1)
- cout << "increment: " << rc << " " << referenceRange[rc] << " " << ic << " " << inputRange[ic] << endl;
- cm.incrementResult(cm.getClass(rc),cm.getClass(ic),1);
- }
- }
- if(inputValue==referenceValue){//correct
- outputValue=valueE_opt[0];
- if(nodata_opt.size()){
- if(valueE_opt[0]==nodata_opt[0])
- outputValue=inputValue;
- }
- }
- else if(inputValue>referenceValue)//1=forest,2=non-forest
- outputValue=valueO_opt[0];//omission error
- else
- outputValue=valueC_opt[0];//commission error
- }
- }
- else{
- for(int windowJ=-theDim/2;windowJ<(theDim+1)/2;++windowJ){
- for(int windowI=-theDim/2;windowI<(theDim+1)/2;++windowI){
- if(disc_opt[0]&&(windowI*windowI+windowJ*windowJ>(theDim/2)*(theDim/2)))
- continue;
- int j=j_centre+windowJ;
- //check if j is out of bounds
- if(static_cast<int>(j)<0||static_cast<int>(j)>=inputReader.nrOfRow())
- continue;
- int i=i_centre+windowI;
- //check if i is out of bounds
- if(static_cast<int>(i)<0||static_cast<int>(i)>=inputReader.nrOfCol())
- continue;
- if(!windowAllFlagged){
- ostringstream fs;
- if(theDim>1)
- fs << labelclass_opt[0] << "_" << windowJ << "_" << windowI;
- else
- fs << labelclass_opt[0];
- if(output_opt.size())
- writeFeature->SetField(fs.str().c_str(),inputValue);
- if(!windowJ&&!windowI){//centre pixel
- if(confusion_opt[0]){
- ++ntotalValidation;
- if(classValueMap.size()){
- assert(inputValue<nameVector.size());
- string className=nameVector[static_cast<unsigned short>(inputValue)];
- cm.incrementResult(type2string<short>(classValueMap[referenceClassName]),type2string<short>(classValueMap[className]),1);
- }
- else{
- int rc=distance(referenceRange.begin(),find(referenceRange.begin(),referenceRange.end(),static_cast<unsigned short>(referenceValue)));
- int ic=distance(inputRange.begin(),find(inputRange.begin(),inputRange.end(),static_cast<unsigned short>(inputValue)));
- if(rc>=nclass)
- continue;
- if(ic>=nclass)
- continue;
- // assert(rc<nclass);
- // assert(ic<nclass);
- ++nvalidation[rc];
- ++resultClass[rc][ic];
- if(verbose_opt[0]>1)
- cout << "increment: " << rc << " " << referenceRange[rc] << " " << ic << " " << inputRange[ic] << endl;
- cm.incrementResult(cm.getClass(rc),cm.getClass(ic),1);
- }
- }
- if(inputValue==referenceValue){//correct
- outputValue=valueE_opt[0];
- if(nodata_opt.size()){
- if(valueE_opt[0]==nodata_opt[0])
- outputValue=inputValue;
- }
- }
- else if(inputValue>referenceValue)//1=forest,2=non-forest
- outputValue=valueO_opt[0];//omission error
- else
- outputValue=valueC_opt[0];//commission error
- }
- }
- }
- }
- }
- if(output_opt.size()){
- if(!windowAllFlagged){
- if(verbose_opt[0])
- cout << "creating feature" << endl;
- if(writeLayer->CreateFeature( writeFeature ) != OGRERR_NONE ){
- string errorString="Failed to create feature in OGR vector file";
- throw(errorString);
- }
- }
- OGRFeature::DestroyFeature( writeFeature );
- }
- ++ifeature;
- progress=static_cast<float>(ifeature+1)/nfeatureInLayer;
- pfnProgress(progress,pszMessage,pProgressArg);
- }//next feature
- }//next layer
+ if(output_opt.size()){
+ try{
+ ogrWriter.open(output_opt[iref],ogrformat_opt[0]);
+ }
+ catch(string error){
+ cerr << error << endl;
+ exit(1);
+ }
+ }
+ int nlayer=referenceReaderOgr.getDataSource()->GetLayerCount();
+ for(int ilayer=0;ilayer<nlayer;++ilayer){
+ progress=0;
+ OGRLayer *readLayer=referenceReaderOgr.getLayer(ilayer);
+ // readLayer = referenceReaderOgr.getDataSource()->GetLayer(ilayer);
+ string currentLayername=readLayer->GetName();
+ if(layer_opt.size())
+ if(find(layer_opt.begin(),layer_opt.end(),currentLayername)==layer_opt.end())
+ continue;
+ if(!verbose_opt[0])
+ pfnProgress(progress,pszMessage,pProgressArg);
+ else
+ cout << "processing layer " << readLayer->GetName() << endl;
+
+ readLayer->ResetReading();
+ OGRLayer *writeLayer;
+ if(output_opt.size()){
+ if(verbose_opt[0])
+ cout << "creating output vector file " << output_opt[0] << endl;
+ // assert(output_opt[0].find(".shp")!=string::npos);
+ char **papszOptions=NULL;
+ if(verbose_opt[0])
+ cout << "creating layer: " << readLayer->GetName() << endl;
+ // if(ogrWriter.createLayer(layername, referenceReaderOgr.getProjection(ilayer), referenceReaderOgr.getGeometryType(ilayer), papszOptions)==NULL)
+ writeLayer=ogrWriter.createLayer(readLayer->GetName(), referenceReaderOgr.getProjection(ilayer), wkbPoint, papszOptions);
+ assert(writeLayer);
+ if(verbose_opt[0]){
+ cout << "created layer" << endl;
+ cout << "copy fields from " << reference_opt[iref] << endl;
+ }
+ ogrWriter.copyFields(referenceReaderOgr,ilayer,ilayer);
+ //create extra field for classified label
+ short theDim=boundary_opt[0];
+ for(int windowJ=-theDim/2;windowJ<(theDim+1)/2;++windowJ){
+ for(int windowI=-theDim/2;windowI<(theDim+1)/2;++windowI){
+ if(disc_opt[0]&&(windowI*windowI+windowJ*windowJ>(theDim/2)*(theDim/2)))
+ continue;
+ ostringstream fs;
+ if(theDim>1)
+ fs << labelclass_opt[0] << "_" << windowJ << "_" << windowI;
+ else
+ fs << labelclass_opt[0];
+ if(verbose_opt[0])
+ cout << "creating field " << fs.str() << endl;
+ ogrWriter.createField(fs.str(),OFTInteger,ilayer);
+ }
+ }
+ }
+ OGRFeature *readFeature;
+ OGRFeature *writeFeature;
+ int isample=0;
+ unsigned int nfeatureInLayer=readLayer->GetFeatureCount();
+ unsigned int ifeature=0;
+ while( (readFeature = readLayer->GetNextFeature()) != NULL ){
+ if(verbose_opt[0])
+ cout << "sample " << ++isample << endl;
+ //get x and y from readFeature
+ double x,y;
+ OGRGeometry *poGeometry;
+ OGRPoint centroidPoint;
+ OGRPoint *poPoint;
+ poGeometry = readFeature->GetGeometryRef();
+ // assert( poGeometry != NULL && wkbFlatten(poGeometry->getGeometryType()) == wkbPoint );
+ if(poGeometry==NULL)
+ continue;
+ else if(wkbFlatten(poGeometry->getGeometryType()) == wkbMultiPolygon){
+ OGRMultiPolygon readPolygon = *((OGRMultiPolygon *) poGeometry);
+ readPolygon = *((OGRMultiPolygon *) poGeometry);
+ readPolygon.Centroid(¢roidPoint);
+ poPoint=¢roidPoint;
+ }
+ else if(wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon){
+ OGRPolygon readPolygon=*((OGRPolygon *) poGeometry);
+ readPolygon.Centroid(¢roidPoint);
+ poPoint=¢roidPoint;
+ }
+ else if(wkbFlatten(poGeometry->getGeometryType()) == wkbPoint )
+ poPoint = (OGRPoint *) poGeometry;
+ else{
+ std::cerr << "Warning: skipping feature (not of type point or polygon)" << std::endl;
+ continue;
+ }
+ x=poPoint->getX();
+ y=poPoint->getY();
+ double inputValue;
+ vector<double> inputValues;
+ bool isHomogeneous=true;
+ short maskValue;
+ short outputValue;
+ //read referenceValue from feature
+ unsigned short referenceValue;
+ string referenceClassName;
+ if(classValueMap.size()){
+ referenceClassName=readFeature->GetFieldAsString(readFeature->GetFieldIndex(labelref_opt[0].c_str()));
+ referenceValue=classValueMap[referenceClassName];
+ }
+ else
+ referenceValue=readFeature->GetFieldAsInteger(readFeature->GetFieldIndex(labelref_opt[0].c_str()));
+ if(verbose_opt[0])
+ cout << "reference value: " << referenceValue << endl;
+
+ bool pixelFlagged=false;
+ bool maskFlagged=false;
+ for(int iflag=0;iflag<nodata_opt.size();++iflag){
+ if(referenceValue==nodata_opt[iflag])
+ pixelFlagged=true;
+ }
+ if(pixelFlagged)
+ continue;
+ double i_centre,j_centre;
+ //input reader is georeferenced!
+ inputReader.geo2image(x,y,i_centre,j_centre);
+ // else{
+ // i_centre=x;
+ // j_centre=y;
+ // }
+ //nearest neighbour
+ j_centre=static_cast<int>(j_centre);
+ i_centre=static_cast<int>(i_centre);
+ //check if j_centre is out of bounds
+ if(static_cast<int>(j_centre)<0||static_cast<int>(j_centre)>=inputReader.nrOfRow())
+ continue;
+ //check if i_centre is out of bounds
+ if(static_cast<int>(i_centre)<0||static_cast<int>(i_centre)>=inputReader.nrOfCol())
+ continue;
+
+ if(output_opt.size()){
+ writeFeature = OGRFeature::CreateFeature(writeLayer->GetLayerDefn());
+ assert(readFeature);
+ int nfield=readFeature->GetFieldCount();
+ writeFeature->SetGeometry(poPoint);
+ if(verbose_opt[0])
+ cout << "copying fields from " << reference_opt[0] << endl;
+ assert(readFeature);
+ assert(writeFeature);
+ vector<int> panMap(nfield);
+ vector<int>::iterator panit=panMap.begin();
+ for(int ifield=0;ifield<nfield;++ifield)
+ panMap[ifield]=ifield;
+ writeFeature->SetFieldsFrom(readFeature,&(panMap[0]));
+ // if(writeFeature->SetFrom(readFeature)!= OGRERR_NONE)
+ // cerr << "writing feature failed" << endl;
+ // if(verbose_opt[0])
+ // cout << "feature written" << endl;
+ }
+ bool windowAllFlagged=true;
+ bool windowHasFlag=false;
+ short theDim=boundary_opt[0];
+ for(int windowJ=-theDim/2;windowJ<(theDim+1)/2;++windowJ){
+ for(int windowI=-theDim/2;windowI<(theDim+1)/2;++windowI){
+ if(disc_opt[0]&&(windowI*windowI+windowJ*windowJ>(theDim/2)*(theDim/2)))
+ continue;
+ int j=j_centre+windowJ;
+ //check if j is out of bounds
+ if(static_cast<int>(j)<0||static_cast<int>(j)>=inputReader.nrOfRow())
+ continue;
+ int i=i_centre+windowI;
+ //check if i is out of bounds
+ if(static_cast<int>(i)<0||static_cast<int>(i)>=inputReader.nrOfCol())
+ continue;
+ if(verbose_opt[0])
+ cout << setprecision(12) << "reading image value at x,y " << x << "," << y << " (" << i << "," << j << "), ";
+ inputReader.readData(inputValue,i,j,band_opt[0]);
+ inputValues.push_back(inputValue);
+ if(inputValues.back()!=*(inputValues.begin()))
+ isHomogeneous=false;
+ if(verbose_opt[0])
+ cout << "input value: " << inputValue << endl;
+ pixelFlagged=false;
+ for(int iflag=0;iflag<nodata_opt.size();++iflag){
+ if(inputValue==nodata_opt[iflag]){
+ pixelFlagged=true;
+ break;
+ }
+ }
+ maskFlagged=false;//(msknodata_opt[ivalue]>=0)?false:true;
+ if(mask_opt.size()){
+ maskReader.readData(maskValue,i,j,0);
+ for(int ivalue=0;ivalue<msknodata_opt.size();++ivalue){
+ if(msknodata_opt[ivalue]>=0){//values set in msknodata_opt are invalid
+ if(maskValue==msknodata_opt[ivalue]){
+ maskFlagged=true;
+ break;
+ }
+ }
+ else{//only values set in msknodata_opt are valid
+ if(maskValue!=-msknodata_opt[ivalue])
+ maskFlagged=true;
+ else{
+ maskFlagged=false;
+ break;
+ }
+ }
+ }
+ }
+ pixelFlagged=pixelFlagged||maskFlagged;
+ if(pixelFlagged)
+ windowHasFlag=true;
+ else
+ windowAllFlagged=false;//at least one good pixel in neighborhood
+ }
+ }
+ //at this point we know the values for the entire window
+
+ if(homogeneous_opt[0]){//only centre pixel
+ int j=j_centre;
+ int i=i_centre;
+ //flag if not all pixels are homogeneous or if at least one pixel flagged
+
+ if(!windowHasFlag&&isHomogeneous){
+ if(output_opt.size())
+ writeFeature->SetField(labelclass_opt[0].c_str(),static_cast<int>(inputValue));
+ if(confusion_opt[0]){
+ ++ntotalValidation;
+ if(classValueMap.size()){
+ assert(inputValue<nameVector.size());
+ string className=nameVector[static_cast<unsigned short>(inputValue)];
+ cm.incrementResult(type2string<short>(classValueMap[referenceClassName]),type2string<short>(classValueMap[className]),1);
+ }
+ else{
+ int rc=distance(referenceRange.begin(),find(referenceRange.begin(),referenceRange.end(),static_cast<unsigned short>(referenceValue)));
+ int ic=distance(inputRange.begin(),find(inputRange.begin(),inputRange.end(),static_cast<unsigned short>(inputValue)));
+ assert(rc<nclass);
+ assert(ic<nclass);
+ ++nvalidation[rc];
+ ++resultClass[rc][ic];
+ if(verbose_opt[0]>1)
+ cout << "increment: " << rc << " " << referenceRange[rc] << " " << ic << " " << inputRange[ic] << endl;
+ cm.incrementResult(cm.getClass(rc),cm.getClass(ic),1);
+ }
+ }
+ if(inputValue==referenceValue){//correct
+ outputValue=valueE_opt[0];
+ if(nodata_opt.size()){
+ if(valueE_opt[0]==nodata_opt[0])
+ outputValue=inputValue;
+ }
+ }
+ else if(inputValue>referenceValue)//1=forest,2=non-forest
+ outputValue=valueO_opt[0];//omission error
+ else
+ outputValue=valueC_opt[0];//commission error
+ }
+ }
+ else{
+ for(int windowJ=-theDim/2;windowJ<(theDim+1)/2;++windowJ){
+ for(int windowI=-theDim/2;windowI<(theDim+1)/2;++windowI){
+ if(disc_opt[0]&&(windowI*windowI+windowJ*windowJ>(theDim/2)*(theDim/2)))
+ continue;
+ int j=j_centre+windowJ;
+ //check if j is out of bounds
+ if(static_cast<int>(j)<0||static_cast<int>(j)>=inputReader.nrOfRow())
+ continue;
+ int i=i_centre+windowI;
+ //check if i is out of bounds
+ if(static_cast<int>(i)<0||static_cast<int>(i)>=inputReader.nrOfCol())
+ continue;
+ if(!windowAllFlagged){
+ ostringstream fs;
+ if(theDim>1)
+ fs << labelclass_opt[0] << "_" << windowJ << "_" << windowI;
+ else
+ fs << labelclass_opt[0];
+ if(output_opt.size())
+ writeFeature->SetField(fs.str().c_str(),inputValue);
+ if(!windowJ&&!windowI){//centre pixel
+ if(confusion_opt[0]){
+ ++ntotalValidation;
+ if(classValueMap.size()){
+ assert(inputValue<nameVector.size());
+ string className=nameVector[static_cast<unsigned short>(inputValue)];
+ cm.incrementResult(type2string<short>(classValueMap[referenceClassName]),type2string<short>(classValueMap[className]),1);
+ }
+ else{
+ int rc=distance(referenceRange.begin(),find(referenceRange.begin(),referenceRange.end(),static_cast<unsigned short>(referenceValue)));
+ int ic=distance(inputRange.begin(),find(inputRange.begin(),inputRange.end(),static_cast<unsigned short>(inputValue)));
+ if(rc>=nclass)
+ continue;
+ if(ic>=nclass)
+ continue;
+ // assert(rc<nclass);
+ // assert(ic<nclass);
+ ++nvalidation[rc];
+ ++resultClass[rc][ic];
+ if(verbose_opt[0]>1)
+ cout << "increment: " << rc << " " << referenceRange[rc] << " " << ic << " " << inputRange[ic] << endl;
+ cm.incrementResult(cm.getClass(rc),cm.getClass(ic),1);
+ }
+ }
+ if(inputValue==referenceValue){//correct
+ outputValue=valueE_opt[0];
+ if(nodata_opt.size()){
+ if(valueE_opt[0]==nodata_opt[0])
+ outputValue=inputValue;
+ }
+ }
+ else if(inputValue>referenceValue)//1=forest,2=non-forest
+ outputValue=valueO_opt[0];//omission error
+ else
+ outputValue=valueC_opt[0];//commission error
+ }
+ }
+ }
+ }
+ }
+ if(output_opt.size()){
+ if(!windowAllFlagged){
+ if(verbose_opt[0])
+ cout << "creating feature" << endl;
+ if(writeLayer->CreateFeature( writeFeature ) != OGRERR_NONE ){
+ string errorString="Failed to create feature in OGR vector file";
+ throw(errorString);
+ }
+ }
+ OGRFeature::DestroyFeature( writeFeature );
+ }
+ ++ifeature;
+ progress=static_cast<float>(ifeature+1)/nfeatureInLayer;
+ pfnProgress(progress,pszMessage,pProgressArg);
+ }//next feature
+ }//next layer
if(output_opt.size())
ogrWriter.close();
referenceReaderOgr.close();
@@ -680,9 +687,9 @@ int main(int argc, char *argv[])
option_opt.push_back(theInterleave);
}
gdalWriter.open(output_opt[0],inputReader.nrOfCol(),inputReader.nrOfRow(),1,inputReader.getDataType(),oformat_opt[0],option_opt);
- if(nodata_opt.size())
- gdalWriter.GDALSetNoDataValue(nodata_opt[0]);
- gdalWriter.copyGeoTransform(inputReader);
+ if(nodata_opt.size())
+ gdalWriter.GDALSetNoDataValue(nodata_opt[0]);
+ gdalWriter.copyGeoTransform(inputReader);
if(colorTable_opt.size())
gdalWriter.setColorTable(colorTable_opt[0]);
else if(inputReader.getColorTable()!=NULL){
@@ -693,7 +700,7 @@ int main(int argc, char *argv[])
}
else if(verbose_opt[0])
cout << "no output image defined" << endl;
-
+
}
catch(string error){
cout << error << endl;
@@ -742,7 +749,7 @@ int main(int argc, char *argv[])
if(referenceRange.size()!=inputRange.size()){
if(confusion_opt[0]||output_opt.size()){
cout << "reference range is not equal to input range!" << endl;
- cout << "Kappa: " << 0 << endl;
+ cout << "Kappa: " << 0 << endl;
cout << "total weighted: " << 0 << endl;
}
else
@@ -764,25 +771,25 @@ int main(int argc, char *argv[])
inputReader.image2geo(icol,irow,x,y);
referenceReaderGdal.geo2image(x,y,ireference,jreference);
if(ireference<0||ireference>=referenceReaderGdal.nrOfCol()){
- if(rmse_opt[0]||regression_opt[0])
- continue;
- else{
- cerr << ireference << " out of reference range!" << endl;
- cerr << x << " " << y << " " << icol << " " << irow << endl;
- cerr << x << " " << y << " " << ireference << " " << jreference << endl;
- exit(1);
- }
+ if(rmse_opt[0]||regression_opt[0])
+ continue;
+ else{
+ cerr << ireference << " out of reference range!" << endl;
+ cerr << x << " " << y << " " << icol << " " << irow << endl;
+ cerr << x << " " << y << " " << ireference << " " << jreference << endl;
+ exit(1);
+ }
}
if(jreference!=oldreferencerow){
if(jreference<0||jreference>=referenceReaderGdal.nrOfRow()){
- if(rmse_opt[0]||regression_opt[0])
- continue;
- else{
- cerr << jreference << " out of reference range!" << endl;
- cerr << x << " " << y << " " << icol << " " << irow << endl;
- cerr << x << " " << y << " " << ireference << " " << jreference << endl;
- exit(1);
- }
+ if(rmse_opt[0]||regression_opt[0])
+ continue;
+ else{
+ cerr << jreference << " out of reference range!" << endl;
+ cerr << x << " " << y << " " << icol << " " << irow << endl;
+ cerr << x << " " << y << " " << ireference << " " << jreference << endl;
+ exit(1);
+ }
}
else{
referenceReaderGdal.readData(lineReference,static_cast<int>(jreference),band_opt[1]);
@@ -799,26 +806,26 @@ int main(int argc, char *argv[])
}
}
if(mask_opt.size()){
- maskReader.geo2image(x,y,imask,jmask);
- if(jmask>=0&&jmask<maskReader.nrOfRow()){
- if(jmask!=oldmaskrow)
- maskReader.readData(lineMask,jmask);
- for(int ivalue=0;ivalue<msknodata_opt.size();++ivalue){
- if(lineMask[icol]==msknodata_opt[ivalue]){
- flagged=true;
- break;
- }
- }
+ maskReader.geo2image(x,y,imask,jmask);
+ if(jmask>=0&&jmask<maskReader.nrOfRow()){
+ if(jmask!=oldmaskrow)
+ maskReader.readData(lineMask,jmask);
+ for(int ivalue=0;ivalue<msknodata_opt.size();++ivalue){
+ if(lineMask[icol]==msknodata_opt[ivalue]){
+ flagged=true;
+ break;
+ }
+ }
}
}
if(!flagged){
- if(rmse_opt[0]){//divide by image size to prevent overflow. At the end we need to take care about flagged pixels by normalizing...
- rmse+=static_cast<double>(lineInput[icol]-lineReference[ireference])*(lineInput[icol]-lineReference[ireference])/inputReader.nrOfCol()/inputReader.nrOfRow();
- }
- else if(regression_opt[0]){
- bufferInput.push_back(lineInput[icol]);
- bufferReference.push_back(lineReference[ireference]);
- }
+ if(rmse_opt[0]){//divide by image size to prevent overflow. At the end we need to take care about flagged pixels by normalizing...
+ rmse+=static_cast<double>(lineInput[icol]-lineReference[ireference])*(lineInput[icol]-lineReference[ireference])/inputReader.nrOfCol()/inputReader.nrOfRow();
+ }
+ else if(regression_opt[0]){
+ bufferInput.push_back(lineInput[icol]);
+ bufferReference.push_back(lineReference[ireference]);
+ }
if(confusion_opt[0]){
++ntotalValidation;
@@ -834,11 +841,11 @@ int main(int argc, char *argv[])
}
if(lineInput[icol]==lineReference[ireference]){//correct
if(output_opt.size()){
- lineOutput[icol]=valueE_opt[0];
- if(nodata_opt.size()){
- if(valueE_opt[0]==nodata_opt[0])
- lineOutput[icol]=lineInput[icol];
- }
+ lineOutput[icol]=valueE_opt[0];
+ if(nodata_opt.size()){
+ if(valueE_opt[0]==nodata_opt[0])
+ lineOutput[icol]=lineInput[icol];
+ }
}
}
else{//error
@@ -848,20 +855,20 @@ int main(int argc, char *argv[])
}
if(output_opt.size()){
if(lineInput[icol]>lineReference[ireference])
- lineOutput[icol]=valueO_opt[0];//omission error
- else
- lineOutput[icol]=valueC_opt[0];//commission error
+ lineOutput[icol]=valueO_opt[0];//omission error
+ else
+ lineOutput[icol]=valueC_opt[0];//commission error
}
}
- }
+ }
else{
++nflagged;
if(output_opt.size()){
- if(nodata_opt.size())
- lineOutput[icol]=nodata_opt[0];
- else //should never occur?
- lineOutput[icol]=0;
- }
+ if(nodata_opt.size())
+ lineOutput[icol]=nodata_opt[0];
+ else //should never occur?
+ lineOutput[icol]=0;
+ }
}
}
if(output_opt.size()){
@@ -888,35 +895,35 @@ int main(int argc, char *argv[])
gdalWriter.close();
else if(!confusion_opt[0]){
if(rmse_opt[0]){
- double normalization=1.0*inputReader.nrOfCol()*inputReader.nrOfRow()/(inputReader.nrOfCol()*inputReader.nrOfRow()-nflagged);
- if(verbose_opt[0]){
- cout << "normalization: " << normalization << endl;
- cout << "rmse before sqrt and normalization: " << rmse << endl;
- }
- cout << "--rmse " << sqrt(rmse/normalization) << endl;
+ double normalization=1.0*inputReader.nrOfCol()*inputReader.nrOfRow()/(inputReader.nrOfCol()*inputReader.nrOfRow()-nflagged);
+ if(verbose_opt[0]){
+ cout << "normalization: " << normalization << endl;
+ cout << "rmse before sqrt and normalization: " << rmse << endl;
+ }
+ cout << "--rmse " << sqrt(rmse/normalization) << endl;
}
else if(regression_opt[0]){
- double err=0;
- double c0=0;
- double c1=1;
- statfactory::StatFactory stat;
- if(bufferInput.size()&&bufferReference.size()){
- err=stat.linear_regression_err(bufferInput,bufferReference,c0,c1);
- }
- if(verbose_opt[0]){
- cout << "bufferInput.size(): " << bufferInput.size() << endl;
- cout << "bufferReference.size(): " << bufferReference.size() << endl;
- double theMin=0;
- double theMax=0;
- stat.minmax(bufferInput,bufferInput.begin(),bufferInput.end(),theMin,theMax);
- cout << "min, max input: " << theMin << ", " << theMax << endl;
- theMin=0;
- theMax=0;
- stat.minmax(bufferReference,bufferReference.begin(),bufferReference.end(),theMin,theMax);
- cout << "min, max reference: " << theMin << ", " << theMax << endl;
- }
- cout << "--c0 " << c0 << "--c1 " << c1 << " --rmse: " << err << endl;
-
+ double err=0;
+ double c0=0;
+ double c1=1;
+ statfactory::StatFactory stat;
+ if(bufferInput.size()&&bufferReference.size()){
+ err=stat.linear_regression_err(bufferInput,bufferReference,c0,c1);
+ }
+ if(verbose_opt[0]){
+ cout << "bufferInput.size(): " << bufferInput.size() << endl;
+ cout << "bufferReference.size(): " << bufferReference.size() << endl;
+ double theMin=0;
+ double theMax=0;
+ stat.minmax(bufferInput,bufferInput.begin(),bufferInput.end(),theMin,theMax);
+ cout << "min, max input: " << theMin << ", " << theMax << endl;
+ theMin=0;
+ theMax=0;
+ stat.minmax(bufferReference,bufferReference.begin(),bufferReference.end(),theMin,theMax);
+ cout << "min, max reference: " << theMin << ", " << theMax << endl;
+ }
+ cout << "--c0 " << c0 << "--c1 " << c1 << " --rmse: " << err << endl;
+
}
else if(isDifferent)
cout << input_opt[0] << " and " << reference_opt[0] << " are different" << endl;
View it on GitLab: https://salsa.debian.org/debian-gis-team/pktools/compare/a96257ffd985f39394e0e56eba58081c5b5748e9...6730a90c355a87222a6781b7fb53e88a682b26f6
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pktools/compare/a96257ffd985f39394e0e56eba58081c5b5748e9...6730a90c355a87222a6781b7fb53e88a682b26f6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180819/efa0daef/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list