[geos-devel] open dataset

Frank Warmerdam warmerdam at pobox.com
Sat Sep 3 01:46:14 EDT 2011

On 11-09-02 10:36 PM, Mohammed Rashad wrote:
> Hi all,
> I am new to GEOS. How to open ant vector data using GEOS


GEOS does not read GIS data.  It is only used to represent and operate
on geometries.  You can instantiate a geometry programatically, adding
points, lines, etc or you can instantiate a geometry from an OGC WKT
(Well Known Text) or WKB (Well Known Binary) format.

A rather abbreviated example can be seen in the C API unit tests
(from geos/tests/unit/capi/GEOSContainsTest.cpp):

#include <geos_c.h>


         GEOSGeometry* geom1_;
         GEOSGeometry* geom2_;

         geom1_ = GEOSGeomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
         geom2_ = GEOSGeomFromWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))");

         char const r1 = GEOSContains(geom1_, geom2_);

If you want to read traditional GIS vector formats you might find the OGR
portion of the GDAL/OGR library useful.  More details on it are available at


It can read GIS formats, and return the geometries of individual features
in WKT or WKB format for subsequent use with GEOS.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/warmerda
and watch the world go round - Rush    | Geospatial Software Developer

More information about the geos-devel mailing list