/geos

Not regularly updated mirror of SVN repository with tags

Primary LanguageC++GNU Lesser General Public License v2.1LGPL-2.1

This is the repository forked from:

https://github.com/vmx/geos

I happened to use a feature of GEOS library called "polygonize" - which is, take a set of geometries (such as line strings) as input (can be unordered), and output the polygons - at the same time omitting the possibly dangling parts (such as dangling lines, points, etc.).

The feature is amazing yet the tutorial is difficult to find and not very much about how to use polygonizer.

I was inspired from the example code given by the original repository, yet I found it a bit old and especially for C++ API. So I will add my testing code, as a heads-up, also hope to help someone, somewhere else.

The GEOS version I am using is: 3.10.0 and the API is C++.

The testing code snipped will be in examples/My_example.

Note: Due to the compatibility, you might want to run the code in Release mode, since in Debug mode, the debug may fail because

vector interators incompatible with geosd.dll file.

=============================

The original information is as follows:

BUILDING, TESTING, INSTALLING

=============================

Unix

Using Autotools: ./autogen.sh # in ${srcdir}, if obtained from SVN ${srcdir}/configure # in build dir

Using CMake: cmake ${srcdir} # in build dir

Now, all versions: make make check make install # as root ldconfig # as root

Win32

If you use Microsoft Visual C++ (7.1 or later) compiler, you can build GEOS using NMAKE program and provided makefile.vc files.

If you are building from SVN checkout, first run: autogen.bat Then:

nmake /f makefile.vc MSVC_VER=1400

where 1400 is version number of Visual C++ compiler, here Visual C++ 8.0 from Visual Studio 2005 (supported versions are 1300, 1310, 1400 and 1500). The bootstrap.bat step is required to generate a couple of header files.

In order to build debug configuration of GEOS, additional flag DEBUG=1 is required:

nmake /f makefile.vc MSVC_VER=1400 DEBUG=1

CLIENT APPLICATIONS

Using the C interface (recommended)

To compile programs against the C lib (recommended):

CFLAGS += geos-config --cflags LDFLAGS += geos-config --ldflags -lgeos_c #include <geos_c.h>

Example usage:

capi/geostest.c contains basic usage examples.

Using the C++ interface (discouraged)

To compile programs against the C++ lib:

CFLAGS += geos-config --cflags LDFLAGS += geos-config --ldflags -lgeos #include <geos.h>

Example usage:

doc/example.cpp contains basic usage examples.

Scripting language bindings

Ruby bindings are fully supported. To build, use the --enable-ruby option when configuring:

./configure ... --enable-ruby

PHP bindings are fully supported. To build, use the --enable-php option when configuring:

./configure ... --enable-php

Since version 3.0, the Python bindings are unsupported. Recommended options:

  1. Become or recruit a new maintainer.
  2. Use Shapely (http://pypi.python.org/pypi/Shapely) with Python versions 2.4 or greater.
  3. Simply call functions from libgeos_c via Python ctypes.

DOCUMENTATION

cd doc; make doxygen-html

http://trac.osgeo.org/geos