Quantum GIS (qgis) is an open source GIS software. The functionality of qgis can be extended by plugins written in python or c++. This question is related to the DTClassifier which is c++ based. DTClassifier make it possible to automate the classification of raster maps, such as automate the classification of forests on remote sensed data.
I want to install the plugin on qgis 1.8.0 (Ubuntu 12.04 64-bit), that is done by placing the compiled linux DTClassifier plugin file into
/usr/lib/qgis/plugins
However, that is a 32-bit binary сompiled under 32-bit Slackware 13.1 using OpenCV 2.3.1 while my os is Ubuntu 12.04 64 bit. Puting the file into
/usr/lib/qgis/plugins
is not recognized by qgis. Maybe because I have 64-bit os and OpenCV 2.4.1. So I tried to compile the provided source code but failed to do so. Anybody who could provide me with help how to compile the plugin or provide a already compiled file?
This is what I have accomplished so far:
I installed OpenCV 2.4.1, and Qt4, and downloaded the source for DTClassifier
svn co http://svn.gis-lab.info/dtclassifier/trunk dtclassifier
This source was put into the qgis-1.8.0 source. Then cmake was run with the CMakeLists.txt:
I found this (forum message) which is points to a 64-bit version for Ubuntu 11.04, but I could not make it work.
The details of what I have tried so far can be found below:
~/qgis-1.8.0/src/plugins/dtclassifier cmake .
The CMakeLists.txt
# set path to additional CMake modules
cmake_minimum_required (VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(Qt4)
INCLUDE(${QT_USE_FILE})
########################################################
# Files
SET (CLASSIFIER_SRCS
classifier.cpp
classifierdialog.cpp
classifierutils.cpp
rasterfileinfo.cpp
layerselectordialog.cpp
)
SET (CLASSIFIER_UIS
classifierdialogbase.ui
layerselectordialogbase.ui
)
SET (CLASSIFIER_MOC_HDRS
classifier.h
classifierdialog.h
layerselectordialog.h
)
SET (CLASSIFIER_RCCS classifier.qrc)
########################################################
# Build
QT4_WRAP_UI (CLASSIFIER_UIS_H ${CLASSIFIER_UIS})
QT4_WRAP_CPP (CLASSIFIER_MOC_SRCS ${CLASSIFIER_MOC_HDRS})
QT4_ADD_RESOURCES(CLASSIFIER_RCC_SRCS ${CLASSIFIER_RCCS})
ADD_LIBRARY (classifierplugin MODULE
${CLASSIFIER_SRCS}
${CLASSIFIER_MOC_SRCS}
${CLASSIFIER_RCC_SRCS}
${CLASSIFIER_UIS_H}
)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${GDAL_INCLUDE_DIR}
${OpenCV_INCLUDE_DIR}
../../core/raster
../../core/renderer
../../core/symbology
../../core
../../gui
..
.
#/usr/include/opencv2
)
TARGET_LINK_LIBRARIES(classifierplugin
qgis_core
qgis_gui
${OpenCV_LIBS}
#/usr/lib/libopencv_core.so
#/usr/lib/libopencv_ml.so
#/usr/lib/libopencv_highgui.so
#/usr/lib/libopencv_imgproc.so
)
########################################################
# Install
INSTALL(TARGETS classifierplugin
RUNTIME DESTINATION /usr/lib/qgis/plugins
LIBRARY DESTINATION /usr/lib/qgis/plugins
)
It did not give any error
-- Configuring done
-- Generating done
-- Build files have been written to: qgis-1.8.0/src/plugins/dtclassifier
. But then make fails complaining a lot:
make
[ 6%] Building CXX object CMakeFiles/classifierplugin.dir/classifier.cpp.o
In file included from /qgis-1.8.0/src/plugins/dtclassifier/../../gui/qgisinterface.h:40:0,
from /qgis-1.8.0/src/plugins/dtclassifier/classifier.cpp:23:
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:30:19: error: variable ‘CORE_EXPORT QGis’ has initializer but incomplete type
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:30:19: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default]
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:32:3: error: expected primary-expression before ‘public’
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:32:3: error: expected ‘}’ before ‘public’
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:32:3: error: expected ‘,’ or ‘;’ before ‘public’
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:38:22: error: uninitialized const ‘QGIS_VERSION_INT’ [-fpermissive]
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:77:47: error: storage size of ‘qgisVectorGeometryType’ isn’t known
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:80:41: error: storage size of ‘qgisFeatureTypes’ isn’t known
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:108:25: error: uninitialized const ‘DEFAULT_IDENTIFY_RADIUS’ [-fpermissive]
/qgis-1.8.0/src/plugins/dtclassifier/../../core/qgis.h:109:1: error: expected declaration before ‘}’ token
make[2]: *** [CMakeFiles/classifierplugin.dir/classifier.cpp.o] Error 1
make[1]: *** [CMakeFiles/classifierplugin.dir/all] Error 2
make: *** [all] Error 2