GEOS is a GIS domain to do topological analysis of the library, the latest version is 3.5.0, the detailed introduction of reference Geostrac
In the process of compiling the library, I found that there were some problems with the official file, and then I made a record to make it easier to compile later.
GEOS from version 3.5.0 is supported for compiling using CMake, but there are some problems with the CMake.txt configuration currently available, and the following error occurs when using CMake to generate the project:
Solution Reference: cannot build geos 3.5.0 need to download two files: 1.cmakelists.txt replace the original CMakeLists.txt 2. Generatesourcegroups.tx Modify the suffix of the file to. cmake and copy it to the Geos-3.5.0\cmake\modules directory and configure it again and generate the build project, Use vs to open the generated project, as shown in the following illustration:
In the project GEOS is used to compile the dynamic library GeoS (generate Goes.lib and Geos.dll), Geos-static generates a static GEOS library (Generate Libgeos.lib), Geos_c is the C-language library (Geos_c.lib and Geos_ C.dll), you can compile the appropriate libraries according to your needs. Compile this solution and find the error when compiling the GEOS project:
This is because a file in the project introduced the header file Windows.h, causing the max macro defined in Windows.h to conflict with Std::max in the C + + standard library, where the error occurred in the 第89-92 line in the BufferOp.cpp file. The solution is simple, with parentheses in Std::max, instead of a macro substitution, it calls the Std::max function, which is modified to:
Original file
Double Envmax = Std::max (
std::max (Fabs (Env->getmaxx ()), Fabs (Env->getminx ())),
Std::max (Fabs (Env->getmaxy ()), Fabs (Env->getminy ()))
;
After modification:
double Envmax = (Std::max) (
(Std::max) (Fabs (Env->getmaxx ()), Fabs (Env->getminx ())),
(std :: Max) (Fabs (Env->getmaxy ()), Fabs (Env->getminy ()))
;
After the modification, you can recompile.
Appendix: I uploaded the downloaded file to the resource share, which can be downloaded from the inside: Download link