vtkIOGDAL and vtkIOGeoJSON


I’m trying to build this project https://github.com/OpenGeoscience/vtkMap with all options (GDAL and GeoJSON extensions) under Centos 7.

The CMake configuration failed :

/usr/lib64/cmake/vtk/vtkModuleAPI.cmake:120: error: Requested modules not available: vtkIOGDAL vtkIOGeoJSON /usr/lib64/cmake/vtk/VTKConfig.cmake:89 (vtk_module_config) CMakeLists.txt:76 (find_package)

Where can I find vtkIOGDAL and vtkIOGeoJSON ? is it possible to to add them to the VTK “package” ?


You’ll need to enable them in the VTK build. They are disabled by default. Passing -DModule_vtkIOGDAL=ON and -DModule_vtkIOGeoJSON=ON when configuring VTK should enable them.

Thank you for your reply. Unfortunately, I’m using the VTK installed by “yum” (CentOS packages).

BTW, can you please tell me what is the utility of of vtkIOGDAL and vtkIOGeoJSON classes ? Are these classes readers ?


Then that VTK doesn’t provide GDAL or GeoJSON support. The names listed are called “modules” and contain various classes used to read and write (the IO part) GDAL and GeoJSON formatted files. You’ll have to compile VTK yourself if you need those modules since it seems that the EPEL package doesn’t build them. I would suggest either 8.1.2 or one of the 8.2.0 rc releases rather than master since big changes have landed there that vtkMap is unlikely to have been updated to support yet.

1 Like

OK understood. Thanks.

Right now, I’m building VTK with GDAL and GeoJSON modules.

Do you know please how to hint CMake of my new VTK build path ?


When configuring vtkMap, set the variable VTK_DIR to the VTK build path. You can do that from the command-line using the -D command. Or when you first try configuring, cmake will create that variable and you can then set it using ccmake or cmake-gui.

1 Like

Thanks, I will try that. If it doesn’t work, I will try to modify the CMakeLists.txt of the vtkMap project to use the VTK installed with “yum” and the vtkIOGDAL and vtkIOGeoJSON that I built manually.

That is unlikely to work. You’d need to match the version and compiler and a variety of other options used by the system VTK. All of VTK really should come from a single place.

You’re right.

Thanks, it works !

However, with that change, it created a little problem with Qt in vtkMap : Compiler can’t find QMainWindow.

I fixed it with using include_directories and adding Qt libs (because in Release mode, I don’t need to add Qt libs, however in Debug, QMainWindow is still not found except if I add Qt libs in target_link_libraries CMake is crazy !)

except if I add Qt libs in target_link_libraries CMake is crazy !)

Qt5 provides its targets with “usage requirements”. These can include things like include directories, compile definitions, C++ standard requirements, etc. Instead of having to call a bunch of different target_do_something functions, CMake offers it all through target_link_libraries (the name is unchanged for historical reasons and general compatibility). CMake documentation for usage requirements.

Thanks for the explanation !