[geos-commits] r3518 - in trunk: macros swig/ruby

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Nov 24 17:07:19 EST 2011


Author: strk
Date: 2011-11-24 14:07:19 -0800 (Thu, 24 Nov 2011)
New Revision: 3518

Modified:
   trunk/macros/ruby.m4
   trunk/swig/ruby/Makefile.am
   trunk/swig/ruby/geos_wrap.cxx
   trunk/swig/ruby/ruby.i
Log:
Fix to get swig/ruby compiling for ruby 1.9

Patch by Kashif Rasul

Modified: trunk/macros/ruby.m4
===================================================================
--- trunk/macros/ruby.m4	2011-11-06 03:25:10 UTC (rev 3517)
+++ trunk/macros/ruby.m4	2011-11-24 22:07:19 UTC (rev 3518)
@@ -24,9 +24,12 @@
 
 		dnl Get Ruby bin directory
 		RUBY_BIN_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["bindir"]]'`
-		
+
+    dnl Get Ruby site arch
+		RUBY_SITE_ARCH=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["sitearch"]]'`
+
 		dnl Get Ruby include directory
-		RUBY_INCLUDE_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["archdir"]]'`
+		RUBY_INCLUDE_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["rubyhdrdir"]] || Config::CONFIG[["archdir"]]'`
 	
 		dnl Get Ruby lib directory
 		RUBY_LIB_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["libdir"]]'`
@@ -43,6 +46,7 @@
     AC_MSG_NOTICE([Ruby executable is '$RUBY'])
     AC_MSG_NOTICE([Ruby version is '$RUBY_VERSION'])
     AC_MSG_NOTICE([Ruby bin directory is '$RUBY_BIN_DIR'])
+    AC_MSG_NOTICE([Ruby site arch is '$RUBY_SITE_ARCH'])
     AC_MSG_NOTICE([Ruby include directory is '$RUBY_INCLUDE_DIR'])
     AC_MSG_NOTICE([Ruby library directory is '$RUBY_LIB_DIR'])
     AC_MSG_NOTICE([Ruby extension directory is '$RUBY_EXTENSION_DIR'])
@@ -51,6 +55,7 @@
    
     AC_SUBST([RUBY_VERSION])
     AC_SUBST([RUBY_BIN_DIR])
+    AC_SUBST([RUBY_SITE_ARCH])
     AC_SUBST([RUBY_INCLUDE_DIR])
     AC_SUBST([RUBY_LIB_DIR])
     AC_SUBST([RUBY_EXTENSION_DIR])

Modified: trunk/swig/ruby/Makefile.am
===================================================================
--- trunk/swig/ruby/Makefile.am	2011-11-06 03:25:10 UTC (rev 3517)
+++ trunk/swig/ruby/Makefile.am	2011-11-24 22:07:19 UTC (rev 3518)
@@ -17,7 +17,7 @@
 rubyextensiondirdir = $(RUBY_EXTENSION_DIR)
 
 # Setup includes
-INCLUDES = -I$(RUBY_INCLUDE_DIR)
+INCLUDES = -I$(RUBY_INCLUDE_DIR) -I$(RUBY_INCLUDE_DIR)/$(RUBY_SITE_ARCH)
 
 # Build Ruby module as shared library
 rubyextensiondir_LTLIBRARIES = geos.la

Modified: trunk/swig/ruby/geos_wrap.cxx
===================================================================
--- trunk/swig/ruby/geos_wrap.cxx	2011-11-06 03:25:10 UTC (rev 3517)
+++ trunk/swig/ruby/geos_wrap.cxx	2011-11-24 22:07:19 UTC (rev 3518)
@@ -1,7206 +1,9944 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.31
- * 
- * This file is not intended to be easily readable and contains a number of 
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
- * ----------------------------------------------------------------------------- */
-
-#define SWIGRUBY
-
-#ifdef __cplusplus
-template<class T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
-    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
-    operator T&() const { return *tt; }
-    T *operator&() { return tt; }
-private:
-    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
-};
-#endif
-
-/* -----------------------------------------------------------------------------
- *  This section contains generic SWIG labels for method/variable
- *  declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC)
-#   if (__SUNPRO_CC <= 0x560)
-#     define SWIGTEMPLATEDISAMBIGUATOR template
-#   else
-#     define SWIGTEMPLATEDISAMBIGUATOR 
-#   endif
-# else
-#   define SWIGTEMPLATEDISAMBIGUATOR 
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-#   define SWIGINLINE inline
-# else
-#   define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
-#   else
-#     define SWIGUNUSED
-#   endif
-# elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
-# else
-#   define SWIGUNUSED 
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-#   define SWIGUNUSEDPARM(p)
-# else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#  ifndef GCC_HASCLASSVISIBILITY
-#    define GCC_HASCLASSVISIBILITY
-#  endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   if defined(STATIC_LINKED)
-#     define SWIGEXPORT
-#   else
-#     define SWIGEXPORT __declspec(dllexport)
-#   endif
-# else
-#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-#     define SWIGEXPORT __attribute__ ((visibility("default")))
-#   else
-#     define SWIGEXPORT
-#   endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   define SWIGSTDCALL __stdcall
-# else
-#   define SWIGSTDCALL
-# endif 
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* -----------------------------------------------------------------------------
- *  This section contains generic SWIG labels for method/variable
- *  declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC)
-#   if (__SUNPRO_CC <= 0x560)
-#     define SWIGTEMPLATEDISAMBIGUATOR template
-#   else
-#     define SWIGTEMPLATEDISAMBIGUATOR 
-#   endif
-# else
-#   define SWIGTEMPLATEDISAMBIGUATOR 
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-#   define SWIGINLINE inline
-# else
-#   define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
-#   else
-#     define SWIGUNUSED
-#   endif
-# elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
-# else
-#   define SWIGUNUSED 
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-#   define SWIGUNUSEDPARM(p)
-# else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#  ifndef GCC_HASCLASSVISIBILITY
-#    define GCC_HASCLASSVISIBILITY
-#  endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   if defined(STATIC_LINKED)
-#     define SWIGEXPORT
-#   else
-#     define SWIGEXPORT __declspec(dllexport)
-#   endif
-# else
-#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-#     define SWIGEXPORT __attribute__ ((visibility("default")))
-#   else
-#     define SWIGEXPORT
-#   endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   define SWIGSTDCALL __stdcall
-# else
-#   define SWIGSTDCALL
-# endif 
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* -----------------------------------------------------------------------------
- * swigrun.swg
- *
- * This file contains generic CAPI SWIG runtime support for pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* This should only be incremented when either the layout of swig_type_info changes,
-   or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
-
-/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
-#ifdef SWIG_TYPE_TABLE
-# define SWIG_QUOTE_STRING(x) #x
-# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
-# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
-#else
-# define SWIG_TYPE_TABLE_NAME
-#endif
-
-/*
-  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
-  creating a static or dynamic library from the swig runtime code.
-  In 99.9% of the cases, swig just needs to declare them as 'static'.
-  
-  But only do this if is strictly necessary, ie, if you have problems
-  with your compiler or so.
-*/
-
-#ifndef SWIGRUNTIME
-# define SWIGRUNTIME SWIGINTERN
-#endif
-
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-/*  Generic buffer size */
-#ifndef SWIG_BUFFER_SIZE
-# define SWIG_BUFFER_SIZE 1024
-#endif
-
-/* Flags for pointer conversions */
-#define SWIG_POINTER_DISOWN        0x1
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_OWN           0x1
-
-
-/* 
-   Flags/methods for returning states.
-   
-   The swig conversion methods, as ConvertPtr, return and integer 
-   that tells if the conversion was successful or not. And if not,
-   an error code can be returned (see swigerrors.swg for the codes).
-   
-   Use the following macros/flags to set or process the returning
-   states.
-   
-   In old swig versions, you usually write code as:
-
-     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
-       // success code
-     } else {
-       //fail code
-     }
-
-   Now you can be more explicit as:
-
-    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
-    if (SWIG_IsOK(res)) {
-      // success code
-    } else {
-      // fail code
-    }
-
-   that seems to be the same, but now you can also do
-
-    Type *ptr;
-    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
-    if (SWIG_IsOK(res)) {
-      // success code
-      if (SWIG_IsNewObj(res) {
-        ...
-	delete *ptr;
-      } else {
-        ...
-      }
-    } else {
-      // fail code
-    }
-    
-   I.e., now SWIG_ConvertPtr can return new objects and you can
-   identify the case and take care of the deallocation. Of course that
-   requires also to SWIG_ConvertPtr to return new result values, as
-
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {			       
-          if (<need new object>) {		       
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;		       
-          } else {				       
-            *ptr = <ptr to old object>;	       
-            return SWIG_OLDOBJ;		       
-          } 				       
-        } else {				       
-          return SWIG_BADOBJ;		       
-        }					       
-      }
-
-   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
-   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
-   swig errors code.
-
-   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
-
-       int food(double)
-       int fooi(int);
-
-   and you call
- 
-      food(1)   // cast rank '1'  (1 -> 1.0)
-      fooi(1)   // cast rank '0'
-
-   just use the SWIG_AddCast()/SWIG_CheckState()
-
-
- */
-#define SWIG_OK                    (0) 
-#define SWIG_ERROR                 (-1)
-#define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
-
-/* The CastRankLimit says how many bits are used for the cast rank */
-#define SWIG_CASTRANKLIMIT         (1 << 8)
-/* The NewMask denotes the object was created (using new/malloc) */
-#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */
-#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
-/* Simple returning values */
-#define SWIG_BADOBJ                (SWIG_ERROR)
-#define SWIG_OLDOBJ                (SWIG_OK)
-#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
-#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
-/* Check, add and del mask methods */
-#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
-#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
-#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
-#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
-#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
-#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
-
-
-/* Cast-Rank Mode */
-#if defined(SWIG_CASTRANK_MODE)
-#  ifndef SWIG_TypeRank
-#    define SWIG_TypeRank             unsigned long
-#  endif
-#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
-#    define SWIG_MAXCASTRANK          (2)
-#  endif
-#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
-#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
-  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
-}
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
-}
-#else /* no cast-rank mode */
-#  define SWIG_AddCast
-#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
-#endif
-
-
-
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *(*swig_converter_func)(void *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
-
-/* Structure to store inforomation on one type */
-typedef struct swig_type_info {
-  const char             *name;			/* mangled name of this type */
-  const char             *str;			/* human readable name of this type */
-  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
-  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
-  void                   *clientdata;		/* language specific type data */
-  int                    owndata;		/* flag if the structure owns the clientdata */
-} swig_type_info;
-
-/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
-  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
-  swig_converter_func     converter;		/* function to cast the void pointers */
-  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
-  struct swig_cast_info  *prev;			/* pointer to the previous cast */
-} swig_cast_info;
-
-/* Structure used to store module information
- * Each module generates one structure like this, and the runtime collects
- * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
-  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
-  size_t                 size;		        /* Number of types in this module */
-  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
-  swig_type_info         **type_initial;	/* Array of initially generated type structures */
-  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
-  void                    *clientdata;		/* Language specific module data */
-} swig_module_info;
-
-/* 
-  Compare two type names skipping the space characters, therefore
-  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
-
-  Return 0 when the two name types are equivalent, as in
-  strncmp, but skipping ' '.
-*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
-		  const char *f2, const char *l2) {
-  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
-    while ((*f1 == ' ') && (f1 != l1)) ++f1;
-    while ((*f2 == ' ') && (f2 != l2)) ++f2;
-    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
-  }
-  return (l1 - f1) - (l2 - f2);
-}
-
-/*
-  Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
-*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
-
-/*
-  Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
-*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
-
-
-/* think of this as a c++ template<> or a scheme macro */
-#define SWIG_TypeCheck_Template(comparison, ty)         \
-  if (ty) {                                             \
-    swig_cast_info *iter = ty->cast;                    \
-    while (iter) {                                      \
-      if (comparison) {                                 \
-        if (iter == ty->cast) return iter;              \
-        /* Move iter to the top of the linked list */   \
-        iter->prev->next = iter->next;                  \
-        if (iter->next)                                 \
-          iter->next->prev = iter->prev;                \
-        iter->next = ty->cast;                          \
-        iter->prev = 0;                                 \
-        if (ty->cast) ty->cast->prev = iter;            \
-        ty->cast = iter;                                \
-        return iter;                                    \
-      }                                                 \
-      iter = iter->next;                                \
-    }                                                   \
-  }                                                     \
-  return 0
-
-/*
-  Check the typename
-*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
-
-/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
-  SWIG_TypeCheck_Template(iter->type == from, into);
-}
-
-/*
-  Cast a pointer up an inheritance hierarchy
-*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
-}
-
-/* 
-   Dynamic pointer casting. Down an inheritance hierarchy
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
-  swig_type_info *lastty = ty;
-  if (!ty || !ty->dcast) return ty;
-  while (ty && (ty->dcast)) {
-    ty = (*ty->dcast)(ptr);
-    if (ty) lastty = ty;
-  }
-  return lastty;
-}
-
-/*
-  Return the name associated with this type
-*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
-  return ty->name;
-}
-
-/*
-  Return the pretty name associated with this type,
-  that is an unmangled type name in a form presentable to the user.
-*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
-  /* The "str" field contains the equivalent pretty names of the
-     type, separated by vertical-bar characters.  We choose
-     to print the last name, as it is often (?) the most
-     specific. */
-  if (!type) return NULL;
-  if (type->str != NULL) {
-    const char *last_name = type->str;
-    const char *s;
-    for (s = type->str; *s; s++)
-      if (*s == '|') last_name = s+1;
-    return last_name;
-  }
-  else
-    return type->name;
-}
-
-/* 
-   Set the clientdata field for a type
-*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
-  swig_cast_info *cast = ti->cast;
-  /* if (ti->clientdata == clientdata) return; */
-  ti->clientdata = clientdata;
-  
-  while (cast) {
-    if (!cast->converter) {
-      swig_type_info *tc = cast->type;
-      if (!tc->clientdata) {
-	SWIG_TypeClientData(tc, clientdata);
-      }
-    }    
-    cast = cast->next;
-  }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
-  SWIG_TypeClientData(ti, clientdata);
-  ti->owndata = 1;
-}
-  
-/*
-  Search for a swig_type_info structure only by mangled name
-  Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
-  Note: if start == end at the beginning of the function, we go all the way around
-  the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
-		            const char *name) {
-  swig_module_info *iter = start;
-  do {
-    if (iter->size) {
-      register size_t l = 0;
-      register size_t r = iter->size - 1;
-      do {
-	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
-	const char *iname = iter->types[i]->name;
-	if (iname) {
-	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
-	    return iter->types[i];
-	  } else if (compare < 0) {
-	    if (i) {
-	      r = i - 1;
-	    } else {
-	      break;
-	    }
-	  } else if (compare > 0) {
-	    l = i + 1;
-	  }
-	} else {
-	  break; /* should never happen */
-	}
-      } while (l <= r);
-    }
-    iter = iter->next;
-  } while (iter != end);
-  return 0;
-}
-
-/*
-  Search for a swig_type_info structure for either a mangled name or a human readable name.
-  It first searches the mangled names of the types, which is a O(log #types)
-  If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
-  Note: if start == end at the beginning of the function, we go all the way around
-  the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
-		     const char *name) {
-  /* STEP 1: Search the name field using binary search */
-  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-  if (ret) {
-    return ret;
-  } else {
-    /* STEP 2: If the type hasn't been found, do a complete search
-       of the str field (the human readable name) */
-    swig_module_info *iter = start;
-    do {
-      register size_t i = 0;
-      for (; i < iter->size; ++i) {
-	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-	  return iter->types[i];
-      }
-      iter = iter->next;
-    } while (iter != end);
-  }
-  
-  /* neither found a match */
-  return 0;
-}
-
-/* 
-   Pack binary data into a string
-*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
-  static const char hex[17] = "0123456789abcdef";
-  register const unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu =  u + sz;
-  for (; u != eu; ++u) {
-    register unsigned char uu = *u;
-    *(c++) = hex[(uu & 0xf0) >> 4];
-    *(c++) = hex[uu & 0xf];
-  }
-  return c;
-}
-
-/* 
-   Unpack binary data from a string
-*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-  register unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu = u + sz;
-  for (; u != eu; ++u) {
-    register char d = *(c++);
-    register unsigned char uu;
-    if ((d >= '0') && (d <= '9'))
-      uu = ((d - '0') << 4);
-    else if ((d >= 'a') && (d <= 'f'))
-      uu = ((d - ('a'-10)) << 4);
-    else 
-      return (char *) 0;
-    d = *(c++);
-    if ((d >= '0') && (d <= '9'))
-      uu |= (d - '0');
-    else if ((d >= 'a') && (d <= 'f'))
-      uu |= (d - ('a'-10));
-    else 
-      return (char *) 0;
-    *u = uu;
-  }
-  return c;
-}
-
-/* 
-   Pack 'void *' into a string buffer.
-*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-  char *r = buff;
-  if ((2*sizeof(void *) + 2) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,&ptr,sizeof(void *));
-  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
-  strcpy(r,name);
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      *ptr = (void *) 0;
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
-
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-  char *r = buff;
-  size_t lname = (name ? strlen(name) : 0);
-  if ((2*sz + 2 + lname) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  if (lname) {
-    strncpy(r,name,lname+1);
-  } else {
-    *r = 0;
-  }
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      memset(ptr,0,sz);
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sz);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
-#define  SWIG_SystemError    	   -10
-#define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
-#define  SWIG_NullReferenceError   -13
-
-
-
-#include <ruby.h>
-
-/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
-#ifndef NUM2LL
-#define NUM2LL(x) NUM2LONG((x))
-#endif
-#ifndef LL2NUM
-#define LL2NUM(x) INT2NUM((long) (x))
-#endif
-#ifndef ULL2NUM
-#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
-#endif
-
-/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
-#ifndef NUM2ULL
-#ifdef HAVE_LONG_LONG
-#define NUM2ULL(x) rb_num2ull((x))
-#else
-#define NUM2ULL(x) NUM2ULONG(x)
-#endif
-#endif
-
-/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
-/* Define these for older versions so we can just write code the new way */
-#ifndef RSTRING_LEN
-# define RSTRING_LEN(x) RSTRING(x)->len
-#endif
-#ifndef RSTRING_PTR
-# define RSTRING_PTR(x) RSTRING(x)->ptr
-#endif
-#ifndef RARRAY_LEN
-# define RARRAY_LEN(x) RARRAY(x)->len
-#endif
-#ifndef RARRAY_PTR
-# define RARRAY_PTR(x) RARRAY(x)->ptr
-#endif
-
-/*
- * Need to be very careful about how these macros are defined, especially
- * when compiling C++ code or C code with an ANSI C compiler.
- *
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
- * a Ruby method so that it can be passed as an argument to API functions
- * like rb_define_method() and rb_define_singleton_method().
- *
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
- * can be passed as an argument to API functions like Data_Wrap_Struct()
- * and Data_Make_Struct().
- */
- 
-#ifdef __cplusplus
-#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
-#    define PROTECTFUNC(f) ((VALUE (*)()) f)
-#    define VALUEFUNC(f) ((VALUE (*)()) f)
-#    define VOIDFUNC(f)  ((void (*)()) f)
-#  else
-#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
-#      define PROTECTFUNC(f) ((VALUE (*)()) f)
-#      define VALUEFUNC(f) ((VALUE (*)()) f)
-#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
-#    else /* These definitions should work for Ruby 1.7+ */
-#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
-#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
-#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
-#    endif
-#  endif
-#else
-#  define VALUEFUNC(f) (f)
-#  define VOIDFUNC(f) (f)
-#endif
-
-/* Don't use for expressions have side effect */
-#ifndef RB_STRING_VALUE
-#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
-#endif
-#ifndef StringValue
-#define StringValue(s) RB_STRING_VALUE(s)
-#endif
-#ifndef StringValuePtr
-#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
-#endif
-#ifndef StringValueLen
-#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
-#endif
-#ifndef SafeStringValue
-#define SafeStringValue(v) do {\
-    StringValue(v);\
-    rb_check_safe_str(v);\
-} while (0)
-#endif
-
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
-#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
-#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * error manipulation
- * ----------------------------------------------------------------------------- */
-
-
-/* Define some additional error types */
-#define SWIG_ObjectPreviouslyDeletedError  -100
-
-
-/* Define custom exceptions for errors that do not map to existing Ruby
-   exceptions.  Note this only works for C++ since a global cannot be
-   initialized by a funtion in C.  For C, fallback to rb_eRuntimeError.*/
-
-SWIGINTERN VALUE 
-getNullReferenceError(void) {
-  static int init = 0;
-  static VALUE rb_eNullReferenceError ;
-  if (!init) {
-    init = 1;
-    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
-  }
-  return rb_eNullReferenceError;
-} 
-
-SWIGINTERN VALUE 
-getObjectPreviouslyDeletedError(void) {
-  static int init = 0;
-  static VALUE rb_eObjectPreviouslyDeleted ;
-  if (!init) {
-    init = 1;
-    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
-  }
-  return rb_eObjectPreviouslyDeleted;
-} 
-
-
-SWIGINTERN VALUE
-SWIG_Ruby_ErrorType(int SWIG_code) {
-  VALUE type;
-  switch (SWIG_code) {
-  case SWIG_MemoryError:
-    type = rb_eNoMemError;
-    break;
-  case SWIG_IOError:
-    type = rb_eIOError;
-    break;
-  case SWIG_RuntimeError:
-    type = rb_eRuntimeError;
-    break;
-  case SWIG_IndexError:
-    type = rb_eIndexError;
-    break;
-  case SWIG_TypeError:
-    type = rb_eTypeError;
-    break;
-  case SWIG_DivisionByZero:
-    type = rb_eZeroDivError;
-    break;
-  case SWIG_OverflowError:
-    type = rb_eRangeError;
-    break;
-  case SWIG_SyntaxError:
-    type = rb_eSyntaxError;
-    break;
-  case SWIG_ValueError:
-    type = rb_eArgError;
-    break;
-  case SWIG_SystemError:
-    type = rb_eFatal;
-    break;
-  case SWIG_AttributeError:
-    type = rb_eRuntimeError;
-    break;
-  case SWIG_NullReferenceError:
-    type = getNullReferenceError();
-    break;
-  case SWIG_ObjectPreviouslyDeletedError:
-    type = getObjectPreviouslyDeletedError();
-    break;
-  case SWIG_UnknownError:
-    type = rb_eRuntimeError;
-    break;
-  default:
-    type = rb_eRuntimeError;
-  }
-  return type;
-}
-
-
-
-
-/* -----------------------------------------------------------------------------
- * See the LICENSE file for information on copyright, usage and redistribution
- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
- *
- * rubytracking.swg
- *
- * This file contains support for tracking mappings from 
- * Ruby objects to C++ objects.  This functionality is needed
- * to implement mark functions for Ruby's mark and sweep
- * garbage collector.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Global Ruby hash table to store Trackings from C/C++
-   structs to Ruby Objects. */
-static VALUE swig_ruby_trackings;
-
-/* Global variable that stores a reference to the ruby
-   hash table delete function. */
-static ID swig_ruby_hash_delete = 0;
-
-/* Setup a Ruby hash table to store Trackings */
-SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
-  /* Create a ruby hash table to store Trackings from C++ 
-     objects to Ruby objects.  Also make sure to tell
-     the garabage collector about the hash table. */
-  swig_ruby_trackings = rb_hash_new();
-  rb_gc_register_address(&swig_ruby_trackings);
-  
-  /* Now store a reference to the hash table delete function
-     so that we only have to look it up once.*/
-  swig_ruby_hash_delete = rb_intern("delete");
-}
-
-/* Get a Ruby number to reference a pointer */
-SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
-  /* We cast the pointer to an unsigned long
-     and then store a reference to it using
-     a Ruby number object. */
-
-  /* Convert the pointer to a Ruby number */
-  unsigned long value = (unsigned long) ptr;
-  return LONG2NUM(value);
-}
-
-/* Get a Ruby number to reference an object */
-SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
-  /* We cast the object to an unsigned long
-     and then store a reference to it using
-     a Ruby number object. */
-
-  /* Convert the Object to a Ruby number */
-  unsigned long value = (unsigned long) object;
-  return LONG2NUM(value);
-}
-
-/* Get a Ruby object from a previously stored reference */
-SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
-  /* The provided Ruby number object is a reference
-     to the Ruby object we want.*/
-
-  /* First convert the Ruby number to a C number */
-  unsigned long value = NUM2LONG(reference);
-  return (VALUE) value;
-}
-
-/* Add a Tracking from a C/C++ struct to a Ruby object */
-SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
-  /* In a Ruby hash table we store the pointer and
-     the associated Ruby object.  The trick here is
-     that we cannot store the Ruby object directly - if
-     we do then it cannot be garbage collected.  So
-     instead we typecast it as a unsigned long and
-     convert it to a Ruby number object.*/
-
-  /* Get a reference to the pointer as a Ruby number */
-  VALUE key = SWIG_RubyPtrToReference(ptr);
-
-  /* Get a reference to the Ruby object as a Ruby number */
-  VALUE value = SWIG_RubyObjectToReference(object);
-
-  /* Store the mapping to the global hash table. */
-  rb_hash_aset(swig_ruby_trackings, key, value);
-}
-
-/* Get the Ruby object that owns the specified C/C++ struct */
-SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
-  /* Get a reference to the pointer as a Ruby number */
-  VALUE key = SWIG_RubyPtrToReference(ptr);
-
-  /* Now lookup the value stored in the global hash table */
-  VALUE value = rb_hash_aref(swig_ruby_trackings, key);
-	
-  if (value == Qnil) {
-    /* No object exists - return nil. */
-    return Qnil;
-  }
-  else {
-    /* Convert this value to Ruby object */
-    return SWIG_RubyReferenceToObject(value);
-  }
-}
-
-/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
-   is very important to remove objects once they are destroyed
-   since the same memory address may be reused later to create
-   a new object. */
-SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
-  /* Get a reference to the pointer as a Ruby number */
-  VALUE key = SWIG_RubyPtrToReference(ptr);
-
-  /* Delete the object from the hash table by calling Ruby's
-     do this we need to call the Hash.delete method.*/
-  rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
-}
-
-/* This is a helper method that unlinks a Ruby object from its
-   underlying C++ object.  This is needed if the lifetime of the
-   Ruby object is longer than the C++ object */
-SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
-  VALUE object = SWIG_RubyInstanceFor(ptr);
-
-  if (object != Qnil) {
-    DATA_PTR(object) = 0;
-  }
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-/* -----------------------------------------------------------------------------
- * Ruby API portion that goes into the runtime
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-SWIGINTERN VALUE
-SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
-  if (NIL_P(target)) {
-    target = o;
-  } else {
-    if (TYPE(target) != T_ARRAY) {
-      VALUE o2 = target;
-      target = rb_ary_new();
-      rb_ary_push(target, o2);
-    }
-    rb_ary_push(target, o);
-  }
-  return target;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * See the LICENSE file for information on copyright, usage and redistribution
- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
- *
- * rubyrun.swg
- *
- * This file contains the runtime support for Ruby modules
- * and includes code for managing global variables and pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* For backward compatibility only */
-#define SWIG_POINTER_EXCEPTION  0
-
-/* for raw pointers */
-#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
-#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
-#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
-#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
-#define swig_owntype                                    ruby_owntype
-
-/* for raw packed data */
-#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
-#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)
-
-/* for class or struct pointers */
-#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
-
-/* for C or C++ function pointers */
-#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
-#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
-
-/* for C++ member pointers, ie, member methods */
-#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
-#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)
-
-
-/* Runtime API */
-
-#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule()	
-#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)
-
-
-/* Error manipulation */
-
-#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
-#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), msg)
-#define SWIG_fail                        		goto fail				 
-
-
-/* Ruby-specific SWIG API */
-
-#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
-#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
-#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
-#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
-#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  
-
-
-/* -----------------------------------------------------------------------------
- * pointers/data manipulation
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* cc-mode */
-#endif
-#endif
-
-typedef struct {
-  VALUE klass;
-  VALUE mImpl;
-  void  (*mark)(void *);
-  void  (*destroy)(void *);
-  int trackObjects;
-} swig_class;
-
-
-static VALUE _mSWIG = Qnil;
-static VALUE _cSWIG_Pointer = Qnil;
-static VALUE swig_runtime_data_type_pointer = Qnil;
-
-SWIGRUNTIME VALUE 
-getExceptionClass(void) {
-  static int init = 0;
-  static VALUE rubyExceptionClass ;
-  if (!init) {
-    init = 1;
-    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
-  }
-  return rubyExceptionClass;
-} 
-
-/* This code checks to see if the Ruby object being raised as part
-   of an exception inherits from the Ruby class Exception.  If so,
-   the object is simply returned.  If not, then a new Ruby exception
-   object is created and that will be returned to Ruby.*/
-SWIGRUNTIME VALUE
-SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
-  VALUE exceptionClass = getExceptionClass();
-  if (rb_obj_is_kind_of(obj, exceptionClass)) {
-    return obj;
-  }  else {
-    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
-  }
-}
-
-/* Initialize Ruby runtime support */
-SWIGRUNTIME void
-SWIG_Ruby_InitRuntime(void)
-{
-  if (_mSWIG == Qnil) {
-    _mSWIG = rb_define_module("SWIG");
-  }
-}
-
-/* Define Ruby class for C type */
-SWIGRUNTIME void
-SWIG_Ruby_define_class(swig_type_info *type)
-{
-  VALUE klass;
-  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
-  sprintf(klass_name, "TYPE%s", type->name);
-  if (NIL_P(_cSWIG_Pointer)) {
-    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
-    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
-  }
-  klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
-  free((void *) klass_name);
-}
-
-/* Create a new pointer object */
-SWIGRUNTIME VALUE
-SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
-{
-  int own =  flags & SWIG_POINTER_OWN; 
-  
-  char *klass_name;
-  swig_class *sklass;
-  VALUE klass;
-  VALUE obj;
-  
-  if (!ptr)
-    return Qnil;
-  
-  if (type->clientdata) {
-    sklass = (swig_class *) type->clientdata;
-		
-    /* Are we tracking this class and have we already returned this Ruby object? */
-    if (sklass->trackObjects) {
-      obj = SWIG_RubyInstanceFor(ptr);
-      
-      /* Check the object's type and make sure it has the correct type.
-        It might not in cases where methods do things like 
-        downcast methods. */
-      if (obj != Qnil) {
-        VALUE value = rb_iv_get(obj, "__swigtype__");
-        char* type_name = RSTRING_PTR(value);
-				
-        if (strcmp(type->name, type_name) == 0) {
-          return obj;
-        }
-      }
-    }
-
-    /* Create a new Ruby object */
-    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr);
-
-    /* If tracking is on for this class then track this object. */
-    if (sklass->trackObjects) {
-      SWIG_RubyAddTracking(ptr, obj);
-    }
-  } else {
-    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
-    sprintf(klass_name, "TYPE%s", type->name);
-    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
-    free((void *) klass_name);
-    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
-  }
-  rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
-  
-  return obj;
-}
-
-/* Create a new class instance (always owned) */
-SWIGRUNTIME VALUE
-SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
-{
-  VALUE obj;
-  swig_class *sklass = (swig_class *) type->clientdata;
-  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
-  rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
-  return obj;
-}
-
-/* Get type mangle from class name */
-SWIGRUNTIMEINLINE char *
-SWIG_Ruby_MangleStr(VALUE obj)
-{
-  VALUE stype = rb_iv_get(obj, "__swigtype__");
-  return StringValuePtr(stype);
-}
-
-/* Acquire a pointer value */
-typedef void (*ruby_owntype)(void*);
-
-SWIGRUNTIME ruby_owntype
-SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
-  if (obj) {
-    ruby_owntype oldown = RDATA(obj)->dfree;
-    RDATA(obj)->dfree = own;
-    return oldown;
-  } else {
-    return 0;
-  }
-}
-
-/* Convert a pointer value */
-SWIGRUNTIME int
-SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
-{
-  char *c;
-  swig_cast_info *tc;
-  void *vptr = 0;
-
-  /* Grab the pointer */
-  if (NIL_P(obj)) {
-    *ptr = 0;
-    return SWIG_OK;
-  } else {
-    if (TYPE(obj) != T_DATA) {
-      return SWIG_ERROR;
-    }
-    Data_Get_Struct(obj, void, vptr);
-  }
-  
-  if (own) *own = RDATA(obj)->dfree;
-    
-  /* Check to see if the input object is giving up ownership
-     of the underlying C struct or C++ object.  If so then we
-     need to reset the destructor since the Ruby object no 
-     longer owns the underlying C++ object.*/ 
-  if (flags & SWIG_POINTER_DISOWN) {
-    /* Is tracking on for this class? */
-    int track = 0;
-    if (ty && ty->clientdata) {
-      swig_class *sklass = (swig_class *) ty->clientdata;
-      track = sklass->trackObjects;
-    }
-		
-    if (track) {
-      /* We are tracking objects for this class.  Thus we change the destructor
-       * to SWIG_RubyRemoveTracking.  This allows us to
-       * remove the mapping from the C++ to Ruby object
-       * when the Ruby object is garbage collected.  If we don't
-       * do this, then it is possible we will return a reference 
-       * to a Ruby object that no longer exists thereby crashing Ruby. */
-      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
-    } else {    
-      RDATA(obj)->dfree = 0;
-    }
-  }
-
-  /* Do type-checking if type info was provided */
-  if (ty) {
-    if (ty->clientdata) {
-      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
-        if (vptr == 0) {
-          /* The object has already been deleted */
-          return SWIG_ObjectPreviouslyDeletedError;
-        }
-        *ptr = vptr;
-        return SWIG_OK;
-      }
-    }
-    if ((c = SWIG_MangleStr(obj)) == NULL) {
-      return SWIG_ERROR;
-    }
-    tc = SWIG_TypeCheck(c, ty);
-    if (!tc) {
-      return SWIG_ERROR;
-    }
-    *ptr = SWIG_TypeCast(tc, vptr);
-  } else {
-    *ptr = vptr;
-  }
-  
-  return SWIG_OK;
-}
-
-/* Check convert */
-SWIGRUNTIMEINLINE int
-SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
-{
-  char *c = SWIG_MangleStr(obj);
-  if (!c) return 0;
-  return SWIG_TypeCheck(c,ty) != 0;
-}
-
-SWIGRUNTIME VALUE
-SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
-  char result[1024];
-  char *r = result;
-  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r, ptr, sz);
-  strcpy(r, type->name);
-  return rb_str_new2(result);
-}
-
-/* Convert a packed value value */
-SWIGRUNTIME int
-SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
-  swig_cast_info *tc;
-  const char  *c;
-
-  if (TYPE(obj) != T_STRING) goto type_error;
-  c = StringValuePtr(obj);
-  /* Pointer values must start with leading underscore */
-  if (*c != '_') goto type_error;
-  c++;
-  c = SWIG_UnpackData(c, ptr, sz);
-  if (ty) {
-    tc = SWIG_TypeCheck(c, ty);
-    if (!tc) goto type_error;
-  }
-  return SWIG_OK;
-
- type_error:
-  return SWIG_ERROR;
-}
-
-SWIGRUNTIME swig_module_info *
-SWIG_Ruby_GetModule(void)
-{
-  VALUE pointer;
-  swig_module_info *ret = 0;
-  VALUE verbose = rb_gv_get("VERBOSE");
-
- /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
-  rb_gv_set("VERBOSE", Qfalse);
-  
-  /* first check if pointer already created */
-  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
-  if (pointer != Qnil) {
-    Data_Get_Struct(pointer, swig_module_info, ret);
-  }
-
-  /* reinstate warnings */
-  rb_gv_set("VERBOSE", verbose);
-  return ret;
-}
-
-SWIGRUNTIME void 
-SWIG_Ruby_SetModule(swig_module_info *pointer)
-{
-  /* register a new class */
-  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
-  /* create and store the structure pointer to a global variable */
-  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
-  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
-}
-
-#ifdef __cplusplus
-#if 0
-{ /* cc-mode */
-#endif
-}
-#endif
-
-
-
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
-
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
-
-
-
-  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) 
-
-
-/* -------- TYPES TABLE (BEGIN) -------- */
-
-#define SWIGTYPE_p_GeosCoordinateSequence swig_types[0]
-#define SWIGTYPE_p_GeosGeometry swig_types[1]
-#define SWIGTYPE_p_GeosGeometryCollection swig_types[2]
-#define SWIGTYPE_p_GeosLineString swig_types[3]
-#define SWIGTYPE_p_GeosLinearRing swig_types[4]
-#define SWIGTYPE_p_GeosMultiLineString swig_types[5]
-#define SWIGTYPE_p_GeosMultiLinearRing swig_types[6]
-#define SWIGTYPE_p_GeosMultiPoint swig_types[7]
-#define SWIGTYPE_p_GeosMultiPolygon swig_types[8]
-#define SWIGTYPE_p_GeosPoint swig_types[9]
-#define SWIGTYPE_p_GeosPolygon swig_types[10]
-#define SWIGTYPE_p_GeosWkbReader swig_types[11]
-#define SWIGTYPE_p_GeosWkbWriter swig_types[12]
-#define SWIGTYPE_p_GeosWktReader swig_types[13]
-#define SWIGTYPE_p_GeosWktWriter swig_types[14]
-#define SWIGTYPE_p_char swig_types[15]
-#define SWIGTYPE_p_p_GeosLinearRing swig_types[16]
-#define SWIGTYPE_p_size_t swig_types[17]
-#define SWIGTYPE_p_unsigned_char swig_types[18]
-static swig_type_info *swig_types[20];
-static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
-#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
-#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
-
-/* -------- TYPES TABLE (END) -------- */
-
-#define SWIG_init    Init_geos
-#define SWIG_name    "Geos"
-
-static VALUE mGeos;
-
-#define SWIGVERSION 0x010331 
-#define SWIG_VERSION SWIGVERSION
-
-
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
-
-
-#include <stdexcept>
-
-
-#include <string>
-
-
-#include <stdexcept>
-
-
-#include <string>
-
-#define SWIG_FLOAT_P(x) ((TYPE(x) == T_FLOAT) || FIXNUM_P(x))
-
-bool SWIG_BOOL_P(VALUE) {
-    // dummy test, RTEST should take care of everything
-    return true;
-}
-bool SWIG_RB2BOOL(VALUE x) {
-    return RTEST(x);
-}
-VALUE SWIG_BOOL2RB(bool b) {
-    return b ? Qtrue : Qfalse;
-}
-double SWIG_NUM2DBL(VALUE x) {
-    return (FIXNUM_P(x) ? FIX2INT(x) : NUM2DBL(x));
-}
-bool SWIG_STRING_P(VALUE x) {
-    return TYPE(x) == T_STRING;
-}
-std::string SWIG_RB2STR(VALUE x) {
-    return std::string(RSTRING_PTR(x), RSTRING_LEN(x));
-}
-VALUE SWIG_STR2RB(const std::string& s) {
-    return rb_str_new(s.data(), s.size());
-}
-
-
-#include <vector>
-#include <algorithm>
-#include <stdexcept>
-
- 
-#include "geos_c.h"
-/* Needed for va_start, etc. */
-#include <stdarg.h>
-
-
-#include <limits.h>
-#ifndef LLONG_MIN
-# define LLONG_MIN	LONG_LONG_MIN
-#endif
-#ifndef LLONG_MAX
-# define LLONG_MAX	LONG_LONG_MAX
-#endif
-#ifndef ULLONG_MAX
-# define ULLONG_MAX	ULONG_LONG_MAX
-#endif
-
-
-  #define SWIG_From_long   LONG2NUM 
-
-
-SWIGINTERNINLINE VALUE
-SWIG_From_int  (int value)
-{    
-  return SWIG_From_long  (value);
-}
-
-
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
-{
-  static int init = 0;
-  static swig_type_info* info = 0;
-  if (!init) {
-    info = SWIG_TypeQuery("_p_char");
-    init = 1;
-  }
-  return info;
-}
-
-
-SWIGINTERNINLINE VALUE 
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
-{
-  if (carray) {
-    if (size > LONG_MAX) {
-      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-      return pchar_descriptor ? 
-	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
-    } else {
-      return rb_str_new(carray, static_cast< long >(size));
-    }
-  } else {
-    return Qnil;
-  }
-}
-
-
-SWIGINTERNINLINE VALUE 
-SWIG_FromCharPtr(const char *cptr)
-{ 
-  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
-}
-
-
-    static const int DEFAULT_QUADRANT_SEGMENTS=8;
-
-
-
-/* This is not thread safe ! */
-static const int MESSAGE_SIZE = 1000;
-static char message[MESSAGE_SIZE];
-
-void noticeHandler(const char *fmt, ...)
-{
-    va_list args;
-    va_start(args, fmt);
-    vsnprintf(message, sizeof(message) - 1, fmt, args);
-    va_end(args);
-}
-
-void errorHandler(const char *fmt, ...)
-{
-    va_list args;
-    va_start(args, fmt);
-    vsnprintf(message, sizeof(message) - 1, fmt, args);
-    va_end(args);
-}
-
-
-typedef void GeosCoordinateSequence;
-
-void checkCoordSeqBounds(const GEOSCoordSeq coordSeq, const size_t index)
-{
-    unsigned int size = 0;
-    GEOSCoordSeq_getSize(coordSeq, &size);
-
-    if (index < 0 || index >= size)
-        throw std::runtime_error("Index out of bounds");
-}
-
-
-SWIGINTERN VALUE
-SWIG_ruby_failed(void)
-{
-  return Qnil;
-} 
-
-
-/*@SWIG:%ruby_aux_method@*/
-SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
-{
-  VALUE obj = args[0];
-  VALUE type = TYPE(obj);
-  unsigned long *res = (unsigned long *)(args[1]);
-  *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
-  return obj;
-}
-/*@SWIG@*/
-
-SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) 
-{
-  VALUE type = TYPE(obj);
-  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
-    unsigned long v;
-    VALUE a[2];
-    a[0] = obj;
-    a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
-      if (val) *val = v;
-      return SWIG_OK;
-    }
-  }
-  return SWIG_TypeError;
-}
-
-
-SWIGINTERNINLINE int
-SWIG_AsVal_size_t (VALUE obj, size_t *val)
-{
-  unsigned long v;
-  int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
-  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
-  return res;
-}
-
-SWIGINTERN GeosCoordinateSequence *new_GeosCoordinateSequence(size_t size,size_t dims){
-        return (GeosCoordinateSequence*) GEOSCoordSeq_create(size, dims);
-    }
-SWIGINTERN GeosCoordinateSequence *GeosCoordinateSequence_clone(GeosCoordinateSequence *self){
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        return (GeosCoordinateSequence*) GEOSCoordSeq_clone(coords);
-    }
-
-/*@SWIG:%ruby_aux_method@*/
-SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
-{
-  VALUE obj = args[0];
-  VALUE type = TYPE(obj);
-  double *res = (double *)(args[1]);
-  *res = (type == T_FLOAT ? NUM2DBL(obj) : (type == T_FIXNUM ? (double) FIX2INT(obj) : rb_big2dbl(obj)));
-  return obj;
-}
-/*@SWIG@*/
-
-SWIGINTERN int
-SWIG_AsVal_double (VALUE obj, double *val)
-{
-  VALUE type = TYPE(obj);
-  if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
-    double v;
-    VALUE a[2];
-    a[0] = obj;
-    a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
-      if (val) *val = v;
-      return SWIG_OK;
-    }
-  }
-  return SWIG_TypeError;
-}
-
-SWIGINTERN int GeosCoordinateSequence_setX(GeosCoordinateSequence *self,size_t idx,double val){
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        return GEOSCoordSeq_setX(coords, idx, val);
-    }
-SWIGINTERN int GeosCoordinateSequence_setY(GeosCoordinateSequence *self,size_t idx,double val){
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        return GEOSCoordSeq_setY(coords, idx, val);
-    }
-SWIGINTERN int GeosCoordinateSequence_setZ(GeosCoordinateSequence *self,size_t idx,double val){
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        return GEOSCoordSeq_setZ(coords, idx, val);
-    }
-SWIGINTERN int GeosCoordinateSequence_setOrdinate(GeosCoordinateSequence *self,size_t idx,size_t dim,double val){
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        return GEOSCoordSeq_setOrdinate(coords, idx, dim, val);
-    }
-SWIGINTERN double GeosCoordinateSequence_getX(GeosCoordinateSequence *self,size_t idx){
-        double result;
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        GEOSCoordSeq_getX(coords, idx, &result);
-        return result;
-    }
-
-  #define SWIG_From_double   rb_float_new 
-
-SWIGINTERN double GeosCoordinateSequence_getY(GeosCoordinateSequence *self,size_t idx){
-        double result;
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        GEOSCoordSeq_getY(coords, idx, &result);
-        return result;
-    }
-SWIGINTERN double GeosCoordinateSequence_getZ(GeosCoordinateSequence *self,size_t idx){
-        double result;
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        GEOSCoordSeq_getZ(coords, idx, &result);
-        return result;
-    }
-SWIGINTERN double GeosCoordinateSequence_getOrdinate(GeosCoordinateSequence *self,size_t idx,size_t dim){
-        double result;
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        checkCoordSeqBounds(coords, idx);
-        GEOSCoordSeq_getOrdinate(coords, idx, dim, &result);
-        return result;
-    }
-SWIGINTERN unsigned int GeosCoordinateSequence_getSize(GeosCoordinateSequence *self){
-        unsigned int result;
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        GEOSCoordSeq_getSize(coords, &result);
-        return result;
-    }
-
-SWIGINTERNINLINE VALUE
-SWIG_From_unsigned_SS_long  (unsigned long value)
-{
-  return ULONG2NUM(value); 
-}
-
-
-SWIGINTERNINLINE VALUE
-SWIG_From_unsigned_SS_int  (unsigned int value)
-{    
-  return SWIG_From_unsigned_SS_long  (value);
-}
-
-SWIGINTERN unsigned int GeosCoordinateSequence_getDimensions(GeosCoordinateSequence *self){
-        unsigned int result;
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        GEOSCoordSeq_getDimensions(coords, &result);
-        return result;
-    }
-
-typedef void GeosGeometry;
-typedef void GeosPoint;
-typedef void GeosLineString;
-typedef void GeosLinearRing;
-typedef void GeosPolygon;
-typedef void GeosGeometryCollection;
-typedef void GeosMultiPoint;
-typedef void GeosMultiLineString;
-typedef void GeosMultiLinearRing;
-typedef void GeosMultiPolygon;
-
-typedef void GeosWktReader;
-typedef void GeosWktWriter;
-typedef void GeosWkbReader;
-typedef void GeosWkbWriter;
-
-
-bool checkBoolResult(char result)
-{
-    int intResult = (int) result;
-
-    if (intResult == 1)
-        return true;
-    else if (intResult == 0)
-        return false;
-    else
-        throw std::runtime_error(message);
-}
-
-SWIGINTERN GeosGeometry *GeosGeometry_clone(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSGeom_clone(geom);
-    }
-SWIGINTERN char *GeosGeometry_geomType(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSGeomType(geom);
-    }
-SWIGINTERN int GeosGeometry_typeId(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSGeomTypeId(geom);
-    }
-SWIGINTERN void GeosGeometry_normalize(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        int result = GEOSNormalize(geom);
-
-        if (result == -1)
-            throw std::runtime_error(message);
-    }
-SWIGINTERN int GeosGeometry_getSRID(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSGetSRID(geom);
-    }
-
-/*@SWIG:%ruby_aux_method@*/
-SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
-{
-  VALUE obj = args[0];
-  VALUE type = TYPE(obj);
-  long *res = (long *)(args[1]);
-  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
-  return obj;
-}
-/*@SWIG@*/
-
-SWIGINTERN int
-SWIG_AsVal_long (VALUE obj, long* val)
-{
-  VALUE type = TYPE(obj);
-  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
-    long v;
-    VALUE a[2];
-    a[0] = obj;
-    a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
-      if (val) *val = v;
-      return SWIG_OK;
-    }
-  }
-  return SWIG_TypeError;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_int (VALUE obj, int *val)
-{
-  long v;
-  int res = SWIG_AsVal_long (obj, &v);
-  if (SWIG_IsOK(res)) {
-    if ((v < INT_MIN || v > INT_MAX)) {
-      return SWIG_OverflowError;
-    } else {
-      if (val) *val = static_cast< int >(v);
-    }
-  }  
-  return res;
-}
-
-SWIGINTERN void GeosGeometry_setSRID(GeosGeometry *self,int SRID){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSSetSRID(geom, SRID);
-    }
-SWIGINTERN size_t GeosGeometry_getDimensions(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSGeom_getDimensions(geom);
-    }
-
-SWIGINTERNINLINE VALUE
-SWIG_From_size_t  (size_t value)
-{    
-  return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
-}
-
-SWIGINTERN size_t GeosGeometry_getNumGeometries(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        size_t result = GEOSGetNumGeometries(geom);
-        
-        if ((int)result == -1)
-            throw std::runtime_error(message);
-
-        return result;
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_intersection(GeosGeometry *self,GeosGeometry *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return (GeosGeometry*) GEOSIntersection(geom, otherGeom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_buffer(GeosGeometry *self,double width,int quadsegs){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSBuffer(geom, width, quadsegs);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_convexHull(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSConvexHull(geom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_difference(GeosGeometry *self,GeosGeometry *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return (GeosGeometry*) GEOSDifference(geom, otherGeom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_symDifference(GeosGeometry *self,GeosGeometry *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return (GeosGeometry*) GEOSSymDifference(geom, otherGeom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_boundary(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSBoundary(geom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_geomUnion(GeosGeometry *self,GeosGeometry *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return (GeosGeometry*) GEOSUnion(geom, otherGeom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_pointOnSurface(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSPointOnSurface(geom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_getCentroid(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSGetCentroid(geom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_getEnvelope(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSEnvelope(geom);
-    }
-SWIGINTERN char *GeosGeometry_relate(GeosGeometry *self,GeosGeometry *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return GEOSRelate(geom, otherGeom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_lineMerge(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return GEOSLineMerge(geom);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_simplify(GeosGeometry *self,double tolerance){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSSimplify(geom, tolerance);
-    }
-SWIGINTERN GeosGeometry *GeosGeometry_topologyPreserveSimplify(GeosGeometry *self,double tolerance){
-        GEOSGeom geom = (GEOSGeom) self;
-        return (GeosGeometry*) GEOSTopologyPreserveSimplify(geom, tolerance);
-    }
-
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
-{
-  if (TYPE(obj) == T_STRING) {
-    
-
-
-    char *cstr = STR2CSTR(obj);
-    
-    size_t size = RSTRING_LEN(obj) + 1;
-    if (cptr)  {
-      if (alloc) {
-	if (*alloc == SWIG_NEWOBJ) {
-	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
-	} else {
-	  *cptr = cstr;
-	  *alloc = SWIG_OLDOBJ;
-	}
-      }
-    }
-    if (psize) *psize = size;
-    return SWIG_OK;
-  } else {
-    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-    if (pchar_descriptor) {
-      void* vptr = 0;
-      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
-	if (cptr) *cptr = (char *)vptr;
-	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
-	if (alloc) *alloc = SWIG_OLDOBJ;
-	return SWIG_OK;
-      }
-    }
-  }  
-  return SWIG_TypeError;
-}
-
-
-
-
-SWIGINTERN bool GeosGeometry_relatePattern(GeosGeometry *self,GeosGeometry const *other,char const *pat){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSRelatePattern(geom, otherGeom, pat));
-    }
-
-SWIGINTERNINLINE VALUE
-SWIG_From_bool  (bool value)
-{
-  return value ? Qtrue : Qfalse;
-}
-
-SWIGINTERN bool GeosGeometry_disjoint(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSDisjoint(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_touches(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSTouches(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_intersects(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSIntersects(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_crosses(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSCrosses(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_within(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSWithin(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_contains(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSContains(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_overlaps(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSOverlaps(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_equals(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSEquals(geom, otherGeom));
-    }
-SWIGINTERN bool GeosGeometry_equalsExact(GeosGeometry *self,GeosGeometry const *other,double tolerance){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        return checkBoolResult(GEOSEqualsExact(geom, otherGeom, tolerance));
-    }
-SWIGINTERN bool GeosGeometry_isEmpty(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return checkBoolResult(GEOSisEmpty(geom));
-    }
-SWIGINTERN bool GeosGeometry_isValid(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return checkBoolResult(GEOSisValid(geom));
-    }
-SWIGINTERN bool GeosGeometry_isSimple(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return checkBoolResult(GEOSisSimple(geom));
-    }
-SWIGINTERN bool GeosGeometry_isRing(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return checkBoolResult(GEOSisRing(geom));
-    }
-SWIGINTERN bool GeosGeometry_hasZ(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        return checkBoolResult(GEOSHasZ(geom));
-    }
-SWIGINTERN double GeosGeometry_area(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        double result;
-
-        int code = GEOSArea(geom, &result);
-
-        if (code == 0)
-            throw std::runtime_error(message);
-
-        return result;
-    }
-SWIGINTERN double GeosGeometry_length(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        double result;
-
-        int code = GEOSLength(geom, &result);
-
-        if (code == 0)
-            throw std::runtime_error(message);
-
-        return result;
-    }
-SWIGINTERN double GeosGeometry_distance(GeosGeometry *self,GeosGeometry const *other){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom otherGeom = (GEOSGeom) other;
-        double result;
-
-        int code = GEOSDistance(geom, otherGeom, &result);
-
-        if (code == 0)
-            throw std::runtime_error(message);
-
-        return result;
-    }
-SWIGINTERN GeosCoordinateSequence const *GeosPoint_getCoordSeq(GeosPoint *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
-
-        if (result == NULL)
-            throw std::runtime_error(message);
-
-        return (const GeosCoordinateSequence*) result;
-    }
-SWIGINTERN GeosCoordinateSequence const *GeosLineString_getCoordSeq(GeosLineString *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
-
-        if (result == NULL)
-            throw std::runtime_error(message);
-
-        return (const GeosCoordinateSequence*) result;
-    }
-SWIGINTERN GeosCoordinateSequence const *GeosLinearRing_getCoordSeq(GeosLinearRing *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
-
-        if (result == NULL)
-            throw std::runtime_error(message);
-
-        return (const GeosCoordinateSequence*) result;
-    }
-SWIGINTERN GeosGeometry const *GeosPolygon_getExteriorRing(GeosPolygon *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        const GEOSGeom result = (const GEOSGeom) GEOSGetExteriorRing(geom);
-
-        if (result == NULL)
-            throw std::runtime_error(message);
-
-        return (const GeosGeometry*) result;
-    }
-SWIGINTERN size_t GeosPolygon_getNumInteriorRings(GeosPolygon *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        size_t result = GEOSGetNumInteriorRings(geom);
-
-        if ((int)result == -1)
-            throw std::runtime_error(message);
-
-        return result;
-    }
-SWIGINTERN GeosGeometry const *GeosPolygon_getInteriorRingN(GeosPolygon *self,size_t n){
-        GEOSGeom geom = (GEOSGeom) self;
-
-        size_t size = GEOSGetNumInteriorRings(geom);
-
-        if (n < 0 || n >= size)
-            throw std::runtime_error("Index out of bounds");
-
-        const GEOSGeom result = (const GEOSGeom) GEOSGetInteriorRingN(geom, n);
-
-        if (result == NULL)
-            throw std::runtime_error(message);
-
-        return (const GeosGeometry*) result;
-    }
-SWIGINTERN GeosGeometry const *GeosGeometryCollection_getGeometryN(GeosGeometryCollection *self,size_t n){
-        GEOSGeom geom = (GEOSGeom) self;
-        const GEOSGeom result = (const GEOSGeom) GEOSGetGeometryN(geom, n);
-
-        if (result == NULL)
-            throw std::runtime_error(message);
-
-        return (const GeosGeometry*) result;
-    }
-
-GeosGeometry *createPoint(GeosCoordinateSequence *s)
-{
-    GEOSCoordSeq coords = (GEOSCoordSeq) s;
-    GEOSGeom geom = GEOSGeom_createPoint(coords);
-
-    if(geom == NULL)
-        throw std::runtime_error(message);
-
-    return (GeosGeometry*) geom;
-}
-
-GeosGeometry *createLineString(GeosCoordinateSequence *s)
-{
-    GEOSCoordSeq coords = (GEOSCoordSeq) s;
-    GEOSGeom geom = GEOSGeom_createLineString(coords);
-
-    if(geom == NULL)
-        throw std::runtime_error(message);
-
-    return (GeosGeometry*) geom;
-}
-
-GeosGeometry *createLinearRing(GeosCoordinateSequence *s)
-{
-    GEOSCoordSeq coords = (GEOSCoordSeq) s;
-    GEOSGeom geom = GEOSGeom_createLinearRing(coords);
-
-    if(geom == NULL)
-        throw std::runtime_error(message);
-
-    return (GeosGeometry*) geom;
-}
-
-GeosGeometry *createPolygon(GeosLinearRing *shell, GeosLinearRing **holes, size_t nholes)
-{
-    GEOSGeom shellGeom = (GEOSGeom) shell;
-    GEOSGeom* holeGeoms = (GEOSGeom*) holes;
-    GEOSGeom geom = GEOSGeom_createPolygon(shellGeom, holeGeoms, nholes);
-
-    if(geom == NULL)
-        throw std::runtime_error(message);
-
-    return (GeosGeometry*) geom;
-}
-
-
-SWIGINTERN GeosWktReader *new_GeosWktReader(){
-        return GEOSWKTReader_create();
-    }
-SWIGINTERN GeosGeometry *GeosWktReader_read(GeosWktReader *self,char const *wkt){
-        if(wkt == NULL)
-            throw std::runtime_error("Trying to create geometry from a NULL string");
-            
-        GEOSWKTReader *reader = (GEOSWKTReader*) self;
-        GEOSGeometry *geom = GEOSWKTReader_read(reader, wkt);
-
-        if(geom == NULL)
-            throw std::runtime_error(message);
-
-        return (GeosGeometry*) geom;
-    }
-SWIGINTERN GeosWktWriter *new_GeosWktWriter(){
-        return GEOSWKTWriter_create();
-    }
-SWIGINTERN char *GeosWktWriter_write(GeosWktWriter *self,GeosGeometry const *g){
-        GEOSWKTWriter *writer = (GEOSWKTWriter*) self;
-        GEOSGeom geom = (GEOSGeom) g;
-        return GEOSWKTWriter_write(writer, geom);
-    }
-SWIGINTERN GeosWkbReader *new_GeosWkbReader(){
-        return GEOSWKBReader_create();
-    }
-SWIGINTERN GeosGeometry *GeosWkbReader_read(GeosWkbReader *self,unsigned char const *wkb,size_t size){
-        if(wkb == NULL)
-          throw std::runtime_error("Trying to create geometry from a NULL string");
-         
-        GEOSWKBReader *reader = (GEOSWKBReader*) self;
-        GEOSGeometry *geom = GEOSWKBReader_read(reader, wkb, size);
-       
-        if(geom == NULL)
-          throw std::runtime_error(message);
-
-        return (GeosGeometry*) geom;
-    }
-SWIGINTERN GeosGeometry *GeosWkbReader_readHEX(GeosWkbReader *self,unsigned char const *wkb,size_t size){
-        if(wkb == NULL)
-          throw std::runtime_error("Trying to create geometry from a NULL string");
-         
-        GEOSWKBReader *reader = (GEOSWKBReader*) self;
-        GEOSGeometry *geom = GEOSWKBReader_readHEX(reader, wkb, size);
-       
-        if(geom == NULL)
-          throw std::runtime_error(message);
-
-        return (GeosGeometry*) geom;
-    }
-SWIGINTERN GeosWkbWriter *new_GeosWkbWriter(){
-        return GEOSWKBWriter_create();
-    }
-SWIGINTERN int GeosWkbWriter_getOutputDimension(GeosWkbWriter *self){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        return GEOSWKBWriter_getOutputDimension(writer);
-    }
-SWIGINTERN void GeosWkbWriter_setOutputDimension(GeosWkbWriter *self,int newDimension){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        GEOSWKBWriter_setOutputDimension(writer, newDimension);
-    }
-SWIGINTERN int GeosWkbWriter_getByteOrder(GeosWkbWriter *self){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        return GEOSWKBWriter_getByteOrder(writer);
-    }
-SWIGINTERN void GeosWkbWriter_setByteOrder(GeosWkbWriter *self,int newByteOrder){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        return GEOSWKBWriter_setByteOrder(writer, newByteOrder);
-    }
-SWIGINTERN bool GeosWkbWriter_getIncludeSRID(GeosWkbWriter *self){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        return GEOSWKBWriter_getIncludeSRID(writer);
-    }
-
-SWIGINTERN int
-SWIG_AsVal_bool (VALUE obj, bool *val)
-{
-  if (obj == Qtrue) {
-    if (val) *val = true;
-    return SWIG_OK;
-  } else if (obj == Qfalse) {
-    if (val) *val = false;
-    return SWIG_OK;
-  } else {
-    int res = 0;
-    if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {    
-      if (val) *val = res ? true : false;
-      return SWIG_OK;
-    }
-  }  
-  return SWIG_TypeError;
-}
-
-SWIGINTERN void GeosWkbWriter_setIncludeSRID(GeosWkbWriter *self,bool newIncludeSRID){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        return GEOSWKBWriter_setIncludeSRID(writer, newIncludeSRID);
-    }
-SWIGINTERN unsigned char *GeosWkbWriter_write(GeosWkbWriter *self,GeosGeometry const *g,size_t *size){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        GEOSGeom geom = (GEOSGeom) g;
-        return GEOSWKBWriter_write(writer, geom, size);
-    }
-SWIGINTERN unsigned char *GeosWkbWriter_writeHEX(GeosWkbWriter *self,GeosGeometry const *g,size_t *size){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        GEOSGeom geom = (GEOSGeom) g;
-        return GEOSWKBWriter_writeHEX(writer, geom, size);
-    }
-SWIGINTERN VALUE
-_wrap_version(int argc, VALUE *argv, VALUE self) {
-  char *result = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  result = (char *)GEOSversion();
-  vresult = SWIG_FromCharPtr((const char *)result);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cCoordinateSequence;
-
-#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_allocate(VALUE self) {
-#else
-  SWIGINTERN VALUE
-  _wrap_CoordinateSequence_allocate(int argc, VALUE *argv, VALUE self) {
-#endif
-    
-    
-    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosCoordinateSequence);
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
-    rb_obj_call_init(vresult, argc, argv);
-#endif
-    return vresult;
-  }
-  
-
-SWIGINTERN VALUE
-_wrap_new_CoordinateSequence(int argc, VALUE *argv, VALUE self) {
-  size_t arg1 ;
-  size_t arg2 ;
-  GeosCoordinateSequence *result = 0 ;
-  size_t val1 ;
-  int ecode1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GeosCoordinateSequence" "', argument " "1"" of type '" "size_t""'");
-  } 
-  arg1 = static_cast< size_t >(val1);
-  ecode2 = SWIG_AsVal_size_t(argv[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GeosCoordinateSequence" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  {
-    try
-    {
-      result = (GeosCoordinateSequence *)new_GeosCoordinateSequence(arg1,arg2);DATA_PTR(self) = result;
-      
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return self;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN void delete_GeosCoordinateSequence(GeosCoordinateSequence *self){
-        GEOSCoordSeq coords = (GEOSCoordSeq) self;
-        return GEOSCoordSeq_destroy(coords);
-    }
-SWIGINTERN void
-free_GeosCoordinateSequence(GeosCoordinateSequence *arg1) {
-    delete_GeosCoordinateSequence(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_clone(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  GeosCoordinateSequence *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clone" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  {
-    try
-    {
-      result = (GeosCoordinateSequence *)GeosCoordinateSequence_clone(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_OWN |  0 );
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_set_x(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  double arg3 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setX" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setX" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  ecode3 = SWIG_AsVal_double(argv[1], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setX" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  {
-    try
-    {
-      result = (int)GeosCoordinateSequence_setX(arg1,arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_set_y(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  double arg3 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setY" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setY" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  ecode3 = SWIG_AsVal_double(argv[1], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setY" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  {
-    try
-    {
-      result = (int)GeosCoordinateSequence_setY(arg1,arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_set_z(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  double arg3 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setZ" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setZ" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  ecode3 = SWIG_AsVal_double(argv[1], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setZ" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  {
-    try
-    {
-      result = (int)GeosCoordinateSequence_setZ(arg1,arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_set_ordinate(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  size_t arg3 ;
-  double arg4 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  size_t val3 ;
-  int ecode3 = 0 ;
-  double val4 ;
-  int ecode4 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 3) || (argc > 3)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setOrdinate" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setOrdinate" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setOrdinate" "', argument " "3"" of type '" "size_t""'");
-  } 
-  arg3 = static_cast< size_t >(val3);
-  ecode4 = SWIG_AsVal_double(argv[2], &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "setOrdinate" "', argument " "4"" of type '" "double""'");
-  } 
-  arg4 = static_cast< double >(val4);
-  {
-    try
-    {
-      result = (int)GeosCoordinateSequence_setOrdinate(arg1,arg2,arg3,arg4);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_get_x(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getX" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getX" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  {
-    try
-    {
-      result = (double)GeosCoordinateSequence_getX(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_get_y(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getY" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getY" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  {
-    try
-    {
-      result = (double)GeosCoordinateSequence_getY(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_get_z(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getZ" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getZ" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  {
-    try
-    {
-      result = (double)GeosCoordinateSequence_getZ(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_get_ordinate(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  size_t arg2 ;
-  size_t arg3 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  size_t val3 ;
-  int ecode3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getOrdinate" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getOrdinate" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "getOrdinate" "', argument " "3"" of type '" "size_t""'");
-  } 
-  arg3 = static_cast< size_t >(val3);
-  {
-    try
-    {
-      result = (double)GeosCoordinateSequence_getOrdinate(arg1,arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence___len__(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  unsigned int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSize" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  {
-    try
-    {
-      result = (unsigned int)GeosCoordinateSequence_getSize(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CoordinateSequence_dimensions(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  unsigned int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getDimensions" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
-  {
-    try
-    {
-      result = (unsigned int)GeosCoordinateSequence_getDimensions(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cGeometry;
-
-SWIGINTERN void delete_GeosGeometry(GeosGeometry *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosGeometry(GeosGeometry *arg1) {
-    delete_GeosGeometry(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_Geometry_clone(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clone" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_clone(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_geom_type(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "geomType" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (char *)GeosGeometry_geomType(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_FromCharPtr((const char *)result);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_type_id(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "typeId" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (int)GeosGeometry_typeId(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_normalize(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "normalize" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      GeosGeometry_normalize(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_srid(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSRID" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (int)GeosGeometry_getSRID(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_sride___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setSRID" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  ecode2 = SWIG_AsVal_int(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setSRID" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    try
-    {
-      GeosGeometry_setSRID(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_dimensions(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  size_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getDimensions" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = GeosGeometry_getDimensions(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_size_t(static_cast< size_t >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_num_geometries(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  size_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNumGeometries" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = GeosGeometry_getNumGeometries(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_size_t(static_cast< size_t >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_intersection(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "intersection" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "intersection" "', argument " "2"" of type '" "GeosGeometry *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_intersection(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_buffer(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  double arg2 ;
-  int arg3 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  {
-    arg3 = DEFAULT_QUADRANT_SEGMENTS;
-  }
-  if ((argc < 1) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "buffer" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  ecode2 = SWIG_AsVal_double(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "buffer" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  if (argc > 1) {
-    ecode3 = SWIG_AsVal_int(argv[1], &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "buffer" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_buffer(arg1,arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_convex_hull(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "convexHull" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_convexHull(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_difference(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "difference" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "difference" "', argument " "2"" of type '" "GeosGeometry *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_difference(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_sym_difference(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "symDifference" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "symDifference" "', argument " "2"" of type '" "GeosGeometry *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_symDifference(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_boundary(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "boundary" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_boundary(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_union(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "geomUnion" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "geomUnion" "', argument " "2"" of type '" "GeosGeometry *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_geomUnion(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_point_on_surface(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pointOnSurface" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_pointOnSurface(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_centroid(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCentroid" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_getCentroid(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_envelope(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getEnvelope" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_getEnvelope(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_relate(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "relate" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "relate" "', argument " "2"" of type '" "GeosGeometry *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (char *)GeosGeometry_relate(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_FromCharPtr((const char *)result);
-  delete[] result;
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_line_merge(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lineMerge" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_lineMerge(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_simplify(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  double arg2 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "simplify" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  ecode2 = SWIG_AsVal_double(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "simplify" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_simplify(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_topology_preserve_simplify(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  double arg2 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "topologyPreserveSimplify" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  ecode2 = SWIG_AsVal_double(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "topologyPreserveSimplify" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometry_topologyPreserveSimplify(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_relate_pattern(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  char *arg3 = (char *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "relatePattern" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "relatePattern" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "relatePattern" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_relatePattern(arg1,(GeosGeometry const *)arg2,(char const *)arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return vresult;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_disjointq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "disjoint" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "disjoint" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_disjoint(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_touchesq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "touches" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "touches" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_touches(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_intersectsq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "intersects" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "intersects" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_intersects(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_crossesq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "crosses" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "crosses" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_crosses(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_withinq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "within" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "within" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_within(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_containsq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "contains" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "contains" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_contains(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_overlapsq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "overlaps" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "overlaps" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_overlaps(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = (result ? Qtrue : Qfalse);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_eqlq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "equals" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_equals(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_eql_exactq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  double arg3 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 2) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "equalsExact" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equalsExact" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  ecode3 = SWIG_AsVal_double(argv[1], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "equalsExact" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_equalsExact(arg1,(GeosGeometry const *)arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_emptyq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isEmpty" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_isEmpty(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_validq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isValid" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_isValid(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_simpleq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isSimple" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_isSimple(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_ringq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isRing" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_isRing(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_has_zq___(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hasZ" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (bool)GeosGeometry_hasZ(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_area(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "area" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (double)GeosGeometry_area(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_length(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "length" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  {
-    try
-    {
-      result = (double)GeosGeometry_length(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Geometry_distance(int argc, VALUE *argv, VALUE self) {
-  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  double result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "distance" "', argument " "1"" of type '" "GeosGeometry *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "distance" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (double)GeosGeometry_distance(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_double(static_cast< double >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cPoint;
-
-SWIGINTERN void delete_GeosPoint(GeosPoint *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosPoint(GeosPoint *arg1) {
-    delete_GeosPoint(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_Point_coord_seq(int argc, VALUE *argv, VALUE self) {
-  GeosPoint *arg1 = (GeosPoint *) 0 ;
-  GeosCoordinateSequence *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPoint, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCoordSeq" "', argument " "1"" of type '" "GeosPoint *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosPoint * >(argp1);
-  {
-    try
-    {
-      result = (GeosCoordinateSequence *)GeosPoint_getCoordSeq(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cLineString;
-
-SWIGINTERN void delete_GeosLineString(GeosLineString *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosLineString(GeosLineString *arg1) {
-    delete_GeosLineString(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_LineString_coord_seq(int argc, VALUE *argv, VALUE self) {
-  GeosLineString *arg1 = (GeosLineString *) 0 ;
-  GeosCoordinateSequence *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosLineString, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCoordSeq" "', argument " "1"" of type '" "GeosLineString *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosLineString * >(argp1);
-  {
-    try
-    {
-      result = (GeosCoordinateSequence *)GeosLineString_getCoordSeq(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cLinearRing;
-
-SWIGINTERN void delete_GeosLinearRing(GeosLinearRing *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosLinearRing(GeosLinearRing *arg1) {
-    delete_GeosLinearRing(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_LinearRing_coord_seq(int argc, VALUE *argv, VALUE self) {
-  GeosLinearRing *arg1 = (GeosLinearRing *) 0 ;
-  GeosCoordinateSequence *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosLinearRing, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCoordSeq" "', argument " "1"" of type '" "GeosLinearRing *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosLinearRing * >(argp1);
-  {
-    try
-    {
-      result = (GeosCoordinateSequence *)GeosLinearRing_getCoordSeq(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cPolygon;
-
-SWIGINTERN void delete_GeosPolygon(GeosPolygon *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosPolygon(GeosPolygon *arg1) {
-    delete_GeosPolygon(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_Polygon_exterior_ring(int argc, VALUE *argv, VALUE self) {
-  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getExteriorRing" "', argument " "1"" of type '" "GeosPolygon *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosPolygon_getExteriorRing(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Polygon_num_interior_rings(int argc, VALUE *argv, VALUE self) {
-  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
-  size_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNumInteriorRings" "', argument " "1"" of type '" "GeosPolygon *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
-  {
-    try
-    {
-      result = GeosPolygon_getNumInteriorRings(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_size_t(static_cast< size_t >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_Polygon_interior_ring_n(int argc, VALUE *argv, VALUE self) {
-  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
-  size_t arg2 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getInteriorRingN" "', argument " "1"" of type '" "GeosPolygon *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getInteriorRingN" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosPolygon_getInteriorRingN(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cGeometryCollection;
-
-SWIGINTERN void delete_GeosGeometryCollection(GeosGeometryCollection *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosGeometryCollection(GeosGeometryCollection *arg1) {
-    delete_GeosGeometryCollection(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_GeometryCollection_get_geometry_n(int argc, VALUE *argv, VALUE self) {
-  GeosGeometryCollection *arg1 = (GeosGeometryCollection *) 0 ;
-  size_t arg2 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  size_t val2 ;
-  int ecode2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometryCollection, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getGeometryN" "', argument " "1"" of type '" "GeosGeometryCollection *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosGeometryCollection * >(argp1);
-  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getGeometryN" "', argument " "2"" of type '" "size_t""'");
-  } 
-  arg2 = static_cast< size_t >(val2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosGeometryCollection_getGeometryN(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cMultiPoint;
-
-SWIGINTERN void delete_GeosMultiPoint(GeosMultiPoint *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosMultiPoint(GeosMultiPoint *arg1) {
-    delete_GeosMultiPoint(arg1);
-}
-
-swig_class cMultiLineString;
-
-SWIGINTERN void delete_GeosMultiLineString(GeosMultiLineString *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosMultiLineString(GeosMultiLineString *arg1) {
-    delete_GeosMultiLineString(arg1);
-}
-
-swig_class cMultiLinearRing;
-
-SWIGINTERN void delete_GeosMultiLinearRing(GeosMultiLinearRing *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosMultiLinearRing(GeosMultiLinearRing *arg1) {
-    delete_GeosMultiLinearRing(arg1);
-}
-
-swig_class cMultiPolygon;
-
-SWIGINTERN void delete_GeosMultiPolygon(GeosMultiPolygon *self){
-        GEOSGeom geom = (GEOSGeom) self;
-        GEOSGeom_destroy(geom);
-    }
-SWIGINTERN void
-free_GeosMultiPolygon(GeosMultiPolygon *arg1) {
-    delete_GeosMultiPolygon(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_create_point(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  GeosGeometry *result = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createPoint" "', argument " "1"" of type '" "GeosCoordinateSequence *""'");
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)createPoint(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_create_line_string(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  GeosGeometry *result = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createLineString" "', argument " "1"" of type '" "GeosCoordinateSequence *""'");
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)createLineString(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_create_linear_ring(int argc, VALUE *argv, VALUE self) {
-  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
-  GeosGeometry *result = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createLinearRing" "', argument " "1"" of type '" "GeosCoordinateSequence *""'");
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)createLinearRing(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_create_polygon(int argc, VALUE *argv, VALUE self) {
-  GeosLinearRing *arg1 = (GeosLinearRing *) 0 ;
-  GeosLinearRing **arg2 = (GeosLinearRing **) 0 ;
-  size_t arg3 ;
-  GeosGeometry *result = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  {
-    arg2 = NULL;
-    arg3 = 0;
-  }
-  if ((argc < 1) || (argc > 2)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosLinearRing, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createPolygon" "', argument " "1"" of type '" "GeosLinearRing *""'");
-  }
-  if (argc > 1) {
-    {
-      if (NIL_P(argv[1]))
-      {
-        arg2 = NULL;
-        arg3 = 0;
-      }
-      else
-      {
-        /* Make sure the input can be treated as an array. */
-        Check_Type(argv[1], T_ARRAY);
-        
-        /* Get the length */
-        arg3 = RARRAY(argv[1])->len;
-        
-        /* Allocate space for the C array. */
-        arg2 = (GeosLinearRing**) malloc(arg3*sizeof(GeosLinearRing*));
-        
-        for(size_t i = 0; i<arg3; i++)
-        {
-          /* Get the Ruby Object */
-          VALUE item = rb_ary_entry(argv[1],i);
-          
-          /* Get the underlying pointer and give up ownership of it. */
-          GeosLinearRing *ring = NULL;
-          int convertResult = SWIG_ConvertPtr(item, (void**)&ring, SWIGTYPE_p_GeosLinearRing, SWIG_POINTER_DISOWN);
-          if (!SWIG_IsOK(convertResult)) {
-            SWIG_exception_fail(SWIG_ArgError(convertResult), "in method '" "createPolygon" "', argument " "1"" of type '" "GeosLinearRing *""'");
-          }
-          
-          /* Put the pointer in the array */
-          arg2[i] = ring;
-        }    
-      }
-    }
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)createPolygon(arg1,arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  {
-    if (arg2) {
-      free((void*) arg2);
-    }
-  }
-  return vresult;
-fail:
-  {
-    if (arg2) {
-      free((void*) arg2);
-    }
-  }
-  return Qnil;
-}
-
-
-swig_class cWktReader;
-
-#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
-SWIGINTERN VALUE
-_wrap_WktReader_allocate(VALUE self) {
-#else
-  SWIGINTERN VALUE
-  _wrap_WktReader_allocate(int argc, VALUE *argv, VALUE self) {
-#endif
-    
-    
-    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWktReader);
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
-    rb_obj_call_init(vresult, argc, argv);
-#endif
-    return vresult;
-  }
-  
-
-SWIGINTERN VALUE
-_wrap_new_WktReader(int argc, VALUE *argv, VALUE self) {
-  GeosWktReader *result = 0 ;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  {
-    try
-    {
-      result = (GeosWktReader *)new_GeosWktReader();DATA_PTR(self) = result;
-      
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return self;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN void delete_GeosWktReader(GeosWktReader *self){
-        GEOSWKTReader *reader = (GEOSWKTReader*) self;
-        GEOSWKTReader_destroy(reader);
-    }
-SWIGINTERN void
-free_GeosWktReader(GeosWktReader *arg1) {
-    delete_GeosWktReader(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_WktReader_read(int argc, VALUE *argv, VALUE self) {
-  GeosWktReader *arg1 = (GeosWktReader *) 0 ;
-  char *arg2 = (char *) 0 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWktReader, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read" "', argument " "1"" of type '" "GeosWktReader *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWktReader * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "read" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosWktReader_read(arg1,(char const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return vresult;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return Qnil;
-}
-
-
-swig_class cWktWriter;
-
-#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
-SWIGINTERN VALUE
-_wrap_WktWriter_allocate(VALUE self) {
-#else
-  SWIGINTERN VALUE
-  _wrap_WktWriter_allocate(int argc, VALUE *argv, VALUE self) {
-#endif
-    
-    
-    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWktWriter);
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
-    rb_obj_call_init(vresult, argc, argv);
-#endif
-    return vresult;
-  }
-  
-
-SWIGINTERN VALUE
-_wrap_new_WktWriter(int argc, VALUE *argv, VALUE self) {
-  GeosWktWriter *result = 0 ;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  {
-    try
-    {
-      result = (GeosWktWriter *)new_GeosWktWriter();DATA_PTR(self) = result;
-      
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return self;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN void delete_GeosWktWriter(GeosWktWriter *self){
-        GEOSWKTWriter *writer = (GEOSWKTWriter*) self;
-        GEOSWKTWriter_destroy(writer);
-    }
-SWIGINTERN void
-free_GeosWktWriter(GeosWktWriter *arg1) {
-    delete_GeosWktWriter(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_WktWriter_write(int argc, VALUE *argv, VALUE self) {
-  GeosWktWriter *arg1 = (GeosWktWriter *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWktWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "write" "', argument " "1"" of type '" "GeosWktWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWktWriter * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "write" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (char *)GeosWktWriter_write(arg1,(GeosGeometry const *)arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_FromCharPtr((const char *)result);
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cWkbReader;
-
-#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
-SWIGINTERN VALUE
-_wrap_WkbReader_allocate(VALUE self) {
-#else
-  SWIGINTERN VALUE
-  _wrap_WkbReader_allocate(int argc, VALUE *argv, VALUE self) {
-#endif
-    
-    
-    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWkbReader);
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
-    rb_obj_call_init(vresult, argc, argv);
-#endif
-    return vresult;
-  }
-  
-
-SWIGINTERN VALUE
-_wrap_new_WkbReader(int argc, VALUE *argv, VALUE self) {
-  GeosWkbReader *result = 0 ;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  {
-    try
-    {
-      result = (GeosWkbReader *)new_GeosWkbReader();DATA_PTR(self) = result;
-      
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return self;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN void delete_GeosWkbReader(GeosWkbReader *self){
-        GEOSWKBReader *reader = (GEOSWKBReader*) self;
-        GEOSWKBReader_destroy(reader);
-    }
-SWIGINTERN void
-free_GeosWkbReader(GeosWkbReader *arg1) {
-    delete_GeosWkbReader(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_WkbReader_read(int argc, VALUE *argv, VALUE self) {
-  GeosWkbReader *arg1 = (GeosWkbReader *) 0 ;
-  unsigned char *arg2 = (unsigned char *) 0 ;
-  size_t arg3 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int alloc2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbReader, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read" "', argument " "1"" of type '" "GeosWkbReader *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbReader * >(argp1);
-  {
-    /* %typemap(in) (const unsigned char* wkb, size_t size) (int alloc2 = 0) */
-    if (SWIG_AsCharPtrAndSize(argv[0], (char**)&arg2, &arg3, &alloc2) != SWIG_OK)
-    SWIG_exception(SWIG_RuntimeError, "Expecting a string");
-    /* Don't want to include last null character! */
-    arg3--;
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosWkbReader_read(arg1,(unsigned char const *)arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbReader_read_hex(int argc, VALUE *argv, VALUE self) {
-  GeosWkbReader *arg1 = (GeosWkbReader *) 0 ;
-  unsigned char *arg2 = (unsigned char *) 0 ;
-  size_t arg3 ;
-  GeosGeometry *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int alloc2 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbReader, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "readHEX" "', argument " "1"" of type '" "GeosWkbReader *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbReader * >(argp1);
-  {
-    /* %typemap(in) (const unsigned char* wkb, size_t size) (int alloc2 = 0) */
-    if (SWIG_AsCharPtrAndSize(argv[0], (char**)&arg2, &arg3, &alloc2) != SWIG_OK)
-    SWIG_exception(SWIG_RuntimeError, "Expecting a string");
-    /* Don't want to include last null character! */
-    arg3--;
-  }
-  {
-    try
-    {
-      result = (GeosGeometry *)GeosWkbReader_readHEX(arg1,(unsigned char const *)arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) GeosGeometry */
-    
-    if (result == NULL)
-    SWIG_exception(SWIG_RuntimeError, message);
-    
-    GeosGeometry *geom = result;
-    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
-    
-    switch (geomId)
-    {
-    case GEOS_POINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_LINEARRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_POLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOINT:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTILINESTRING:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_MULTIPOLYGON:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
-      break;
-    case GEOS_GEOMETRYCOLLECTION:
-      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
-      break;
-    }
-  }
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-swig_class cWkbWriter;
-
-#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
-SWIGINTERN VALUE
-_wrap_WkbWriter_allocate(VALUE self) {
-#else
-  SWIGINTERN VALUE
-  _wrap_WkbWriter_allocate(int argc, VALUE *argv, VALUE self) {
-#endif
-    
-    
-    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWkbWriter);
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
-    rb_obj_call_init(vresult, argc, argv);
-#endif
-    return vresult;
-  }
-  
-
-SWIGINTERN VALUE
-_wrap_new_WkbWriter(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *result = 0 ;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  {
-    try
-    {
-      result = (GeosWkbWriter *)new_GeosWkbWriter();DATA_PTR(self) = result;
-      
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return self;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN void delete_GeosWkbWriter(GeosWkbWriter *self){
-        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
-        GEOSWKBWriter_destroy(writer);
-    }
-SWIGINTERN void
-free_GeosWkbWriter(GeosWkbWriter *arg1) {
-    delete_GeosWkbWriter(arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_output_dimensions(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getOutputDimension" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  {
-    try
-    {
-      result = (int)GeosWkbWriter_getOutputDimension(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_output_dimensionse___(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setOutputDimension" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  ecode2 = SWIG_AsVal_int(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setOutputDimension" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    try
-    {
-      GeosWkbWriter_setOutputDimension(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_byte_order(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getByteOrder" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  {
-    try
-    {
-      result = (int)GeosWkbWriter_getByteOrder(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_int(static_cast< int >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_byte_ordere___(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setByteOrder" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  ecode2 = SWIG_AsVal_int(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setByteOrder" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    try
-    {
-      GeosWkbWriter_setByteOrder(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_include_srid(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  VALUE vresult = Qnil;
-  
-  if ((argc < 0) || (argc > 0)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getIncludeSRID" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  {
-    try
-    {
-      result = (bool)GeosWkbWriter_getIncludeSRID(arg1);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  vresult = SWIG_From_bool(static_cast< bool >(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_include_sride___(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  bool arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  bool val2 ;
-  int ecode2 = 0 ;
-  
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setIncludeSRID" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setIncludeSRID" "', argument " "2"" of type '" "bool""'");
-  } 
-  arg2 = static_cast< bool >(val2);
-  {
-    try
-    {
-      GeosWkbWriter_setIncludeSRID(arg1,arg2);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_write(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  size_t *arg3 = (size_t *) 0 ;
-  unsigned char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  size_t temp3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  {
-    /* %typemap(in, numinputs=0) size_t *size (size_t temp3 = 0) */
-    arg3 = &temp3;
-  }
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "write" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "write" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (unsigned char *)GeosWkbWriter_write(arg1,(GeosGeometry const *)arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) unsigned char* */
-  }
-  {
-    /* %typemap(argout) size_t *size */
-    vresult = SWIG_FromCharPtrAndSize((const char*)result, *arg3);
-  }
-  {
-    /* %typemap(freearg) size_t *size */
-    std::free(result);
-  }
-  return vresult;
-fail:
-  {
-    /* %typemap(freearg) size_t *size */
-    std::free(result);
-  }
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_WkbWriter_write_hex(int argc, VALUE *argv, VALUE self) {
-  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
-  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
-  size_t *arg3 = (size_t *) 0 ;
-  unsigned char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  size_t temp3 = 0 ;
-  VALUE vresult = Qnil;
-  
-  {
-    /* %typemap(in, numinputs=0) size_t *size (size_t temp3 = 0) */
-    arg3 = &temp3;
-  }
-  if ((argc < 1) || (argc > 1)) {
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "writeHEX" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
-  }
-  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
-  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "writeHEX" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
-  }
-  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
-  {
-    try
-    {
-      result = (unsigned char *)GeosWkbWriter_writeHEX(arg1,(GeosGeometry const *)arg2,arg3);
-    }
-    catch (const std::exception& e)
-    {
-      SWIG_exception(SWIG_RuntimeError, e.what());
-    }
-  }
-  {
-    /* %typemap(out) unsigned char* */
-  }
-  {
-    /* %typemap(argout) size_t *size */
-    vresult = SWIG_FromCharPtrAndSize((const char*)result, *arg3);
-  }
-  {
-    /* %typemap(freearg) size_t *size */
-    std::free(result);
-  }
-  return vresult;
-fail:
-  {
-    /* %typemap(freearg) size_t *size */
-    std::free(result);
-  }
-  return Qnil;
-}
-
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-
-static void *_p_GeosMultiPolygonTo_p_GeosGeometryCollection(void *x) {
-    return (void *)((GeosGeometryCollection *)  ((GeosMultiPolygon *) x));
-}
-static void *_p_GeosMultiPointTo_p_GeosGeometryCollection(void *x) {
-    return (void *)((GeosGeometryCollection *)  ((GeosMultiPoint *) x));
-}
-static void *_p_GeosMultiLineStringTo_p_GeosGeometryCollection(void *x) {
-    return (void *)((GeosGeometryCollection *)  ((GeosMultiLineString *) x));
-}
-static void *_p_GeosMultiLinearRingTo_p_GeosGeometryCollection(void *x) {
-    return (void *)((GeosGeometryCollection *)  ((GeosMultiLinearRing *) x));
-}
-static void *_p_GeosPolygonTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *)  ((GeosPolygon *) x));
-}
-static void *_p_GeosMultiPolygonTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiPolygon *) x));
-}
-static void *_p_GeosPointTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *)  ((GeosPoint *) x));
-}
-static void *_p_GeosLineStringTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *)  ((GeosLineString *) x));
-}
-static void *_p_GeosLinearRingTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *)  ((GeosLinearRing *) x));
-}
-static void *_p_GeosMultiPointTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiPoint *) x));
-}
-static void *_p_GeosMultiLineStringTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiLineString *) x));
-}
-static void *_p_GeosMultiLinearRingTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiLinearRing *) x));
-}
-static void *_p_GeosGeometryCollectionTo_p_GeosGeometry(void *x) {
-    return (void *)((GeosGeometry *)  ((GeosGeometryCollection *) x));
-}
-static swig_type_info _swigt__p_GeosCoordinateSequence = {"_p_GeosCoordinateSequence", "GeosCoordinateSequence *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosGeometry = {"_p_GeosGeometry", "GeosGeometry *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosGeometryCollection = {"_p_GeosGeometryCollection", "GeosGeometryCollection *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosLineString = {"_p_GeosLineString", "GeosLineString *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosLinearRing = {"_p_GeosLinearRing", "GeosLinearRing *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosMultiLineString = {"_p_GeosMultiLineString", "GeosMultiLineString *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosMultiLinearRing = {"_p_GeosMultiLinearRing", "GeosMultiLinearRing *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosMultiPoint = {"_p_GeosMultiPoint", "GeosMultiPoint *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosMultiPolygon = {"_p_GeosMultiPolygon", "GeosMultiPolygon *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosPoint = {"_p_GeosPoint", "GeosPoint *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosPolygon = {"_p_GeosPolygon", "GeosPolygon *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosWkbReader = {"_p_GeosWkbReader", "GeosWkbReader *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosWkbWriter = {"_p_GeosWkbWriter", "GeosWkbWriter *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosWktReader = {"_p_GeosWktReader", "GeosWktReader *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_GeosWktWriter = {"_p_GeosWktWriter", "GeosWktWriter *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_p_GeosLinearRing = {"_p_p_GeosLinearRing", "GeosLinearRing **", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
-  &_swigt__p_GeosCoordinateSequence,
-  &_swigt__p_GeosGeometry,
-  &_swigt__p_GeosGeometryCollection,
-  &_swigt__p_GeosLineString,
-  &_swigt__p_GeosLinearRing,
-  &_swigt__p_GeosMultiLineString,
-  &_swigt__p_GeosMultiLinearRing,
-  &_swigt__p_GeosMultiPoint,
-  &_swigt__p_GeosMultiPolygon,
-  &_swigt__p_GeosPoint,
-  &_swigt__p_GeosPolygon,
-  &_swigt__p_GeosWkbReader,
-  &_swigt__p_GeosWkbWriter,
-  &_swigt__p_GeosWktReader,
-  &_swigt__p_GeosWktWriter,
-  &_swigt__p_char,
-  &_swigt__p_p_GeosLinearRing,
-  &_swigt__p_size_t,
-  &_swigt__p_unsigned_char,
-};
-
-static swig_cast_info _swigc__p_GeosCoordinateSequence[] = {  {&_swigt__p_GeosCoordinateSequence, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosGeometry[] = {  {&_swigt__p_GeosPolygon, _p_GeosPolygonTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiPolygon, _p_GeosMultiPolygonTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosPoint, _p_GeosPointTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosGeometry, 0, 0, 0},  {&_swigt__p_GeosLineString, _p_GeosLineStringTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosLinearRing, _p_GeosLinearRingTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiPoint, _p_GeosMultiPointTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiLineString, _p_GeosMultiLineStringTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiLinearRing, _p_GeosMultiLinearRingTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosGeometryCollection, _p_GeosGeometryCollectionTo_p_GeosGeometry, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosGeometryCollection[] = {  {&_swigt__p_GeosMultiPolygon, _p_GeosMultiPolygonTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiPoint, _p_GeosMultiPointTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiLineString, _p_GeosMultiLineStringTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiLinearRing, _p_GeosMultiLinearRingTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosGeometryCollection, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosLineString[] = {  {&_swigt__p_GeosLineString, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosLinearRing[] = {  {&_swigt__p_GeosLinearRing, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosMultiLineString[] = {  {&_swigt__p_GeosMultiLineString, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosMultiLinearRing[] = {  {&_swigt__p_GeosMultiLinearRing, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosMultiPoint[] = {  {&_swigt__p_GeosMultiPoint, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosMultiPolygon[] = {  {&_swigt__p_GeosMultiPolygon, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosPoint[] = {  {&_swigt__p_GeosPoint, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosPolygon[] = {  {&_swigt__p_GeosPolygon, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosWkbReader[] = {  {&_swigt__p_GeosWkbReader, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosWkbWriter[] = {  {&_swigt__p_GeosWkbWriter, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosWktReader[] = {  {&_swigt__p_GeosWktReader, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_GeosWktWriter[] = {  {&_swigt__p_GeosWktWriter, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_p_GeosLinearRing[] = {  {&_swigt__p_p_GeosLinearRing, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_size_t[] = {  {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
-  _swigc__p_GeosCoordinateSequence,
-  _swigc__p_GeosGeometry,
-  _swigc__p_GeosGeometryCollection,
-  _swigc__p_GeosLineString,
-  _swigc__p_GeosLinearRing,
-  _swigc__p_GeosMultiLineString,
-  _swigc__p_GeosMultiLinearRing,
-  _swigc__p_GeosMultiPoint,
-  _swigc__p_GeosMultiPolygon,
-  _swigc__p_GeosPoint,
-  _swigc__p_GeosPolygon,
-  _swigc__p_GeosWkbReader,
-  _swigc__p_GeosWkbWriter,
-  _swigc__p_GeosWktReader,
-  _swigc__p_GeosWktWriter,
-  _swigc__p_char,
-  _swigc__p_p_GeosLinearRing,
-  _swigc__p_size_t,
-  _swigc__p_unsigned_char,
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-
-/* -----------------------------------------------------------------------------
- * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
- * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
- * swig_module, and does all the lookup, filling in the swig_module.types
- * array with the correct data and linking the correct swig_cast_info
- * structures together.
- *
- * The generated swig_type_info structures are assigned staticly to an initial 
- * array. We just loop through that array, and handle each type individually.
- * First we lookup if this type has been already loaded, and if so, use the
- * loaded structure instead of the generated one. Then we have to fill in the
- * cast linked list. The cast data is initially stored in something like a
- * two-dimensional array. Each row corresponds to a type (there are the same
- * number of rows as there are in the swig_type_initial array). Each entry in
- * a column is one of the swig_cast_info structures for that type.
- * The cast_initial array is actually an array of arrays, because each row has
- * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
- * adding the casts to the list. The one last trick we need to do is making
- * sure the type pointer in the swig_cast_info struct is correct.
- *
- * First off, we lookup the cast->type name to see if it is already loaded. 
- * There are three cases to handle:
- *  1) If the cast->type has already been loaded AND the type we are adding
- *     casting info to has not been loaded (it is in this module), THEN we
- *     replace the cast->type pointer with the type pointer that has already
- *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
- *     cast->type) are loaded, THEN the cast info has already been loaded by
- *     the previous module so we just ignore it.
- *  3) Finally, if cast->type has not already been loaded, then we add that
- *     swig_cast_info to the linked list (because the cast->type) pointer will
- *     be correct.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* c-mode */
-#endif
-#endif
-
-#if 0
-#define SWIGRUNTIME_DEBUG
-#endif
-
-
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
-  size_t i;
-  swig_module_info *module_head, *iter;
-  int found;
-
-  clientdata = clientdata;
-
-  /* check to see if the circular list has been setup, if not, set it up */
-  if (swig_module.next==0) {
-    /* Initialize the swig_module */
-    swig_module.type_initial = swig_type_initial;
-    swig_module.cast_initial = swig_cast_initial;
-    swig_module.next = &swig_module;
-  }
-
-  /* Try and load any already created modules */
-  module_head = SWIG_GetModule(clientdata);
-  if (!module_head) {
-    /* This is the first module loaded for this interpreter */
-    /* so set the swig module into the interpreter */
-    SWIG_SetModule(clientdata, &swig_module);
-    module_head = &swig_module;
-  } else {
-    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
-    found=0;
-    iter=module_head;
-    do {
-      if (iter==&swig_module) {
-        found=1;
-        break;
-      }
-      iter=iter->next;
-    } while (iter!= module_head);
-
-    /* if the is found in the list, then all is done and we may leave */
-    if (found) return;
-    /* otherwise we must add out module into the list */
-    swig_module.next = module_head->next;
-    module_head->next = &swig_module;
-  }
-
-  /* Now work on filling in swig_module.types */
-#ifdef SWIGRUNTIME_DEBUG
-  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
-#endif
-  for (i = 0; i < swig_module.size; ++i) {
-    swig_type_info *type = 0;
-    swig_type_info *ret;
-    swig_cast_info *cast;
-  
-#ifdef SWIGRUNTIME_DEBUG
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-#endif
-
-    /* if there is another module already loaded */
-    if (swig_module.next != &swig_module) {
-      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-    }
-    if (type) {
-      /* Overwrite clientdata field */
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found type %s\n", type->name);
-#endif
-      if (swig_module.type_initial[i]->clientdata) {
-	type->clientdata = swig_module.type_initial[i]->clientdata;
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
-#endif
-      }
-    } else {
-      type = swig_module.type_initial[i];
-    }
-
-    /* Insert casting types */
-    cast = swig_module.cast_initial[i];
-    while (cast->type) {
-    
-      /* Don't need to add information already in the list */
-      ret = 0;
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
-#endif
-      if (swig_module.next != &swig_module) {
-        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
-#ifdef SWIGRUNTIME_DEBUG
-	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
-#endif
-      }
-      if (ret) {
-	if (type == swig_module.type_initial[i]) {
-#ifdef SWIGRUNTIME_DEBUG
-	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
-#endif
-	  cast->type = ret;
-	  ret = 0;
-	} else {
-	  /* Check for casting already in the list */
-	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
-#ifdef SWIGRUNTIME_DEBUG
-	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
-#endif
-	  if (!ocast) ret = 0;
-	}
-      }
-
-      if (!ret) {
-#ifdef SWIGRUNTIME_DEBUG
-	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
-#endif
-        if (type->cast) {
-          type->cast->prev = cast;
-          cast->next = type->cast;
-        }
-        type->cast = cast;
-      }
-      cast++;
-    }
-    /* Set entry in modules->types array equal to the type */
-    swig_module.types[i] = type;
-  }
-  swig_module.types[i] = 0;
-
-#ifdef SWIGRUNTIME_DEBUG
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-  for (i = 0; i < swig_module.size; ++i) {
-    int j = 0;
-    swig_cast_info *cast = swig_module.cast_initial[i];
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-    while (cast->type) {
-      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-      cast++;
-      ++j;
-    }
-  printf("---- Total casts: %d\n",j);
-  }
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-#endif
-}
-
-/* This function will propagate the clientdata field of type to
-* any new swig_type_info structures that have been added into the list
-* of equivalent types.  It is like calling
-* SWIG_TypeClientData(type, clientdata) a second time.
-*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
-  size_t i;
-  swig_cast_info *equiv;
-  static int init_run = 0;
-
-  if (init_run) return;
-  init_run = 1;
-
-  for (i = 0; i < swig_module.size; i++) {
-    if (swig_module.types[i]->clientdata) {
-      equiv = swig_module.types[i]->cast;
-      while (equiv) {
-        if (!equiv->converter) {
-          if (equiv->type && !equiv->type->clientdata)
-            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-        }
-        equiv = equiv->next;
-      }
-    }
-  }
-}
-
-#ifdef __cplusplus
-#if 0
-{ /* c-mode */
-#endif
-}
-#endif
-
-
-#ifdef __cplusplus
-extern "C"
-#endif
-SWIGEXPORT void Init_geos(void) {
-  size_t i;
-  
-  SWIG_InitRuntime();
-  mGeos = rb_define_module("Geos");
-  
-  SWIG_InitializeModule(0);
-  for (i = 0; i < swig_module.size; i++) {
-    SWIG_define_class(swig_module.types[i]);
-  }
-  
-  SWIG_RubyInitializeTrackings();
-  rb_define_const(mGeos, "GEOS_VERSION_MAJOR", SWIG_From_int(static_cast< int >(3)));
-  rb_define_const(mGeos, "GEOS_VERSION_MINOR", SWIG_From_int(static_cast< int >(0)));
-  rb_define_const(mGeos, "GEOS_VERSION", SWIG_FromCharPtr("3.0.0rc4"));
-  rb_define_const(mGeos, "GEOS_JTS_PORT", SWIG_FromCharPtr("1.7.1"));
-  rb_define_const(mGeos, "GEOS_CAPI_VERSION_MAJOR", SWIG_From_int(static_cast< int >(1)));
-  rb_define_const(mGeos, "GEOS_CAPI_VERSION_MINOR", SWIG_From_int(static_cast< int >(3)));
-  rb_define_const(mGeos, "GEOS_CAPI_VERSION_PATCH", SWIG_From_int(static_cast< int >(3)));
-  rb_define_const(mGeos, "GEOS_CAPI_FIRST_INTERFACE", SWIG_From_int(static_cast< int >(1)));
-  rb_define_const(mGeos, "GEOS_CAPI_LAST_INTERFACE", SWIG_From_int(static_cast< int >((1+3))));
-  rb_define_const(mGeos, "GEOS_CAPI_VERSION", SWIG_FromCharPtr("3.0.0rc4-CAPI-1.3.3"));
-  rb_define_const(mGeos, "GEOS_POINT", SWIG_From_int(static_cast< int >(GEOS_POINT)));
-  rb_define_const(mGeos, "GEOS_LINESTRING", SWIG_From_int(static_cast< int >(GEOS_LINESTRING)));
-  rb_define_const(mGeos, "GEOS_LINEARRING", SWIG_From_int(static_cast< int >(GEOS_LINEARRING)));
-  rb_define_const(mGeos, "GEOS_POLYGON", SWIG_From_int(static_cast< int >(GEOS_POLYGON)));
-  rb_define_const(mGeos, "GEOS_MULTIPOINT", SWIG_From_int(static_cast< int >(GEOS_MULTIPOINT)));
-  rb_define_const(mGeos, "GEOS_MULTILINESTRING", SWIG_From_int(static_cast< int >(GEOS_MULTILINESTRING)));
-  rb_define_const(mGeos, "GEOS_MULTIPOLYGON", SWIG_From_int(static_cast< int >(GEOS_MULTIPOLYGON)));
-  rb_define_const(mGeos, "GEOS_GEOMETRYCOLLECTION", SWIG_From_int(static_cast< int >(GEOS_GEOMETRYCOLLECTION)));
-  rb_define_const(mGeos, "GEOS_WKB_XDR", SWIG_From_int(static_cast< int >(GEOS_WKB_XDR)));
-  rb_define_const(mGeos, "GEOS_WKB_NDR", SWIG_From_int(static_cast< int >(GEOS_WKB_NDR)));
-  
-  initGEOS(noticeHandler, errorHandler);
-  
-  rb_define_module_function(mGeos, "version", VALUEFUNC(_wrap_version), -1);
-  
-  cCoordinateSequence.klass = rb_define_class_under(mGeos, "CoordinateSequence", rb_cObject);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosCoordinateSequence, (void *) &cCoordinateSequence);
-  rb_define_alloc_func(cCoordinateSequence.klass, _wrap_CoordinateSequence_allocate);
-  rb_define_method(cCoordinateSequence.klass, "initialize", VALUEFUNC(_wrap_new_CoordinateSequence), -1);
-  rb_define_method(cCoordinateSequence.klass, "clone", VALUEFUNC(_wrap_CoordinateSequence_clone), -1);
-  rb_define_method(cCoordinateSequence.klass, "set_x", VALUEFUNC(_wrap_CoordinateSequence_set_x), -1);
-  rb_define_method(cCoordinateSequence.klass, "set_y", VALUEFUNC(_wrap_CoordinateSequence_set_y), -1);
-  rb_define_method(cCoordinateSequence.klass, "set_z", VALUEFUNC(_wrap_CoordinateSequence_set_z), -1);
-  rb_define_method(cCoordinateSequence.klass, "set_ordinate", VALUEFUNC(_wrap_CoordinateSequence_set_ordinate), -1);
-  rb_define_method(cCoordinateSequence.klass, "get_x", VALUEFUNC(_wrap_CoordinateSequence_get_x), -1);
-  rb_define_method(cCoordinateSequence.klass, "get_y", VALUEFUNC(_wrap_CoordinateSequence_get_y), -1);
-  rb_define_method(cCoordinateSequence.klass, "get_z", VALUEFUNC(_wrap_CoordinateSequence_get_z), -1);
-  rb_define_method(cCoordinateSequence.klass, "get_ordinate", VALUEFUNC(_wrap_CoordinateSequence_get_ordinate), -1);
-  rb_define_method(cCoordinateSequence.klass, "length", VALUEFUNC(_wrap_CoordinateSequence___len__), -1);
-  rb_define_method(cCoordinateSequence.klass, "dimensions", VALUEFUNC(_wrap_CoordinateSequence_dimensions), -1);
-  cCoordinateSequence.mark = 0;
-  cCoordinateSequence.destroy = (void (*)(void *)) free_GeosCoordinateSequence;
-  cCoordinateSequence.trackObjects = 0;
-  
-  cGeometry.klass = rb_define_class_under(mGeos, "Geometry", rb_cObject);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosGeometry, (void *) &cGeometry);
-  rb_undef_alloc_func(cGeometry.klass);
-  rb_define_method(cGeometry.klass, "clone", VALUEFUNC(_wrap_Geometry_clone), -1);
-  rb_define_method(cGeometry.klass, "geom_type", VALUEFUNC(_wrap_Geometry_geom_type), -1);
-  rb_define_method(cGeometry.klass, "type_id", VALUEFUNC(_wrap_Geometry_type_id), -1);
-  rb_define_method(cGeometry.klass, "normalize", VALUEFUNC(_wrap_Geometry_normalize), -1);
-  rb_define_method(cGeometry.klass, "srid", VALUEFUNC(_wrap_Geometry_srid), -1);
-  rb_define_method(cGeometry.klass, "srid=", VALUEFUNC(_wrap_Geometry_sride___), -1);
-  rb_define_method(cGeometry.klass, "dimensions", VALUEFUNC(_wrap_Geometry_dimensions), -1);
-  rb_define_method(cGeometry.klass, "num_geometries", VALUEFUNC(_wrap_Geometry_num_geometries), -1);
-  rb_define_method(cGeometry.klass, "intersection", VALUEFUNC(_wrap_Geometry_intersection), -1);
-  rb_define_method(cGeometry.klass, "buffer", VALUEFUNC(_wrap_Geometry_buffer), -1);
-  rb_define_method(cGeometry.klass, "convex_hull", VALUEFUNC(_wrap_Geometry_convex_hull), -1);
-  rb_define_method(cGeometry.klass, "difference", VALUEFUNC(_wrap_Geometry_difference), -1);
-  rb_define_method(cGeometry.klass, "sym_difference", VALUEFUNC(_wrap_Geometry_sym_difference), -1);
-  rb_define_method(cGeometry.klass, "boundary", VALUEFUNC(_wrap_Geometry_boundary), -1);
-  rb_define_method(cGeometry.klass, "union", VALUEFUNC(_wrap_Geometry_union), -1);
-  rb_define_method(cGeometry.klass, "point_on_surface", VALUEFUNC(_wrap_Geometry_point_on_surface), -1);
-  rb_define_method(cGeometry.klass, "centroid", VALUEFUNC(_wrap_Geometry_centroid), -1);
-  rb_define_alias(cGeometry.klass, "center", "centroid");
-  rb_define_method(cGeometry.klass, "envelope", VALUEFUNC(_wrap_Geometry_envelope), -1);
-  rb_define_method(cGeometry.klass, "relate", VALUEFUNC(_wrap_Geometry_relate), -1);
-  rb_define_method(cGeometry.klass, "line_merge", VALUEFUNC(_wrap_Geometry_line_merge), -1);
-  rb_define_method(cGeometry.klass, "simplify", VALUEFUNC(_wrap_Geometry_simplify), -1);
-  rb_define_method(cGeometry.klass, "topology_preserve_simplify", VALUEFUNC(_wrap_Geometry_topology_preserve_simplify), -1);
-  rb_define_method(cGeometry.klass, "relate_pattern", VALUEFUNC(_wrap_Geometry_relate_pattern), -1);
-  rb_define_method(cGeometry.klass, "disjoint?", VALUEFUNC(_wrap_Geometry_disjointq___), -1);
-  rb_define_method(cGeometry.klass, "touches?", VALUEFUNC(_wrap_Geometry_touchesq___), -1);
-  rb_define_method(cGeometry.klass, "intersects?", VALUEFUNC(_wrap_Geometry_intersectsq___), -1);
-  rb_define_method(cGeometry.klass, "crosses?", VALUEFUNC(_wrap_Geometry_crossesq___), -1);
-  rb_define_method(cGeometry.klass, "within?", VALUEFUNC(_wrap_Geometry_withinq___), -1);
-  rb_define_method(cGeometry.klass, "contains?", VALUEFUNC(_wrap_Geometry_containsq___), -1);
-  rb_define_method(cGeometry.klass, "overlaps?", VALUEFUNC(_wrap_Geometry_overlapsq___), -1);
-  rb_define_method(cGeometry.klass, "eql?", VALUEFUNC(_wrap_Geometry_eqlq___), -1);
-  rb_define_alias(cGeometry.klass, "==", "eql?");
-  rb_define_method(cGeometry.klass, "eql_exact?", VALUEFUNC(_wrap_Geometry_eql_exactq___), -1);
-  rb_define_method(cGeometry.klass, "empty?", VALUEFUNC(_wrap_Geometry_emptyq___), -1);
-  rb_define_method(cGeometry.klass, "valid?", VALUEFUNC(_wrap_Geometry_validq___), -1);
-  rb_define_method(cGeometry.klass, "simple?", VALUEFUNC(_wrap_Geometry_simpleq___), -1);
-  rb_define_method(cGeometry.klass, "ring?", VALUEFUNC(_wrap_Geometry_ringq___), -1);
-  rb_define_method(cGeometry.klass, "has_z?", VALUEFUNC(_wrap_Geometry_has_zq___), -1);
-  rb_define_method(cGeometry.klass, "area", VALUEFUNC(_wrap_Geometry_area), -1);
-  rb_define_method(cGeometry.klass, "length", VALUEFUNC(_wrap_Geometry_length), -1);
-  rb_define_method(cGeometry.klass, "distance", VALUEFUNC(_wrap_Geometry_distance), -1);
-  cGeometry.mark = 0;
-  cGeometry.destroy = (void (*)(void *)) free_GeosGeometry;
-  cGeometry.trackObjects = 0;
-  
-  cPoint.klass = rb_define_class_under(mGeos, "Point", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosPoint, (void *) &cPoint);
-  rb_undef_alloc_func(cPoint.klass);
-  rb_define_method(cPoint.klass, "coord_seq", VALUEFUNC(_wrap_Point_coord_seq), -1);
-  cPoint.mark = 0;
-  cPoint.destroy = (void (*)(void *)) free_GeosPoint;
-  cPoint.trackObjects = 0;
-  
-  cLineString.klass = rb_define_class_under(mGeos, "LineString", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosLineString, (void *) &cLineString);
-  rb_undef_alloc_func(cLineString.klass);
-  rb_define_method(cLineString.klass, "coord_seq", VALUEFUNC(_wrap_LineString_coord_seq), -1);
-  cLineString.mark = 0;
-  cLineString.destroy = (void (*)(void *)) free_GeosLineString;
-  cLineString.trackObjects = 0;
-  
-  cLinearRing.klass = rb_define_class_under(mGeos, "LinearRing", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosLinearRing, (void *) &cLinearRing);
-  rb_undef_alloc_func(cLinearRing.klass);
-  rb_define_method(cLinearRing.klass, "coord_seq", VALUEFUNC(_wrap_LinearRing_coord_seq), -1);
-  cLinearRing.mark = 0;
-  cLinearRing.destroy = (void (*)(void *)) free_GeosLinearRing;
-  cLinearRing.trackObjects = 0;
-  
-  cPolygon.klass = rb_define_class_under(mGeos, "Polygon", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosPolygon, (void *) &cPolygon);
-  rb_undef_alloc_func(cPolygon.klass);
-  rb_define_method(cPolygon.klass, "exterior_ring", VALUEFUNC(_wrap_Polygon_exterior_ring), -1);
-  rb_define_method(cPolygon.klass, "num_interior_rings", VALUEFUNC(_wrap_Polygon_num_interior_rings), -1);
-  rb_define_method(cPolygon.klass, "interior_ring_n", VALUEFUNC(_wrap_Polygon_interior_ring_n), -1);
-  cPolygon.mark = 0;
-  cPolygon.destroy = (void (*)(void *)) free_GeosPolygon;
-  cPolygon.trackObjects = 0;
-  
-  cGeometryCollection.klass = rb_define_class_under(mGeos, "GeometryCollection", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosGeometryCollection, (void *) &cGeometryCollection);
-  rb_undef_alloc_func(cGeometryCollection.klass);
-  rb_define_method(cGeometryCollection.klass, "get_geometry_n", VALUEFUNC(_wrap_GeometryCollection_get_geometry_n), -1);
-  cGeometryCollection.mark = 0;
-  cGeometryCollection.destroy = (void (*)(void *)) free_GeosGeometryCollection;
-  cGeometryCollection.trackObjects = 0;
-  
-  cMultiPoint.klass = rb_define_class_under(mGeos, "MultiPoint", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiPoint, (void *) &cMultiPoint);
-  rb_undef_alloc_func(cMultiPoint.klass);
-  cMultiPoint.mark = 0;
-  cMultiPoint.destroy = (void (*)(void *)) free_GeosMultiPoint;
-  cMultiPoint.trackObjects = 0;
-  
-  cMultiLineString.klass = rb_define_class_under(mGeos, "MultiLineString", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiLineString, (void *) &cMultiLineString);
-  rb_undef_alloc_func(cMultiLineString.klass);
-  cMultiLineString.mark = 0;
-  cMultiLineString.destroy = (void (*)(void *)) free_GeosMultiLineString;
-  cMultiLineString.trackObjects = 0;
-  
-  cMultiLinearRing.klass = rb_define_class_under(mGeos, "MultiLinearRing", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiLinearRing, (void *) &cMultiLinearRing);
-  rb_undef_alloc_func(cMultiLinearRing.klass);
-  cMultiLinearRing.mark = 0;
-  cMultiLinearRing.destroy = (void (*)(void *)) free_GeosMultiLinearRing;
-  cMultiLinearRing.trackObjects = 0;
-  
-  cMultiPolygon.klass = rb_define_class_under(mGeos, "MultiPolygon", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiPolygon, (void *) &cMultiPolygon);
-  rb_undef_alloc_func(cMultiPolygon.klass);
-  cMultiPolygon.mark = 0;
-  cMultiPolygon.destroy = (void (*)(void *)) free_GeosMultiPolygon;
-  cMultiPolygon.trackObjects = 0;
-  rb_define_module_function(mGeos, "create_point", VALUEFUNC(_wrap_create_point), -1);
-  rb_define_module_function(mGeos, "create_line_string", VALUEFUNC(_wrap_create_line_string), -1);
-  rb_define_module_function(mGeos, "create_linear_ring", VALUEFUNC(_wrap_create_linear_ring), -1);
-  rb_define_module_function(mGeos, "create_polygon", VALUEFUNC(_wrap_create_polygon), -1);
-  
-  cWktReader.klass = rb_define_class_under(mGeos, "WktReader", rb_cObject);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosWktReader, (void *) &cWktReader);
-  rb_define_alloc_func(cWktReader.klass, _wrap_WktReader_allocate);
-  rb_define_method(cWktReader.klass, "initialize", VALUEFUNC(_wrap_new_WktReader), -1);
-  rb_define_method(cWktReader.klass, "read", VALUEFUNC(_wrap_WktReader_read), -1);
-  cWktReader.mark = 0;
-  cWktReader.destroy = (void (*)(void *)) free_GeosWktReader;
-  cWktReader.trackObjects = 0;
-  
-  cWktWriter.klass = rb_define_class_under(mGeos, "WktWriter", rb_cObject);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosWktWriter, (void *) &cWktWriter);
-  rb_define_alloc_func(cWktWriter.klass, _wrap_WktWriter_allocate);
-  rb_define_method(cWktWriter.klass, "initialize", VALUEFUNC(_wrap_new_WktWriter), -1);
-  rb_define_method(cWktWriter.klass, "write", VALUEFUNC(_wrap_WktWriter_write), -1);
-  cWktWriter.mark = 0;
-  cWktWriter.destroy = (void (*)(void *)) free_GeosWktWriter;
-  cWktWriter.trackObjects = 0;
-  
-  cWkbReader.klass = rb_define_class_under(mGeos, "WkbReader", rb_cObject);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosWkbReader, (void *) &cWkbReader);
-  rb_define_alloc_func(cWkbReader.klass, _wrap_WkbReader_allocate);
-  rb_define_method(cWkbReader.klass, "initialize", VALUEFUNC(_wrap_new_WkbReader), -1);
-  rb_define_method(cWkbReader.klass, "read", VALUEFUNC(_wrap_WkbReader_read), -1);
-  rb_define_method(cWkbReader.klass, "read_hex", VALUEFUNC(_wrap_WkbReader_read_hex), -1);
-  cWkbReader.mark = 0;
-  cWkbReader.destroy = (void (*)(void *)) free_GeosWkbReader;
-  cWkbReader.trackObjects = 0;
-  
-  cWkbWriter.klass = rb_define_class_under(mGeos, "WkbWriter", rb_cObject);
-  SWIG_TypeClientData(SWIGTYPE_p_GeosWkbWriter, (void *) &cWkbWriter);
-  rb_define_alloc_func(cWkbWriter.klass, _wrap_WkbWriter_allocate);
-  rb_define_method(cWkbWriter.klass, "initialize", VALUEFUNC(_wrap_new_WkbWriter), -1);
-  rb_define_method(cWkbWriter.klass, "output_dimensions", VALUEFUNC(_wrap_WkbWriter_output_dimensions), -1);
-  rb_define_method(cWkbWriter.klass, "output_dimensions=", VALUEFUNC(_wrap_WkbWriter_output_dimensionse___), -1);
-  rb_define_method(cWkbWriter.klass, "byte_order", VALUEFUNC(_wrap_WkbWriter_byte_order), -1);
-  rb_define_method(cWkbWriter.klass, "byte_order=", VALUEFUNC(_wrap_WkbWriter_byte_ordere___), -1);
-  rb_define_method(cWkbWriter.klass, "include_srid", VALUEFUNC(_wrap_WkbWriter_include_srid), -1);
-  rb_define_method(cWkbWriter.klass, "include_srid=", VALUEFUNC(_wrap_WkbWriter_include_sride___), -1);
-  rb_define_method(cWkbWriter.klass, "write", VALUEFUNC(_wrap_WkbWriter_write), -1);
-  rb_define_method(cWkbWriter.klass, "write_hex", VALUEFUNC(_wrap_WkbWriter_write_hex), -1);
-  cWkbWriter.mark = 0;
-  cWkbWriter.destroy = (void (*)(void *)) free_GeosWkbWriter;
-  cWkbWriter.trackObjects = 0;
-}
-
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGRUBY
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+  struct SwigMovePointer {
+    T *ptr;
+    SwigMovePointer(T *p) : ptr(p) { }
+    ~SwigMovePointer() { delete ptr; }
+    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+  } pointer;
+  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+  SwigValueWrapper() : pointer(0) { }
+  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+  operator T&() const { return *pointer.ptr; }
+  T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the SWIG runtime code.
+  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+  
+  But only do this if strictly necessary, ie, if you have problems
+  with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The SWIG conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old versions of SWIG, code such as the following was usually written:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   which is the same really, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   also requires SWIG_ConvertPtr to return new result values, such as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   SWIG errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(iter->type->name, c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/* 
+  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (iter->type == from) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#include <ruby.h>
+
+/* Remove global macros defined in Ruby's win32.h */
+#ifdef write
+# undef write
+#endif
+#ifdef read
+# undef read
+#endif
+#ifdef bind
+# undef bind
+#endif
+#ifdef close
+# undef close
+#endif
+#ifdef connect
+# undef connect
+#endif
+
+
+/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
+#ifndef NUM2LL
+#define NUM2LL(x) NUM2LONG((x))
+#endif
+#ifndef LL2NUM
+#define LL2NUM(x) INT2NUM((long) (x))
+#endif
+#ifndef ULL2NUM
+#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
+#endif
+
+/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
+#ifndef NUM2ULL
+#ifdef HAVE_LONG_LONG
+#define NUM2ULL(x) rb_num2ull((x))
+#else
+#define NUM2ULL(x) NUM2ULONG(x)
+#endif
+#endif
+
+/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
+/* Define these for older versions so we can just write code the new way */
+#ifndef RSTRING_LEN
+# define RSTRING_LEN(x) RSTRING(x)->len
+#endif
+#ifndef RSTRING_PTR
+# define RSTRING_PTR(x) RSTRING(x)->ptr
+#endif
+#ifndef RSTRING_END
+# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
+#endif
+#ifndef RARRAY_LEN
+# define RARRAY_LEN(x) RARRAY(x)->len
+#endif
+#ifndef RARRAY_PTR
+# define RARRAY_PTR(x) RARRAY(x)->ptr
+#endif
+#ifndef RFLOAT_VALUE
+# define RFLOAT_VALUE(x) RFLOAT(x)->value
+#endif
+#ifndef DOUBLE2NUM
+# define DOUBLE2NUM(x) rb_float_new(x)
+#endif
+#ifndef RHASH_TBL
+# define RHASH_TBL(x) (RHASH(x)->tbl)
+#endif
+#ifndef RHASH_ITER_LEV
+# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
+#endif
+#ifndef RHASH_IFNONE
+# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
+#endif
+#ifndef RHASH_SIZE
+# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
+#endif
+#ifndef RHASH_EMPTY_P
+# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
+#endif
+#ifndef RSTRUCT_LEN
+# define RSTRUCT_LEN(x) RSTRUCT(x)->len
+#endif
+#ifndef RSTRUCT_PTR
+# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
+#endif
+
+
+
+/*
+ * Need to be very careful about how these macros are defined, especially
+ * when compiling C++ code or C code with an ANSI C compiler.
+ *
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
+ * a Ruby method so that it can be passed as an argument to API functions
+ * like rb_define_method() and rb_define_singleton_method().
+ *
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
+ * and Data_Make_Struct().
+ */
+ 
+#ifdef __cplusplus
+#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
+#    define PROTECTFUNC(f) ((VALUE (*)()) f)
+#    define VALUEFUNC(f) ((VALUE (*)()) f)
+#    define VOIDFUNC(f)  ((void (*)()) f)
+#  else
+#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
+#      define PROTECTFUNC(f) ((VALUE (*)()) f)
+#      define VALUEFUNC(f) ((VALUE (*)()) f)
+#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
+#    else /* These definitions should work for Ruby 1.7+ */
+#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
+#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
+#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
+#    endif
+#  endif
+#else
+#  define VALUEFUNC(f) (f)
+#  define VOIDFUNC(f) (f)
+#endif
+
+/* Don't use for expressions have side effect */
+#ifndef RB_STRING_VALUE
+#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
+#endif
+#ifndef StringValue
+#define StringValue(s) RB_STRING_VALUE(s)
+#endif
+#ifndef StringValuePtr
+#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
+#endif
+#ifndef StringValueLen
+#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
+#endif
+#ifndef SafeStringValue
+#define SafeStringValue(v) do {\
+    StringValue(v);\
+    rb_check_safe_str(v);\
+} while (0)
+#endif
+
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
+#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
+#endif
+
+static VALUE _mSWIG = Qnil;
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+
+/* Define some additional error types */
+#define SWIG_ObjectPreviouslyDeletedError  -100
+
+
+/* Define custom exceptions for errors that do not map to existing Ruby
+   exceptions.  Note this only works for C++ since a global cannot be
+   initialized by a funtion in C.  For C, fallback to rb_eRuntimeError.*/
+
+SWIGINTERN VALUE 
+getNullReferenceError(void) {
+  static int init = 0;
+  static VALUE rb_eNullReferenceError ;
+  if (!init) {
+    init = 1;
+    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
+  }
+  return rb_eNullReferenceError;
+} 
+
+SWIGINTERN VALUE 
+getObjectPreviouslyDeletedError(void) {
+  static int init = 0;
+  static VALUE rb_eObjectPreviouslyDeleted ;
+  if (!init) {
+    init = 1;
+    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
+  }
+  return rb_eObjectPreviouslyDeleted;
+} 
+
+
+SWIGINTERN VALUE
+SWIG_Ruby_ErrorType(int SWIG_code) {
+  VALUE type;
+  switch (SWIG_code) {
+  case SWIG_MemoryError:
+    type = rb_eNoMemError;
+    break;
+  case SWIG_IOError:
+    type = rb_eIOError;
+    break;
+  case SWIG_RuntimeError:
+    type = rb_eRuntimeError;
+    break;
+  case SWIG_IndexError:
+    type = rb_eIndexError;
+    break;
+  case SWIG_TypeError:
+    type = rb_eTypeError;
+    break;
+  case SWIG_DivisionByZero:
+    type = rb_eZeroDivError;
+    break;
+  case SWIG_OverflowError:
+    type = rb_eRangeError;
+    break;
+  case SWIG_SyntaxError:
+    type = rb_eSyntaxError;
+    break;
+  case SWIG_ValueError:
+    type = rb_eArgError;
+    break;
+  case SWIG_SystemError:
+    type = rb_eFatal;
+    break;
+  case SWIG_AttributeError:
+    type = rb_eRuntimeError;
+    break;
+  case SWIG_NullReferenceError:
+    type = getNullReferenceError();
+    break;
+  case SWIG_ObjectPreviouslyDeletedError:
+    type = getObjectPreviouslyDeletedError();
+    break;
+  case SWIG_UnknownError:
+    type = rb_eRuntimeError;
+    break;
+  default:
+    type = rb_eRuntimeError;
+  }
+  return type;
+}
+
+
+/* This function is called when a user inputs a wrong argument to
+   a method.
+ */
+SWIGINTERN 
+const char* Ruby_Format_TypeError( const char* msg,
+				   const char* type, 
+				   const char* name, 
+				   const int argn,
+				   VALUE input )
+{
+  char buf[128];
+  VALUE str;
+  VALUE asStr;
+  if ( msg && *msg )
+    {
+      str = rb_str_new2(msg);
+    }
+  else
+    {
+      str = rb_str_new(NULL, 0);
+    }
+
+  str = rb_str_cat2( str, "Expected argument " );
+  sprintf( buf, "%d of type ", argn-1 );
+  str = rb_str_cat2( str, buf );
+  str = rb_str_cat2( str, type );
+  str = rb_str_cat2( str, ", but got " );
+  str = rb_str_cat2( str, rb_obj_classname(input) );
+  str = rb_str_cat2( str, " " );
+  asStr = rb_inspect(input);
+  if ( RSTRING_LEN(asStr) > 30 )
+    {
+      str = rb_str_cat( str, StringValuePtr(asStr), 30 );
+      str = rb_str_cat2( str, "..." );
+    }
+  else
+    {
+      str = rb_str_append( str, asStr );
+    }
+
+  if ( name )
+    {
+      str = rb_str_cat2( str, "\n\tin SWIG method '" );
+      str = rb_str_cat2( str, name );
+      str = rb_str_cat2( str, "'" );
+    }
+
+  return StringValuePtr( str );
+}
+
+/* This function is called when an overloaded method fails */
+SWIGINTERN 
+void Ruby_Format_OverloadedError(
+				 const int argc,
+				 const int maxargs,
+				 const char* method, 
+				 const char* prototypes 
+				 )
+{
+  const char* msg = "Wrong # of arguments";
+  if ( argc <= maxargs ) msg = "Wrong arguments";
+  rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"  
+	   "Possible C/C++ prototypes are:\n%s",
+	   msg, method, prototypes);
+}
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * rubytracking.swg
+ *
+ * This file contains support for tracking mappings from 
+ * Ruby objects to C++ objects.  This functionality is needed
+ * to implement mark functions for Ruby's mark and sweep
+ * garbage collector.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Ruby 1.8 actually assumes the first case. */
+#if SIZEOF_VOIDP == SIZEOF_LONG
+#  define SWIG2NUM(v) LONG2NUM((unsigned long)v)
+#  define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
+#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
+#  define SWIG2NUM(v) LL2NUM((unsigned long long)v)
+#  define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
+#else
+#  error sizeof(void*) is not the same as long or long long
+#endif
+
+
+/* Global Ruby hash table to store Trackings from C/C++
+   structs to Ruby Objects. 
+*/
+static VALUE swig_ruby_trackings = Qnil;
+
+/* Global variable that stores a reference to the ruby
+   hash table delete function. */
+static ID swig_ruby_hash_delete;
+
+/* Setup a Ruby hash table to store Trackings */
+SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
+  /* Create a ruby hash table to store Trackings from C++ 
+     objects to Ruby objects. */
+
+  /* Try to see if some other .so has already created a 
+     tracking hash table, which we keep hidden in an instance var
+     in the SWIG module.
+     This is done to allow multiple DSOs to share the same
+     tracking table.
+  */
+  ID trackings_id = rb_intern( "@__trackings__" );
+  VALUE verbose = rb_gv_get("VERBOSE");
+  rb_gv_set("VERBOSE", Qfalse);
+  swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
+  rb_gv_set("VERBOSE", verbose);
+
+  /* No, it hasn't.  Create one ourselves */ 
+  if ( swig_ruby_trackings == Qnil )
+    {
+      swig_ruby_trackings = rb_hash_new();
+      rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
+    }
+
+  /* Now store a reference to the hash table delete function
+     so that we only have to look it up once.*/
+  swig_ruby_hash_delete = rb_intern("delete");
+}
+
+/* Get a Ruby number to reference a pointer */
+SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
+  /* We cast the pointer to an unsigned long
+     and then store a reference to it using
+     a Ruby number object. */
+
+  /* Convert the pointer to a Ruby number */
+  return SWIG2NUM(ptr);
+}
+
+/* Get a Ruby number to reference an object */
+SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
+  /* We cast the object to an unsigned long
+     and then store a reference to it using
+     a Ruby number object. */
+
+  /* Convert the Object to a Ruby number */
+  return SWIG2NUM(object);
+}
+
+/* Get a Ruby object from a previously stored reference */
+SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
+  /* The provided Ruby number object is a reference
+     to the Ruby object we want.*/
+
+  /* Convert the Ruby number to a Ruby object */
+  return NUM2SWIG(reference);
+}
+
+/* Add a Tracking from a C/C++ struct to a Ruby object */
+SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
+  /* In a Ruby hash table we store the pointer and
+     the associated Ruby object.  The trick here is
+     that we cannot store the Ruby object directly - if
+     we do then it cannot be garbage collected.  So
+     instead we typecast it as a unsigned long and
+     convert it to a Ruby number object.*/
+
+  /* Get a reference to the pointer as a Ruby number */
+  VALUE key = SWIG_RubyPtrToReference(ptr);
+
+  /* Get a reference to the Ruby object as a Ruby number */
+  VALUE value = SWIG_RubyObjectToReference(object);
+
+  /* Store the mapping to the global hash table. */
+  rb_hash_aset(swig_ruby_trackings, key, value);
+}
+
+/* Get the Ruby object that owns the specified C/C++ struct */
+SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
+  /* Get a reference to the pointer as a Ruby number */
+  VALUE key = SWIG_RubyPtrToReference(ptr);
+
+  /* Now lookup the value stored in the global hash table */
+  VALUE value = rb_hash_aref(swig_ruby_trackings, key);
+	
+  if (value == Qnil) {
+    /* No object exists - return nil. */
+    return Qnil;
+  }
+  else {
+    /* Convert this value to Ruby object */
+    return SWIG_RubyReferenceToObject(value);
+  }
+}
+
+/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
+   is very important to remove objects once they are destroyed
+   since the same memory address may be reused later to create
+   a new object. */
+SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
+  /* Get a reference to the pointer as a Ruby number */
+  VALUE key = SWIG_RubyPtrToReference(ptr);
+
+  /* Delete the object from the hash table by calling Ruby's
+     do this we need to call the Hash.delete method.*/
+  rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
+}
+
+/* This is a helper method that unlinks a Ruby object from its
+   underlying C++ object.  This is needed if the lifetime of the
+   Ruby object is longer than the C++ object */
+SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
+  VALUE object = SWIG_RubyInstanceFor(ptr);
+
+  if (object != Qnil) {
+    DATA_PTR(object) = 0;
+  }
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Ruby API portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGINTERN VALUE
+SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
+  if (NIL_P(target)) {
+    target = o;
+  } else {
+    if (TYPE(target) != T_ARRAY) {
+      VALUE o2 = target;
+      target = rb_ary_new();
+      rb_ary_push(target, o2);
+    }
+    rb_ary_push(target, o);
+  }
+  return target;
+}
+
+/* For ruby1.8.4 and earlier. */
+#ifndef RUBY_INIT_STACK
+   RUBY_EXTERN void Init_stack(VALUE* addr);
+#  define RUBY_INIT_STACK \
+   VALUE variable_in_this_stack_frame; \
+   Init_stack(&variable_in_this_stack_frame);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * rubyrun.swg
+ *
+ * This file contains the runtime support for Ruby modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
+#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
+#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
+#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
+#define swig_owntype                                    ruby_owntype
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
+#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule()	
+#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
+#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail				 
+
+
+/* Ruby-specific SWIG API */
+
+#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
+#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
+#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
+#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
+#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  
+
+#include "assert.h"
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+  VALUE klass;
+  VALUE mImpl;
+  void  (*mark)(void *);
+  void  (*destroy)(void *);
+  int trackObjects;
+} swig_class;
+
+
+/* Global pointer used to keep some internal SWIG stuff */
+static VALUE _cSWIG_Pointer = Qnil;
+static VALUE swig_runtime_data_type_pointer = Qnil;
+
+/* Global IDs used to keep some internal SWIG stuff */
+static ID swig_arity_id = 0;
+static ID swig_call_id  = 0;
+
+/*
+  If your swig extension is to be run within an embedded ruby and has
+  director callbacks, you should set -DRUBY_EMBEDDED during compilation.  
+  This will reset ruby's stack frame on each entry point from the main 
+  program the first time a virtual director function is invoked (in a 
+  non-recursive way).
+  If this is not done, you run the risk of Ruby trashing the stack.
+*/
+
+#ifdef RUBY_EMBEDDED
+
+#  define SWIG_INIT_STACK                            \
+      if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
+      ++swig_virtual_calls;
+#  define SWIG_RELEASE_STACK --swig_virtual_calls;
+#  define Ruby_DirectorTypeMismatchException(x) \
+          rb_raise( rb_eTypeError, x ); return c_result;
+
+      static unsigned int swig_virtual_calls = 0;
+
+#else  /* normal non-embedded extension */
+
+#  define SWIG_INIT_STACK
+#  define SWIG_RELEASE_STACK
+#  define Ruby_DirectorTypeMismatchException(x) \
+          throw Swig::DirectorTypeMismatchException( x );
+
+#endif  /* RUBY_EMBEDDED */
+
+
+SWIGRUNTIME VALUE 
+getExceptionClass(void) {
+  static int init = 0;
+  static VALUE rubyExceptionClass ;
+  if (!init) {
+    init = 1;
+    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
+  }
+  return rubyExceptionClass;
+} 
+
+/* This code checks to see if the Ruby object being raised as part
+   of an exception inherits from the Ruby class Exception.  If so,
+   the object is simply returned.  If not, then a new Ruby exception
+   object is created and that will be returned to Ruby.*/
+SWIGRUNTIME VALUE
+SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
+  VALUE exceptionClass = getExceptionClass();
+  if (rb_obj_is_kind_of(obj, exceptionClass)) {
+    return obj;
+  }  else {
+    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
+  }
+}
+
+/* Initialize Ruby runtime support */
+SWIGRUNTIME void
+SWIG_Ruby_InitRuntime(void)
+{
+  if (_mSWIG == Qnil) {
+    _mSWIG = rb_define_module("SWIG");
+    swig_call_id  = rb_intern("call");
+    swig_arity_id = rb_intern("arity");
+  }
+}
+
+/* Define Ruby class for C type */
+SWIGRUNTIME void
+SWIG_Ruby_define_class(swig_type_info *type)
+{
+  VALUE klass;
+  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
+  sprintf(klass_name, "TYPE%s", type->name);
+  if (NIL_P(_cSWIG_Pointer)) {
+    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
+    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
+  }
+  klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
+  free((void *) klass_name);
+}
+
+/* Create a new pointer object */
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
+{
+  int own =  flags & SWIG_POINTER_OWN; 
+  int track;
+  char *klass_name;
+  swig_class *sklass;
+  VALUE klass;
+  VALUE obj;
+  
+  if (!ptr)
+    return Qnil;
+  
+  if (type->clientdata) {
+    sklass = (swig_class *) type->clientdata;
+		
+    /* Are we tracking this class and have we already returned this Ruby object? */
+    track = sklass->trackObjects;
+    if (track) {
+      obj = SWIG_RubyInstanceFor(ptr);
+      
+      /* Check the object's type and make sure it has the correct type.
+        It might not in cases where methods do things like 
+        downcast methods. */
+      if (obj != Qnil) {
+        VALUE value = rb_iv_get(obj, "@__swigtype__");
+        char* type_name = RSTRING_PTR(value);
+				
+        if (strcmp(type->name, type_name) == 0) {
+          return obj;
+        }
+      }
+    }
+
+    /* Create a new Ruby object */
+    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), 
+			   ( own ? VOIDFUNC(sklass->destroy) : 
+			     (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
+			     ), ptr);
+
+    /* If tracking is on for this class then track this object. */
+    if (track) {
+      SWIG_RubyAddTracking(ptr, obj);
+    }
+  } else {
+    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
+    sprintf(klass_name, "TYPE%s", type->name);
+    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
+    free((void *) klass_name);
+    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
+  }
+  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
+  
+  return obj;
+}
+
+/* Create a new class instance (always owned) */
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
+{
+  VALUE obj;
+  swig_class *sklass = (swig_class *) type->clientdata;
+  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
+  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
+  return obj;
+}
+
+/* Get type mangle from class name */
+SWIGRUNTIMEINLINE char *
+SWIG_Ruby_MangleStr(VALUE obj)
+{
+  VALUE stype = rb_iv_get(obj, "@__swigtype__");
+  return StringValuePtr(stype);
+}
+
+/* Acquire a pointer value */
+typedef void (*ruby_owntype)(void*);
+
+SWIGRUNTIME ruby_owntype
+SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
+  if (obj) {
+    ruby_owntype oldown = RDATA(obj)->dfree;
+    RDATA(obj)->dfree = own;
+    return oldown;
+  } else {
+    return 0;
+  }
+}
+
+/* Convert a pointer value */
+SWIGRUNTIME int
+SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
+{
+  char *c;
+  swig_cast_info *tc;
+  void *vptr = 0;
+
+  /* Grab the pointer */
+  if (NIL_P(obj)) {
+    *ptr = 0;
+    return SWIG_OK;
+  } else {
+    if (TYPE(obj) != T_DATA) {
+      return SWIG_ERROR;
+    }
+    Data_Get_Struct(obj, void, vptr);
+  }
+  
+  if (own) *own = RDATA(obj)->dfree;
+    
+  /* Check to see if the input object is giving up ownership
+     of the underlying C struct or C++ object.  If so then we
+     need to reset the destructor since the Ruby object no 
+     longer owns the underlying C++ object.*/ 
+  if (flags & SWIG_POINTER_DISOWN) {
+    /* Is tracking on for this class? */
+    int track = 0;
+    if (ty && ty->clientdata) {
+      swig_class *sklass = (swig_class *) ty->clientdata;
+      track = sklass->trackObjects;
+    }
+		
+    if (track) {
+      /* We are tracking objects for this class.  Thus we change the destructor
+       * to SWIG_RubyRemoveTracking.  This allows us to
+       * remove the mapping from the C++ to Ruby object
+       * when the Ruby object is garbage collected.  If we don't
+       * do this, then it is possible we will return a reference 
+       * to a Ruby object that no longer exists thereby crashing Ruby. */
+      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
+    } else {    
+      RDATA(obj)->dfree = 0;
+    }
+  }
+
+  /* Do type-checking if type info was provided */
+  if (ty) {
+    if (ty->clientdata) {
+      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
+        if (vptr == 0) {
+          /* The object has already been deleted */
+          return SWIG_ObjectPreviouslyDeletedError;
+        }
+        *ptr = vptr;
+        return SWIG_OK;
+      }
+    }
+    if ((c = SWIG_MangleStr(obj)) == NULL) {
+      return SWIG_ERROR;
+    }
+    tc = SWIG_TypeCheck(c, ty);
+    if (!tc) {
+      return SWIG_ERROR;
+    } else {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = vptr;
+  }
+  
+  return SWIG_OK;
+}
+
+/* Check convert */
+SWIGRUNTIMEINLINE int
+SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
+{
+  char *c = SWIG_MangleStr(obj);
+  if (!c) return 0;
+  return SWIG_TypeCheck(c,ty) != 0;
+}
+
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r, ptr, sz);
+  strcpy(r, type->name);
+  return rb_str_new2(result);
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c;
+
+  if (TYPE(obj) != T_STRING) goto type_error;
+  c = StringValuePtr(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') goto type_error;
+  c++;
+  c = SWIG_UnpackData(c, ptr, sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c, ty);
+    if (!tc) goto type_error;
+  }
+  return SWIG_OK;
+
+ type_error:
+  return SWIG_ERROR;
+}
+
+SWIGRUNTIME swig_module_info *
+SWIG_Ruby_GetModule(void)
+{
+  VALUE pointer;
+  swig_module_info *ret = 0;
+  VALUE verbose = rb_gv_get("VERBOSE");
+
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
+  rb_gv_set("VERBOSE", Qfalse);
+  
+  /* first check if pointer already created */
+  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+  if (pointer != Qnil) {
+    Data_Get_Struct(pointer, swig_module_info, ret);
+  }
+
+  /* reinstate warnings */
+  rb_gv_set("VERBOSE", verbose);
+  return ret;
+}
+
+SWIGRUNTIME void 
+SWIG_Ruby_SetModule(swig_module_info *pointer)
+{
+  /* register a new class */
+  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
+  /* create and store the structure pointer to a global variable */
+  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
+  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
+}
+
+/* This function can be used to check whether a proc or method or similarly
+   callable function has been passed.  Usually used in a %typecheck, like:
+
+   %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
+        $result = SWIG_Ruby_isCallable( $input );
+   }
+ */
+SWIGINTERN
+int SWIG_Ruby_isCallable( VALUE proc )
+{
+  if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
+    return 1;
+  return 0;
+}
+
+/* This function can be used to check the arity (number of arguments)
+   a proc or method can take.  Usually used in a %typecheck.
+   Valid arities will be that equal to minimal or those < 0
+   which indicate a variable number of parameters at the end.
+ */
+SWIGINTERN
+int SWIG_Ruby_arity( VALUE proc, int minimal )
+{
+  if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
+    {
+      VALUE num = rb_funcall( proc, swig_arity_id, 0 );
+      int arity = NUM2INT(num);
+      if ( arity < 0 && (arity+1) < -minimal ) return 1;
+      if ( arity == minimal ) return 1;
+      return 1;
+    }
+  return 0;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_GeosCoordinateSequence swig_types[0]
+#define SWIGTYPE_p_GeosGeometry swig_types[1]
+#define SWIGTYPE_p_GeosGeometryCollection swig_types[2]
+#define SWIGTYPE_p_GeosLineString swig_types[3]
+#define SWIGTYPE_p_GeosLinearRing swig_types[4]
+#define SWIGTYPE_p_GeosMultiLineString swig_types[5]
+#define SWIGTYPE_p_GeosMultiLinearRing swig_types[6]
+#define SWIGTYPE_p_GeosMultiPoint swig_types[7]
+#define SWIGTYPE_p_GeosMultiPolygon swig_types[8]
+#define SWIGTYPE_p_GeosPoint swig_types[9]
+#define SWIGTYPE_p_GeosPolygon swig_types[10]
+#define SWIGTYPE_p_GeosPreparedGeometry swig_types[11]
+#define SWIGTYPE_p_GeosSTRtree swig_types[12]
+#define SWIGTYPE_p_GeosWkbReader swig_types[13]
+#define SWIGTYPE_p_GeosWkbWriter swig_types[14]
+#define SWIGTYPE_p_GeosWktReader swig_types[15]
+#define SWIGTYPE_p_GeosWktWriter swig_types[16]
+#define SWIGTYPE_p_char swig_types[17]
+#define SWIGTYPE_p_p_GeosLinearRing swig_types[18]
+#define SWIGTYPE_p_p_void swig_types[19]
+#define SWIGTYPE_p_size_t swig_types[20]
+#define SWIGTYPE_p_swig__ConstIterator swig_types[21]
+#define SWIGTYPE_p_swig__GC_VALUE swig_types[22]
+#define SWIGTYPE_p_swig__Iterator swig_types[23]
+#define SWIGTYPE_p_unsigned_char swig_types[24]
+static swig_type_info *swig_types[26];
+static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    Init_geos
+#define SWIG_name    "Geos"
+
+static VALUE mGeos;
+
+#define SWIG_RUBY_THREAD_BEGIN_BLOCK
+#define SWIG_RUBY_THREAD_END_BLOCK
+
+
+#define SWIGVERSION 0x010340 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#include <string>
+
+
+#include <iostream>
+
+
+#include <stdexcept>
+
+
+namespace swig {
+  class GC_VALUE {
+  protected:
+    // Hash of all GC_VALUE's currently in use
+    static VALUE _hash;
+
+    VALUE  _obj;
+
+    static ID hash_id;
+    static ID   lt_id;
+    static ID   gt_id;
+    static ID   eq_id;
+    static ID   le_id;
+    static ID   ge_id;
+
+    static ID  pos_id;
+    static ID  neg_id;
+    static ID  inv_id;
+
+    static ID  add_id;
+    static ID  sub_id;
+    static ID  mul_id;
+    static ID  div_id;
+    static ID  mod_id;
+
+    static ID  and_id;
+    static ID   or_id;
+    static ID  xor_id;
+
+    static ID  lshift_id;
+    static ID  rshift_id;
+
+    struct OpArgs
+    {
+      VALUE src;
+      ID    id;
+      int   nargs;
+      VALUE target;
+    };
+
+
+  public:
+    static void initialize()
+    {
+      if ( _hash == Qnil ) 
+	{ 
+	  _hash = rb_hash_new();
+	  rb_gc_register_address( &_hash );
+	}
+    }
+
+    // this function is never called.  Provided for symmetry only.
+    static void cleanup()
+    {
+      rb_gc_unregister_address( &_hash );
+    }
+
+    GC_VALUE() : _obj( Qnil )
+    {
+    }
+
+    GC_VALUE(const GC_VALUE& item) : _obj(item._obj)
+    {
+      GC_register();
+    }
+    
+    GC_VALUE(VALUE obj) :_obj(obj)
+    {
+      GC_register();
+    }
+    
+    ~GC_VALUE() 
+    {
+      GC_unregister();
+    }
+    
+    GC_VALUE & operator=(const GC_VALUE& item) 
+    {
+      GC_unregister();
+      _obj = item._obj;
+      GC_register();
+      return *this;
+    }
+
+    void GC_register()
+    {
+      if ( FIXNUM_P(_obj) || SPECIAL_CONST_P(_obj) || SYMBOL_P(_obj) ) 
+	return;
+      VALUE val = rb_hash_aref( _hash, _obj );
+      unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 0;
+      ++n;
+      rb_hash_aset( _hash, _obj, INT2NUM(n) );
+    }
+
+    void GC_unregister()
+    {
+      if ( FIXNUM_P(_obj) || SPECIAL_CONST_P(_obj) || SYMBOL_P(_obj) ) 
+	return;
+      // this test should not be needed but I've noticed some very erratic
+      // behavior of none being unregistered in some very rare situations.
+      if ( BUILTIN_TYPE(_obj) == T_NONE ) return;
+
+      VALUE val = rb_hash_aref( _hash, _obj );
+      unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 1;
+      --n;
+      if ( n )
+	rb_hash_aset( _hash, _obj, INT2NUM(n) );
+      else
+	rb_hash_delete( _hash, _obj );
+    }
+    
+    operator VALUE() const
+    {
+      return _obj;
+    }
+
+    VALUE inspect() const
+    {
+      return rb_inspect(_obj);
+    }
+
+    VALUE to_s() const
+    {
+      return rb_inspect(_obj);
+    }
+
+    static VALUE swig_protect_funcall( VALUE p )
+    {
+      OpArgs* args = (OpArgs*) p;
+      return rb_funcall( args->src, args->id, args->nargs, args->target );
+    }
+
+
+#define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \
+    bool op( const GC_VALUE& other ) const \
+    { \
+      if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \
+      { \
+	return _obj cmp other._obj; \
+      } \
+      bool  res = false; \
+      VALUE ret = Qnil; \
+      SWIG_RUBY_THREAD_BEGIN_BLOCK; \
+      if ( rb_respond_to( _obj, op_id ) == Qtrue ) \
+	{ \
+	  int status; \
+	  OpArgs  args; \
+          args.src    = _obj; \
+	  args.id     = op_id; \
+	  args.nargs  = 1; \
+	  args.target = VALUE(other); \
+	  ret = rb_protect( PROTECTFUNC(swig_protect_funcall), \
+                            VALUE(&args), &status ); \
+	} \
+      if ( ret == Qnil ) { \
+	VALUE a = rb_funcall(         _obj, hash_id, 0 ); \
+	VALUE b = rb_funcall( VALUE(other), hash_id, 0 ); \
+	res = a cmp b; \
+      } \
+      else \
+	{ \
+	  res = RTEST( ret ); \
+	} \
+      SWIG_RUBY_THREAD_END_BLOCK; \
+      return res; \
+    }
+
+
+    GC_VALUE_CMP( eq_id, operator==, ==, == 0 )
+    GC_VALUE_CMP( lt_id, operator<,  < , <  0 )
+    GC_VALUE_CMP( le_id, operator<=, <=, <= 0 )
+    GC_VALUE_CMP( gt_id, operator>,  > , >  0 )
+    GC_VALUE_CMP( ge_id, operator>=, >=, >= 0 )
+#undef GC_VALUE_CMP
+
+    bool operator!=( const GC_VALUE& other )
+    {
+      return !(this->operator==(other));
+    }
+
+#define GC_VALUE_UNARY( proc_id, op ) \
+    GC_VALUE op() const \
+    { \
+      VALUE ret = Qnil; \
+      SWIG_RUBY_THREAD_BEGIN_BLOCK; \
+      int status; \
+      OpArgs  args; \
+      args.src    = _obj; \
+      args.id     = proc_id; \
+      args.nargs  = 0; \
+      args.target = Qnil; \
+      ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(&args), \
+			&status ); \
+      SWIG_RUBY_THREAD_END_BLOCK; \
+      return ret; \
+    }
+
+    GC_VALUE_UNARY( pos_id, operator+ )
+    GC_VALUE_UNARY( neg_id, operator- )
+    GC_VALUE_UNARY( inv_id, operator~ )
+#undef GC_VALUE_BINARY
+
+#define GC_VALUE_BINARY( proc_id, op ) \
+    GC_VALUE op( const GC_VALUE& other ) const \
+    { \
+      VALUE ret = Qnil; \
+      SWIG_RUBY_THREAD_BEGIN_BLOCK; \
+      int status; \
+      OpArgs  args; \
+      args.src    = _obj; \
+      args.id     = proc_id; \
+      args.nargs  = 1; \
+      args.target = VALUE(other); \
+      ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(&args), \
+			&status ); \
+      SWIG_RUBY_THREAD_END_BLOCK; \
+      return GC_VALUE(ret); \
+    }
+
+    GC_VALUE_BINARY( add_id, operator+ );
+    GC_VALUE_BINARY( sub_id, operator- );
+    GC_VALUE_BINARY( mul_id, operator* );
+    GC_VALUE_BINARY( div_id, operator/ );
+    GC_VALUE_BINARY( mod_id, operator% );
+    
+    GC_VALUE_BINARY( and_id, operator& );
+    GC_VALUE_BINARY( xor_id, operator^ );
+    GC_VALUE_BINARY(  or_id, operator| );
+
+    GC_VALUE_BINARY( lshift_id, operator<< );
+    GC_VALUE_BINARY( rshift_id, operator>> );
+#undef GC_VALUE_BINARY
+
+  };
+
+  ID  GC_VALUE::hash_id = rb_intern("hash");
+  ID  GC_VALUE::lt_id = rb_intern("<");
+  ID  GC_VALUE::gt_id = rb_intern(">");
+  ID  GC_VALUE::eq_id = rb_intern("==");
+  ID  GC_VALUE::le_id = rb_intern("<=");
+  ID  GC_VALUE::ge_id = rb_intern(">=");
+
+  ID  GC_VALUE::pos_id = rb_intern("+@");
+  ID  GC_VALUE::neg_id = rb_intern("-@");
+  ID  GC_VALUE::inv_id = rb_intern("~");
+
+  ID  GC_VALUE::add_id = rb_intern("+");
+  ID  GC_VALUE::sub_id = rb_intern("-");
+  ID  GC_VALUE::mul_id = rb_intern("*");
+  ID  GC_VALUE::div_id = rb_intern("/");
+  ID  GC_VALUE::mod_id = rb_intern("%");
+
+  ID  GC_VALUE::and_id = rb_intern("&");
+  ID  GC_VALUE::or_id  = rb_intern("|");
+  ID  GC_VALUE::xor_id = rb_intern("^");
+
+  ID  GC_VALUE::lshift_id = rb_intern("<<");
+  ID  GC_VALUE::rshift_id = rb_intern(">>");
+
+  VALUE GC_VALUE::_hash = Qnil;
+
+  typedef GC_VALUE LANGUAGE_OBJ;
+
+} // namespace swig
+
+
+
+#if defined(__GNUC__)
+#  if __GNUC__ == 2 && __GNUC_MINOR <= 96
+#     define SWIG_STD_NOMODERN_STL
+#  endif
+#endif
+
+
+#include <string>
+#include <stdexcept>
+
+  
+namespace swig {
+  struct stop_iteration {
+  };
+
+  /** 
+   * Abstract base class used to represent all iterators of STL containers.
+   */
+  struct ConstIterator {
+  public:
+    typedef ConstIterator self_type;
+
+  protected:
+    GC_VALUE _seq;
+
+  protected:
+    ConstIterator(VALUE seq) : _seq(seq)
+    {
+    }
+
+    // Random access iterator methods, but not required in Ruby
+    virtual ptrdiff_t distance(const ConstIterator &x) const
+    {
+      throw std::invalid_argument("distance not supported");
+    }
+
+    virtual bool equal (const ConstIterator &x) const
+    {
+      throw std::invalid_argument("equal not supported");
+    }
+
+    virtual self_type* advance(ptrdiff_t n)
+    {
+      throw std::invalid_argument("advance not supported");
+    }
+      
+  public:
+    virtual ~ConstIterator() {}
+
+    // Access iterator method, required by Ruby
+    virtual VALUE value() const {
+      throw std::invalid_argument("value not supported");
+      return Qnil;
+    };
+
+    virtual VALUE setValue( const VALUE& v ) {
+      throw std::invalid_argument("value= not supported");
+      return Qnil;
+    }
+
+    virtual self_type* next( size_t n = 1 )
+    {
+      return this->advance( n );
+    }
+
+    virtual self_type* previous( size_t n = 1 )
+    {
+      ptrdiff_t nn = n;
+      return this->advance( -nn );
+    }
+
+    virtual VALUE to_s() const {
+      throw std::invalid_argument("to_s not supported");
+      return Qnil;
+    }
+
+    virtual VALUE inspect() const {
+      throw std::invalid_argument("inspect not supported");
+      return Qnil;
+    }
+    
+    virtual ConstIterator *dup() const
+    {
+      throw std::invalid_argument("dup not supported");
+      return NULL;
+    }
+
+    //
+    // C++ common/needed methods.  We emulate a bidirectional
+    // operator, to be compatible with all the STL.
+    // The iterator traits will then tell the STL what type of
+    // iterator we really are.
+    //
+    ConstIterator() : _seq( Qnil )
+    {
+    }
+
+    ConstIterator( const self_type& b ) : _seq( b._seq )
+    {
+    }
+
+    self_type& operator=( const self_type& b )
+    {
+      _seq = b._seq;
+      return *this;
+    }
+
+    bool operator == (const ConstIterator& x)  const
+    {
+      return equal(x);
+    }
+      
+    bool operator != (const ConstIterator& x) const
+    {
+      return ! operator==(x);
+    }
+      
+    // Pre-decrement operator
+    self_type& operator--()
+    {
+      return *previous();
+    }
+
+    // Pre-increment operator
+    self_type& operator++()
+    {
+      return *next();
+    }
+
+    // Post-decrement operator
+    self_type operator--(int)
+    {
+      self_type r = *this;
+      previous();
+      return r;
+    }
+
+    // Post-increment operator
+    self_type operator++(int)
+    {
+      self_type r = *this;
+      next();
+      return r;
+    }
+
+    ConstIterator& operator += (ptrdiff_t n)
+    {
+      return *advance(n);
+    }
+
+    ConstIterator& operator -= (ptrdiff_t n)
+    {
+      return *advance(-n);
+    }
+
+    ConstIterator* operator + (ptrdiff_t n) const
+    {
+      return dup()->advance(n);
+    }
+
+    ConstIterator* operator - (ptrdiff_t n) const
+    {
+      return dup()->advance(-n);
+    }
+      
+    ptrdiff_t operator - (const ConstIterator& x) const
+    {
+      return x.distance(*this);
+    }
+      
+    static swig_type_info* descriptor() {
+      static int init = 0;
+      static swig_type_info* desc = 0;
+      if (!init) {
+	desc = SWIG_TypeQuery("swig::ConstIterator *");
+	init = 1;
+      }	
+      return desc;
+    }
+  };
+
+
+  /**
+   * Abstract base class used to represent all non-const iterators of STL containers.
+   * 
+   */
+  struct Iterator : public ConstIterator {
+  public:
+    typedef Iterator self_type;
+
+  protected:
+    Iterator(VALUE seq) : ConstIterator(seq)
+    {
+    }
+
+    virtual self_type* advance(ptrdiff_t n)
+    {
+      throw std::invalid_argument("operation not supported");
+    }
+
+  public:
+    static swig_type_info* descriptor() {
+      static int init = 0;
+      static swig_type_info* desc = 0;
+      if (!init) {
+	desc = SWIG_TypeQuery("swig::Iterator *");
+	init = 1;
+      }	
+      return desc;
+    }
+    
+    virtual Iterator *dup() const
+    {
+      throw std::invalid_argument("dup not supported");
+      return NULL;
+    }
+      
+    virtual self_type* next( size_t n = 1 )
+    {
+      return this->advance( n );
+    }
+
+    virtual self_type* previous( size_t n = 1 )
+    {
+      ptrdiff_t nn = n;
+      return this->advance( -nn );
+    }
+
+    bool operator == (const ConstIterator& x)  const
+    {
+      return equal(x);
+    }
+      
+    bool operator != (const Iterator& x) const
+    {
+      return ! operator==(x);
+    }
+      
+    Iterator& operator += (ptrdiff_t n)
+    {
+      return *advance(n);
+    }
+
+    Iterator& operator -= (ptrdiff_t n)
+    {
+      return *advance(-n);
+    }
+      
+    Iterator* operator + (ptrdiff_t n) const
+    {
+      return dup()->advance(n);
+    }
+
+    Iterator* operator - (ptrdiff_t n) const
+    {
+      return dup()->advance(-n);
+    }
+      
+    ptrdiff_t operator - (const Iterator& x) const
+    {
+      return x.distance(*this);
+    }
+  };
+
+}
+
+
+SWIGINTERN VALUE
+SWIG_ruby_failed(void)
+{
+  return Qnil;
+} 
+
+
+/*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
+SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
+{
+  VALUE obj = args[0];
+  VALUE type = TYPE(obj);
+  unsigned long *res = (unsigned long *)(args[1]);
+  *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
+  return obj;
+}
+/*@SWIG@*/
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) 
+{
+  VALUE type = TYPE(obj);
+  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+    unsigned long v;
+    VALUE a[2];
+    a[0] = obj;
+    a[1] = (VALUE)(&v);
+    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_size_t (VALUE obj, size_t *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
+  return res;
+}
+
+
+SWIGINTERNINLINE VALUE
+SWIG_From_bool  (bool value)
+{
+  return value ? Qtrue : Qfalse;
+}
+
+
+/*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
+SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
+{
+  VALUE obj = args[0];
+  VALUE type = TYPE(obj);
+  long *res = (long *)(args[1]);
+  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
+  return obj;
+}
+/*@SWIG@*/
+
+SWIGINTERN int
+SWIG_AsVal_long (VALUE obj, long* val)
+{
+  VALUE type = TYPE(obj);
+  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+    long v;
+    VALUE a[2];
+    a[0] = obj;
+    a[1] = (VALUE)(&v);
+    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_ptrdiff_t (VALUE obj, ptrdiff_t *val)
+{
+  long v;
+  int res = SWIG_AsVal_long (obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
+  return res;
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+  #define SWIG_From_long   LONG2NUM 
+
+
+SWIGINTERNINLINE VALUE
+SWIG_From_ptrdiff_t  (ptrdiff_t value)
+{    
+  return SWIG_From_long  (static_cast< long >(value));
+}
+
+
+#include <stdexcept>
+
+
+#include <algorithm>
+
+
+#include <vector>
+
+ 
+#include "geos_c.h"
+/* Needed for va_start, etc. */
+#include <stdarg.h>
+
+
+SWIGINTERNINLINE VALUE
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERNINLINE VALUE 
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  if (carray) {
+    if (size > LONG_MAX) {
+      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+      return pchar_descriptor ? 
+	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
+    } else {
+      return rb_str_new(carray, static_cast< long >(size));
+    }
+  } else {
+    return Qnil;
+  }
+}
+
+
+SWIGINTERNINLINE VALUE 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+    static const int DEFAULT_QUADRANT_SEGMENTS=8;
+
+
+
+/* This is not thread safe ! */
+static const int MESSAGE_SIZE = 1000;
+static char message[MESSAGE_SIZE];
+
+void noticeHandler(const char *fmt, ...)
+{
+    va_list args;
+    va_start(args, fmt);
+    vsnprintf(message, sizeof(message) - 1, fmt, args);
+    va_end(args);
+}
+
+void errorHandler(const char *fmt, ...)
+{
+    va_list args;
+    va_start(args, fmt);
+    vsnprintf(message, sizeof(message) - 1, fmt, args);
+    va_end(args);
+}
+
+
+    /* this callback yields the data item to the block */
+    static void GeosSTRtree_query_callback (void *data, void *nothing) {
+        if (rb_block_given_p()) {
+            rb_yield((VALUE) data);
+        }
+    }
+
+
+    static void GeosSTRtree_mark_item (void *data, void *nothing)
+    {
+        if ((VALUE) data != Qnil) {
+            rb_gc_mark((VALUE)data);
+        }
+    }
+
+    static void mark_GeosSTRtree(void *self)
+    {
+        GEOSSTRtree *tree = (GEOSSTRtree *) self;
+        GEOSSTRtree_iterate(tree, GeosSTRtree_mark_item, NULL);
+    }
+
+
+typedef void GeosCoordinateSequence;
+
+void checkCoordSeqBounds(const GEOSCoordSeq coordSeq, const size_t index)
+{
+    unsigned int size = 0;
+    GEOSCoordSeq_getSize(coordSeq, &size);
+
+    if (index < 0 || index >= size)
+        throw std::runtime_error("Index out of bounds");
+}
+
+SWIGINTERN GeosCoordinateSequence *new_GeosCoordinateSequence(size_t size,size_t dims){
+        return (GeosCoordinateSequence*) GEOSCoordSeq_create(size, dims);
+    }
+SWIGINTERN GeosCoordinateSequence *GeosCoordinateSequence_clone(GeosCoordinateSequence *self){
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        return (GeosCoordinateSequence*) GEOSCoordSeq_clone(coords);
+    }
+
+/*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
+SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
+{
+  VALUE obj = args[0];
+  VALUE type = TYPE(obj);
+  double *res = (double *)(args[1]);
+  *res = NUM2DBL(obj);
+  return obj;
+}
+/*@SWIG@*/
+
+SWIGINTERN int
+SWIG_AsVal_double (VALUE obj, double *val)
+{
+  VALUE type = TYPE(obj);
+  if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
+    double v;
+    VALUE a[2];
+    a[0] = obj;
+    a[1] = (VALUE)(&v);
+    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+  }
+  return SWIG_TypeError;
+}
+
+SWIGINTERN int GeosCoordinateSequence_setX(GeosCoordinateSequence *self,size_t idx,double val){
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        return GEOSCoordSeq_setX(coords, idx, val);
+    }
+SWIGINTERN int GeosCoordinateSequence_setY(GeosCoordinateSequence *self,size_t idx,double val){
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        return GEOSCoordSeq_setY(coords, idx, val);
+    }
+SWIGINTERN int GeosCoordinateSequence_setZ(GeosCoordinateSequence *self,size_t idx,double val){
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        return GEOSCoordSeq_setZ(coords, idx, val);
+    }
+SWIGINTERN int GeosCoordinateSequence_setOrdinate(GeosCoordinateSequence *self,size_t idx,size_t dim,double val){
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        return GEOSCoordSeq_setOrdinate(coords, idx, dim, val);
+    }
+SWIGINTERN double GeosCoordinateSequence_getX(GeosCoordinateSequence *self,size_t idx){
+        double result;
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        GEOSCoordSeq_getX(coords, idx, &result);
+        return result;
+    }
+
+  #define SWIG_From_double   rb_float_new 
+
+SWIGINTERN double GeosCoordinateSequence_getY(GeosCoordinateSequence *self,size_t idx){
+        double result;
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        GEOSCoordSeq_getY(coords, idx, &result);
+        return result;
+    }
+SWIGINTERN double GeosCoordinateSequence_getZ(GeosCoordinateSequence *self,size_t idx){
+        double result;
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        GEOSCoordSeq_getZ(coords, idx, &result);
+        return result;
+    }
+SWIGINTERN double GeosCoordinateSequence_getOrdinate(GeosCoordinateSequence *self,size_t idx,size_t dim){
+        double result;
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        checkCoordSeqBounds(coords, idx);
+        GEOSCoordSeq_getOrdinate(coords, idx, dim, &result);
+        return result;
+    }
+SWIGINTERN unsigned int GeosCoordinateSequence_getSize(GeosCoordinateSequence *self){
+        unsigned int result;
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        GEOSCoordSeq_getSize(coords, &result);
+        return result;
+    }
+
+SWIGINTERNINLINE VALUE
+SWIG_From_unsigned_SS_long  (unsigned long value)
+{
+  return ULONG2NUM(value); 
+}
+
+
+SWIGINTERNINLINE VALUE
+SWIG_From_unsigned_SS_int  (unsigned int value)
+{    
+  return SWIG_From_unsigned_SS_long  (value);
+}
+
+SWIGINTERN unsigned int GeosCoordinateSequence_getDimensions(GeosCoordinateSequence *self){
+        unsigned int result;
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        GEOSCoordSeq_getDimensions(coords, &result);
+        return result;
+    }
+
+typedef void GeosGeometry;
+typedef void GeosPoint;
+typedef void GeosLineString;
+typedef void GeosLinearRing;
+typedef void GeosPolygon;
+typedef void GeosGeometryCollection;
+typedef void GeosMultiPoint;
+typedef void GeosMultiLineString;
+typedef void GeosMultiLinearRing;
+typedef void GeosMultiPolygon;
+
+typedef void GeosWktReader;
+typedef void GeosWktWriter;
+typedef void GeosWkbReader;
+typedef void GeosWkbWriter;
+
+
+bool checkBoolResult(char result)
+{
+    int intResult = (int) result;
+
+    if (intResult == 1)
+        return true;
+    else if (intResult == 0)
+        return false;
+    else
+        throw std::runtime_error(message);
+}
+
+SWIGINTERN GeosGeometry *GeosGeometry_clone(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSGeom_clone(geom);
+    }
+SWIGINTERN char *GeosGeometry_geomType(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSGeomType(geom);
+    }
+SWIGINTERN int GeosGeometry_typeId(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSGeomTypeId(geom);
+    }
+SWIGINTERN void GeosGeometry_normalize(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        int result = GEOSNormalize(geom);
+
+        if (result == -1)
+            throw std::runtime_error(message);
+    }
+SWIGINTERN int GeosGeometry_getSRID(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSGetSRID(geom);
+    }
+
+SWIGINTERN int
+SWIG_AsVal_int (VALUE obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long (obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+SWIGINTERN void GeosGeometry_setSRID(GeosGeometry *self,int SRID){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSSetSRID(geom, SRID);
+    }
+SWIGINTERN size_t GeosGeometry_getDimensions(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSGeom_getDimensions(geom);
+    }
+
+SWIGINTERNINLINE VALUE
+SWIG_From_size_t  (size_t value)
+{    
+  return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
+}
+
+SWIGINTERN size_t GeosGeometry_getNumGeometries(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        size_t result = GEOSGetNumGeometries(geom);
+        
+        if ((int)result == -1)
+            throw std::runtime_error(message);
+
+        return result;
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_intersection(GeosGeometry *self,GeosGeometry *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return (GeosGeometry*) GEOSIntersection(geom, otherGeom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_buffer(GeosGeometry *self,double width,int quadsegs){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSBuffer(geom, width, quadsegs);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_convexHull(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSConvexHull(geom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_difference(GeosGeometry *self,GeosGeometry *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return (GeosGeometry*) GEOSDifference(geom, otherGeom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_symDifference(GeosGeometry *self,GeosGeometry *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return (GeosGeometry*) GEOSSymDifference(geom, otherGeom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_boundary(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSBoundary(geom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_geomUnion(GeosGeometry *self,GeosGeometry *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return (GeosGeometry*) GEOSUnion(geom, otherGeom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_pointOnSurface(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSPointOnSurface(geom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_getCentroid(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSGetCentroid(geom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_getEnvelope(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSEnvelope(geom);
+    }
+SWIGINTERN char *GeosGeometry_relate(GeosGeometry *self,GeosGeometry *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return GEOSRelate(geom, otherGeom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_lineMerge(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return GEOSLineMerge(geom);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_simplify(GeosGeometry *self,double tolerance){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSSimplify(geom, tolerance);
+    }
+SWIGINTERN GeosGeometry *GeosGeometry_topologyPreserveSimplify(GeosGeometry *self,double tolerance){
+        GEOSGeom geom = (GEOSGeom) self;
+        return (GeosGeometry*) GEOSTopologyPreserveSimplify(geom, tolerance);
+    }
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (TYPE(obj) == T_STRING) {
+    #if defined(StringValuePtr)
+    char *cstr = StringValuePtr(obj); 
+    #else
+    char *cstr = STR2CSTR(obj);
+    #endif
+    size_t size = RSTRING_LEN(obj) + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      void* vptr = 0;
+      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = (char *)vptr;
+	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }  
+  return SWIG_TypeError;
+}
+
+
+
+
+SWIGINTERN bool GeosGeometry_relatePattern(GeosGeometry *self,GeosGeometry const *other,char const *pat){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSRelatePattern(geom, otherGeom, pat));
+    }
+SWIGINTERN bool GeosGeometry_disjoint(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSDisjoint(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_touches(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSTouches(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_intersects(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSIntersects(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_crosses(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSCrosses(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_within(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSWithin(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_contains(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSContains(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_overlaps(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSOverlaps(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_equals(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSEquals(geom, otherGeom));
+    }
+SWIGINTERN bool GeosGeometry_equalsExact(GeosGeometry *self,GeosGeometry const *other,double tolerance){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSEqualsExact(geom, otherGeom, tolerance));
+    }
+SWIGINTERN bool GeosGeometry_isEmpty(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return checkBoolResult(GEOSisEmpty(geom));
+    }
+SWIGINTERN bool GeosGeometry_isValid(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return checkBoolResult(GEOSisValid(geom));
+    }
+SWIGINTERN bool GeosGeometry_isSimple(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return checkBoolResult(GEOSisSimple(geom));
+    }
+SWIGINTERN bool GeosGeometry_isRing(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return checkBoolResult(GEOSisRing(geom));
+    }
+SWIGINTERN bool GeosGeometry_hasZ(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        return checkBoolResult(GEOSHasZ(geom));
+    }
+SWIGINTERN double GeosGeometry_area(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        double result;
+
+        int code = GEOSArea(geom, &result);
+
+        if (code == 0)
+            throw std::runtime_error(message);
+
+        return result;
+    }
+SWIGINTERN double GeosGeometry_length(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        double result;
+
+        int code = GEOSLength(geom, &result);
+
+        if (code == 0)
+            throw std::runtime_error(message);
+
+        return result;
+    }
+SWIGINTERN double GeosGeometry_distance(GeosGeometry *self,GeosGeometry const *other){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        double result;
+
+        int code = GEOSDistance(geom, otherGeom, &result);
+
+        if (code == 0)
+            throw std::runtime_error(message);
+
+        return result;
+    }
+SWIGINTERN GeosCoordinateSequence const *GeosPoint_getCoordSeq(GeosPoint *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
+
+        if (result == NULL)
+            throw std::runtime_error(message);
+
+        return (const GeosCoordinateSequence*) result;
+    }
+SWIGINTERN GeosCoordinateSequence const *GeosLineString_getCoordSeq(GeosLineString *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
+
+        if (result == NULL)
+            throw std::runtime_error(message);
+
+        return (const GeosCoordinateSequence*) result;
+    }
+SWIGINTERN GeosCoordinateSequence const *GeosLinearRing_getCoordSeq(GeosLinearRing *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
+
+        if (result == NULL)
+            throw std::runtime_error(message);
+
+        return (const GeosCoordinateSequence*) result;
+    }
+SWIGINTERN GeosGeometry const *GeosPolygon_getExteriorRing(GeosPolygon *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        const GEOSGeom result = (const GEOSGeom) GEOSGetExteriorRing(geom);
+
+        if (result == NULL)
+            throw std::runtime_error(message);
+
+        return (const GeosGeometry*) result;
+    }
+SWIGINTERN size_t GeosPolygon_getNumInteriorRings(GeosPolygon *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        size_t result = GEOSGetNumInteriorRings(geom);
+
+        if ((int)result == -1)
+            throw std::runtime_error(message);
+
+        return result;
+    }
+SWIGINTERN GeosGeometry const *GeosPolygon_getInteriorRingN(GeosPolygon *self,size_t n){
+        GEOSGeom geom = (GEOSGeom) self;
+
+        size_t size = GEOSGetNumInteriorRings(geom);
+
+        if (n < 0 || n >= size)
+            throw std::runtime_error("Index out of bounds");
+
+        const GEOSGeom result = (const GEOSGeom) GEOSGetInteriorRingN(geom, n);
+
+        if (result == NULL)
+            throw std::runtime_error(message);
+
+        return (const GeosGeometry*) result;
+    }
+SWIGINTERN GeosGeometry const *GeosGeometryCollection_getGeometryN(GeosGeometryCollection *self,size_t n){
+        GEOSGeom geom = (GEOSGeom) self;
+        const GEOSGeom result = (const GEOSGeom) GEOSGetGeometryN(geom, n);
+
+        if (result == NULL)
+            throw std::runtime_error(message);
+
+        return (const GeosGeometry*) result;
+    }
+
+GeosGeometry *createPoint(GeosCoordinateSequence *s)
+{
+    GEOSCoordSeq coords = (GEOSCoordSeq) s;
+    GEOSGeom geom = GEOSGeom_createPoint(coords);
+
+    if(geom == NULL)
+        throw std::runtime_error(message);
+
+    return (GeosGeometry*) geom;
+}
+
+GeosGeometry *createLineString(GeosCoordinateSequence *s)
+{
+    GEOSCoordSeq coords = (GEOSCoordSeq) s;
+    GEOSGeom geom = GEOSGeom_createLineString(coords);
+
+    if(geom == NULL)
+        throw std::runtime_error(message);
+
+    return (GeosGeometry*) geom;
+}
+
+GeosGeometry *createLinearRing(GeosCoordinateSequence *s)
+{
+    GEOSCoordSeq coords = (GEOSCoordSeq) s;
+    GEOSGeom geom = GEOSGeom_createLinearRing(coords);
+
+    if(geom == NULL)
+        throw std::runtime_error(message);
+
+    return (GeosGeometry*) geom;
+}
+
+GeosGeometry *createPolygon(GeosLinearRing *shell, GeosLinearRing **holes, size_t nholes)
+{
+    GEOSGeom shellGeom = (GEOSGeom) shell;
+    GEOSGeom* holeGeoms = (GEOSGeom*) holes;
+    GEOSGeom geom = GEOSGeom_createPolygon(shellGeom, holeGeoms, nholes);
+
+    if(geom == NULL)
+        throw std::runtime_error(message);
+
+    return (GeosGeometry*) geom;
+}
+
+
+
+typedef void GeosPreparedGeometry;
+
+SWIGINTERN GeosPreparedGeometry *new_GeosPreparedGeometry(GeosGeometry const *source){
+        const GEOSPreparedGeometry *prep = GEOSPrepare((const GEOSGeometry *)source);
+        if(prep == NULL)
+            throw std::runtime_error(message);
+        return (GeosPreparedGeometry *) prep;
+    }
+SWIGINTERN bool GeosPreparedGeometry_contains(GeosPreparedGeometry *self,GeosGeometry const *other){
+        GEOSPreparedGeometry *prep = (GEOSPreparedGeometry *) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSPreparedContains(prep, otherGeom));
+    }
+SWIGINTERN bool GeosPreparedGeometry_containsProperly(GeosPreparedGeometry *self,GeosGeometry const *other){
+        GEOSPreparedGeometry *prep = (GEOSPreparedGeometry *) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSPreparedContainsProperly(prep, otherGeom));
+    }
+SWIGINTERN bool GeosPreparedGeometry_covers(GeosPreparedGeometry *self,GeosGeometry const *other){
+        GEOSPreparedGeometry *prep = (GEOSPreparedGeometry *) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSPreparedCovers(prep, otherGeom));
+    }
+SWIGINTERN bool GeosPreparedGeometry_intersects(GeosPreparedGeometry *self,GeosGeometry const *other){
+        GEOSPreparedGeometry *prep = (GEOSPreparedGeometry *) self;
+        GEOSGeom otherGeom = (GEOSGeom) other;
+        return checkBoolResult(GEOSPreparedIntersects(prep, otherGeom));
+    }
+
+typedef void GeosSTRtree;
+/* GeosIndexItem typedef'd here so it can be %typemap(typecheck)'d
+   as a native object by each language specially */
+typedef void *GeosIndexItem;
+typedef GEOSQueryCallback GeosQueryCallback;
+
+SWIGINTERN GeosSTRtree *new_GeosSTRtree(int nodeCapacity){
+        GEOSSTRtree *tree = GEOSSTRtree_create(nodeCapacity);
+        if(tree == NULL)
+            throw std::runtime_error(message);
+        return (GeosSTRtree *) tree;
+    }
+SWIGINTERN void GeosSTRtree_insert(GeosSTRtree *self,GeosGeometry const *g,GeosIndexItem item){
+        GEOSSTRtree *tree = (GEOSSTRtree *) self;
+        const GEOSGeometry *geom = (const GEOSGeometry *) g;
+        GEOSSTRtree_insert(tree, geom, item);
+    }
+SWIGINTERN void GeosSTRtree_remove(GeosSTRtree *self,GeosGeometry const *g,GeosIndexItem item){
+        GEOSSTRtree *tree = (GEOSSTRtree *) self;
+        const GEOSGeometry *geom = (const GEOSGeometry *) g;
+        GEOSSTRtree_remove(tree, geom, item);
+    }
+SWIGINTERN void GeosSTRtree_query(GeosSTRtree *self,GeosGeometry const *g,GeosQueryCallback callback,GeosIndexItem accumulator){
+        GEOSSTRtree *tree = (GEOSSTRtree *) self;
+        const GEOSGeometry *geom = (const GEOSGeometry *) g;
+        GEOSSTRtree_query(tree, geom, callback, accumulator);
+    }
+SWIGINTERN void GeosSTRtree_iterate(GeosSTRtree *self,GeosQueryCallback callback,GeosIndexItem accumulator){
+        GEOSSTRtree *tree = (GEOSSTRtree *) self;
+        GEOSSTRtree_iterate(tree, callback, accumulator);
+    }
+SWIGINTERN GeosWktReader *new_GeosWktReader(){
+        return GEOSWKTReader_create();
+    }
+SWIGINTERN GeosGeometry *GeosWktReader_read(GeosWktReader *self,char const *wkt){
+        if(wkt == NULL)
+            throw std::runtime_error("Trying to create geometry from a NULL string");
+            
+        GEOSWKTReader *reader = (GEOSWKTReader*) self;
+        GEOSGeometry *geom = GEOSWKTReader_read(reader, wkt);
+
+        if(geom == NULL)
+            throw std::runtime_error(message);
+
+        return (GeosGeometry*) geom;
+    }
+SWIGINTERN GeosWktWriter *new_GeosWktWriter(){
+        return GEOSWKTWriter_create();
+    }
+SWIGINTERN char *GeosWktWriter_write(GeosWktWriter *self,GeosGeometry const *g){
+        GEOSWKTWriter *writer = (GEOSWKTWriter*) self;
+        GEOSGeom geom = (GEOSGeom) g;
+        return GEOSWKTWriter_write(writer, geom);
+    }
+SWIGINTERN GeosWkbReader *new_GeosWkbReader(){
+        return GEOSWKBReader_create();
+    }
+SWIGINTERN GeosGeometry *GeosWkbReader_read(GeosWkbReader *self,unsigned char const *wkb,size_t size){
+        if(wkb == NULL)
+          throw std::runtime_error("Trying to create geometry from a NULL string");
+         
+        GEOSWKBReader *reader = (GEOSWKBReader*) self;
+        GEOSGeometry *geom = GEOSWKBReader_read(reader, wkb, size);
+       
+        if(geom == NULL)
+          throw std::runtime_error(message);
+
+        return (GeosGeometry*) geom;
+    }
+SWIGINTERN GeosGeometry *GeosWkbReader_readHEX(GeosWkbReader *self,unsigned char const *wkb,size_t size){
+        if(wkb == NULL)
+          throw std::runtime_error("Trying to create geometry from a NULL string");
+         
+        GEOSWKBReader *reader = (GEOSWKBReader*) self;
+        GEOSGeometry *geom = GEOSWKBReader_readHEX(reader, wkb, size);
+       
+        if(geom == NULL)
+          throw std::runtime_error(message);
+
+        return (GeosGeometry*) geom;
+    }
+SWIGINTERN GeosWkbWriter *new_GeosWkbWriter(){
+        return GEOSWKBWriter_create();
+    }
+SWIGINTERN int GeosWkbWriter_getOutputDimension(GeosWkbWriter *self){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        return GEOSWKBWriter_getOutputDimension(writer);
+    }
+SWIGINTERN void GeosWkbWriter_setOutputDimension(GeosWkbWriter *self,int newDimension){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        GEOSWKBWriter_setOutputDimension(writer, newDimension);
+    }
+SWIGINTERN int GeosWkbWriter_getByteOrder(GeosWkbWriter *self){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        return GEOSWKBWriter_getByteOrder(writer);
+    }
+SWIGINTERN void GeosWkbWriter_setByteOrder(GeosWkbWriter *self,int newByteOrder){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        return GEOSWKBWriter_setByteOrder(writer, newByteOrder);
+    }
+SWIGINTERN bool GeosWkbWriter_getIncludeSRID(GeosWkbWriter *self){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        return GEOSWKBWriter_getIncludeSRID(writer);
+    }
+
+SWIGINTERN int
+SWIG_AsVal_bool (VALUE obj, bool *val)
+{
+  if (obj == Qtrue) {
+    if (val) *val = true;
+    return SWIG_OK;
+  } else if (obj == Qfalse) {
+    if (val) *val = false;
+    return SWIG_OK;
+  } else {
+    int res = 0;
+    if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {    
+      if (val) *val = res ? true : false;
+      return SWIG_OK;
+    }
+  }  
+  return SWIG_TypeError;
+}
+
+SWIGINTERN void GeosWkbWriter_setIncludeSRID(GeosWkbWriter *self,bool newIncludeSRID){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        return GEOSWKBWriter_setIncludeSRID(writer, newIncludeSRID);
+    }
+SWIGINTERN unsigned char *GeosWkbWriter_write(GeosWkbWriter *self,GeosGeometry const *g,size_t *size){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        GEOSGeom geom = (GEOSGeom) g;
+        return GEOSWKBWriter_write(writer, geom, size);
+    }
+SWIGINTERN unsigned char *GeosWkbWriter_writeHEX(GeosWkbWriter *self,GeosGeometry const *g,size_t *size){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        GEOSGeom geom = (GEOSGeom) g;
+        return GEOSWKBWriter_writeHEX(writer, geom, size);
+    }
+swig_class SwigClassGCVALUE;
+
+
+/*
+  Document-method: Geos::GCVALUE.inspect
+
+  call-seq:
+    inspect -> VALUE
+
+Inspect class and its contents.
+*/
+SWIGINTERN VALUE
+_wrap_GCVALUE_inspect(int argc, VALUE *argv, VALUE self) {
+  swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__GC_VALUE, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::GC_VALUE const *","inspect", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::GC_VALUE * >(argp1);
+  result = (VALUE)((swig::GC_VALUE const *)arg1)->inspect();
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::GCVALUE.to_s
+
+  call-seq:
+    to_s -> VALUE
+
+Convert class to a String representation.
+*/
+SWIGINTERN VALUE
+_wrap_GCVALUE_to_s(int argc, VALUE *argv, VALUE self) {
+  swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__GC_VALUE, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::GC_VALUE const *","to_s", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::GC_VALUE * >(argp1);
+  result = (VALUE)((swig::GC_VALUE const *)arg1)->to_s();
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassConstIterator;
+
+SWIGINTERN void
+free_swig_ConstIterator(swig::ConstIterator *arg1) {
+    delete arg1;
+}
+
+SWIGINTERN VALUE
+_wrap_ConstIterator_value(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","value", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  try {
+    result = (VALUE)((swig::ConstIterator const *)arg1)->value();
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::ConstIterator.dup
+
+  call-seq:
+    dup -> ConstIterator
+
+Create a duplicate of the class and unfreeze it if needed.
+*/
+SWIGINTERN VALUE
+_wrap_ConstIterator_dup(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","dup", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->dup();
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::ConstIterator.inspect
+
+  call-seq:
+    inspect -> VALUE
+
+Inspect class and its contents.
+*/
+SWIGINTERN VALUE
+_wrap_ConstIterator_inspect(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","inspect", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  result = (VALUE)((swig::ConstIterator const *)arg1)->inspect();
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::ConstIterator.to_s
+
+  call-seq:
+    to_s -> VALUE
+
+Convert class to a String representation.
+*/
+SWIGINTERN VALUE
+_wrap_ConstIterator_to_s(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","to_s", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  result = (VALUE)((swig::ConstIterator const *)arg1)->to_s();
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ConstIterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  result = (swig::ConstIterator *)(arg1)->next(arg2);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ConstIterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  try {
+    result = (swig::ConstIterator *)(arg1)->next();
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_ConstIterator_next(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs + 1;
+  argv[0] = self;
+  if (argc > 3) SWIG_fail;
+  for (ii = 1; (ii < argc); ++ii) {
+    argv[ii] = args[ii-1];
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ConstIterator_next__SWIG_1(nargs, args, self);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_size_t(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ConstIterator_next__SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "ConstIterator.next", 
+    "    swig::ConstIterator * ConstIterator.next(size_t n)\n"
+    "    swig::ConstIterator * ConstIterator.next()\n");
+  
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ConstIterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  result = (swig::ConstIterator *)(arg1)->previous(arg2);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ConstIterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  try {
+    result = (swig::ConstIterator *)(arg1)->previous();
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_ConstIterator_previous(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs + 1;
+  argv[0] = self;
+  if (argc > 3) SWIG_fail;
+  for (ii = 1; (ii < argc); ++ii) {
+    argv[ii] = args[ii-1];
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ConstIterator_previous__SWIG_1(nargs, args, self);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_size_t(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ConstIterator_previous__SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "ConstIterator.previous", 
+    "    swig::ConstIterator * ConstIterator.previous(size_t n)\n"
+    "    swig::ConstIterator * ConstIterator.previous()\n");
+  
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::ConstIterator.==
+
+  call-seq:
+    ==(x) -> bool
+
+Equality comparison operator.
+*/
+SWIGINTERN VALUE
+_wrap_ConstIterator___eq__(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  swig::ConstIterator *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator ==", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator ==", 2, argv[0] )); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator ==", 2, argv[0])); 
+  }
+  arg2 = reinterpret_cast< swig::ConstIterator * >(argp2);
+  result = (bool)((swig::ConstIterator const *)arg1)->operator ==((swig::ConstIterator const &)*arg2);
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::ConstIterator.+
+
+  call-seq:
+    +(n) -> ConstIterator
+
+Add operator.
+*/
+SWIGINTERN VALUE
+_wrap_ConstIterator___add__(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  ptrdiff_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  ptrdiff_t val2 ;
+  int ecode2 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator +", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] ));
+  } 
+  arg2 = static_cast< ptrdiff_t >(val2);
+  try {
+    result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator +(arg2);
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::ConstIterator.-
+
+  call-seq:
+    -(n) -> ConstIterator
+    -(x) -> ptrdiff_t
+
+Substraction operator.
+*/
+SWIGINTERN VALUE
+_wrap_ConstIterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  ptrdiff_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  ptrdiff_t val2 ;
+  int ecode2 = 0 ;
+  swig::ConstIterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] ));
+  } 
+  arg2 = static_cast< ptrdiff_t >(val2);
+  try {
+    result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator -(arg2);
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ConstIterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) {
+  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
+  swig::ConstIterator *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  ptrdiff_t result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator -", 2, argv[0] )); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator -", 2, argv[0])); 
+  }
+  arg2 = reinterpret_cast< swig::ConstIterator * >(argp2);
+  result = ((swig::ConstIterator const *)arg1)->operator -((swig::ConstIterator const &)*arg2);
+  vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_ConstIterator___sub__(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs + 1;
+  argv[0] = self;
+  if (argc > 3) SWIG_fail;
+  for (ii = 1; (ii < argc); ++ii) {
+    argv[ii] = args[ii-1];
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      void *vptr = 0;
+      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_ConstIterator___sub____SWIG_1(nargs, args, self);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ConstIterator___sub____SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "__sub__.new", 
+    "    __sub__.new(ptrdiff_t n)\n"
+    "    __sub__.new(swig::ConstIterator const &x)\n");
+  
+  return Qnil;
+}
+
+
+swig_class SwigClassIterator;
+
+SWIGINTERN VALUE
+_wrap_Iterator_valuee___(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  VALUE *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE temp2 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","setValue", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  temp2 = static_cast< VALUE >(argv[0]);
+  arg2 = &temp2;
+  result = (VALUE)(arg1)->setValue((VALUE const &)*arg2);
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Iterator.dup
+
+  call-seq:
+    dup -> Iterator
+
+Create a duplicate of the class and unfreeze it if needed.
+*/
+SWIGINTERN VALUE
+_wrap_Iterator_dup(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","dup", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  result = (swig::Iterator *)((swig::Iterator const *)arg1)->dup();
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Iterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  result = (swig::Iterator *)(arg1)->next(arg2);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Iterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  try {
+    result = (swig::Iterator *)(arg1)->next();
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_Iterator_next(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs + 1;
+  argv[0] = self;
+  if (argc > 3) SWIG_fail;
+  for (ii = 1; (ii < argc); ++ii) {
+    argv[ii] = args[ii-1];
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_Iterator_next__SWIG_1(nargs, args, self);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_size_t(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_Iterator_next__SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "Iterator.next", 
+    "    swig::Iterator * Iterator.next(size_t n)\n"
+    "    swig::Iterator * Iterator.next()\n");
+  
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Iterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  result = (swig::Iterator *)(arg1)->previous(arg2);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Iterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  try {
+    result = (swig::Iterator *)(arg1)->previous();
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_Iterator_previous(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs + 1;
+  argv[0] = self;
+  if (argc > 3) SWIG_fail;
+  for (ii = 1; (ii < argc); ++ii) {
+    argv[ii] = args[ii-1];
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_Iterator_previous__SWIG_1(nargs, args, self);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_size_t(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_Iterator_previous__SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "Iterator.previous", 
+    "    swig::Iterator * Iterator.previous(size_t n)\n"
+    "    swig::Iterator * Iterator.previous()\n");
+  
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Iterator.inspect
+
+  call-seq:
+    inspect -> VALUE
+
+Inspect class and its contents.
+*/
+SWIGINTERN VALUE
+_wrap_Iterator_inspect(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","inspect", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  result = (VALUE)((swig::Iterator const *)arg1)->inspect();
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Iterator.to_s
+
+  call-seq:
+    to_s -> VALUE
+
+Convert class to a String representation.
+*/
+SWIGINTERN VALUE
+_wrap_Iterator_to_s(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","to_s", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  result = (VALUE)((swig::Iterator const *)arg1)->to_s();
+  vresult = result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Iterator.==
+
+  call-seq:
+    ==(x) -> bool
+
+Equality comparison operator.
+*/
+SWIGINTERN VALUE
+_wrap_Iterator___eq__(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  swig::Iterator *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator ==", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator ==", 2, argv[0] )); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator ==", 2, argv[0])); 
+  }
+  arg2 = reinterpret_cast< swig::Iterator * >(argp2);
+  result = (bool)((swig::Iterator const *)arg1)->operator ==((swig::Iterator const &)*arg2);
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Iterator.+
+
+  call-seq:
+    +(n) -> Iterator
+
+Add operator.
+*/
+SWIGINTERN VALUE
+_wrap_Iterator___add__(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  ptrdiff_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  ptrdiff_t val2 ;
+  int ecode2 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator +", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] ));
+  } 
+  arg2 = static_cast< ptrdiff_t >(val2);
+  try {
+    result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator +(arg2);
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Iterator.-
+
+  call-seq:
+    -(n) -> Iterator
+    -(x) -> ptrdiff_t
+
+Substraction operator.
+*/
+SWIGINTERN VALUE
+_wrap_Iterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  ptrdiff_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  ptrdiff_t val2 ;
+  int ecode2 = 0 ;
+  swig::Iterator *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] ));
+  } 
+  arg2 = static_cast< ptrdiff_t >(val2);
+  try {
+    result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator -(arg2);
+  }
+  catch(swig::stop_iteration &_e) {
+    {
+      (void)_e;
+      SWIG_Ruby_ExceptionType(NULL, Qnil);
+      SWIG_fail;
+    }
+  }
+  
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Iterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) {
+  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
+  swig::Iterator *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  ptrdiff_t result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self )); 
+  }
+  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator -", 2, argv[0] )); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator -", 2, argv[0])); 
+  }
+  arg2 = reinterpret_cast< swig::Iterator * >(argp2);
+  result = ((swig::Iterator const *)arg1)->operator -((swig::Iterator const &)*arg2);
+  vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_Iterator___sub__(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs + 1;
+  argv[0] = self;
+  if (argc > 3) SWIG_fail;
+  for (ii = 1; (ii < argc); ++ii) {
+    argv[ii] = args[ii-1];
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      void *vptr = 0;
+      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_Iterator___sub____SWIG_1(nargs, args, self);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_Iterator___sub____SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "__sub__.new", 
+    "    __sub__.new(ptrdiff_t n)\n"
+    "    __sub__.new(swig::Iterator const &x)\n");
+  
+  return Qnil;
+}
+
+
+SWIGINTERN void
+free_swig_Iterator(swig::Iterator *arg1) {
+    delete arg1;
+}
+
+SWIGINTERN VALUE
+_wrap_version(int argc, VALUE *argv, VALUE self) {
+  char *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  result = (char *)GEOSversion();
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassCoordinateSequence;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_CoordinateSequence_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosCoordinateSequence);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_CoordinateSequence(int argc, VALUE *argv, VALUE self) {
+  size_t arg1 ;
+  size_t arg2 ;
+  size_t val1 ;
+  int ecode1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  GeosCoordinateSequence *result = 0 ;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","GeosCoordinateSequence", 1, argv[0] ));
+  } 
+  arg1 = static_cast< size_t >(val1);
+  ecode2 = SWIG_AsVal_size_t(argv[1], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","GeosCoordinateSequence", 2, argv[1] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  {
+    try
+    {
+      result = (GeosCoordinateSequence *)new_GeosCoordinateSequence(arg1,arg2);
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosCoordinateSequence(GeosCoordinateSequence *self){
+        GEOSCoordSeq coords = (GEOSCoordSeq) self;
+        return GEOSCoordSeq_destroy(coords);
+    }
+SWIGINTERN void
+free_GeosCoordinateSequence(GeosCoordinateSequence *arg1) {
+    delete_GeosCoordinateSequence(arg1);
+}
+
+
+/*
+  Document-method: Geos::CoordinateSequence.clone
+
+  call-seq:
+    clone -> CoordinateSequence
+
+Create a duplicate of the class.
+*/
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_clone(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosCoordinateSequence *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","clone", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  {
+    try
+    {
+      result = (GeosCoordinateSequence *)GeosCoordinateSequence_clone(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_set_x(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  double arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  double val3 ;
+  int ecode3 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","setX", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","setX", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  ecode3 = SWIG_AsVal_double(argv[1], &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","setX", 3, argv[1] ));
+  } 
+  arg3 = static_cast< double >(val3);
+  {
+    try
+    {
+      result = (int)GeosCoordinateSequence_setX(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_set_y(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  double arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  double val3 ;
+  int ecode3 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","setY", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","setY", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  ecode3 = SWIG_AsVal_double(argv[1], &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","setY", 3, argv[1] ));
+  } 
+  arg3 = static_cast< double >(val3);
+  {
+    try
+    {
+      result = (int)GeosCoordinateSequence_setY(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_set_z(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  double arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  double val3 ;
+  int ecode3 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","setZ", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","setZ", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  ecode3 = SWIG_AsVal_double(argv[1], &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","setZ", 3, argv[1] ));
+  } 
+  arg3 = static_cast< double >(val3);
+  {
+    try
+    {
+      result = (int)GeosCoordinateSequence_setZ(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_set_ordinate(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  size_t arg3 ;
+  double arg4 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  size_t val3 ;
+  int ecode3 = 0 ;
+  double val4 ;
+  int ecode4 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 3) || (argc > 3)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","setOrdinate", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","setOrdinate", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "size_t","setOrdinate", 3, argv[1] ));
+  } 
+  arg3 = static_cast< size_t >(val3);
+  ecode4 = SWIG_AsVal_double(argv[2], &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","setOrdinate", 4, argv[2] ));
+  } 
+  arg4 = static_cast< double >(val4);
+  {
+    try
+    {
+      result = (int)GeosCoordinateSequence_setOrdinate(arg1,arg2,arg3,arg4);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_get_x(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","getX", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","getX", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  {
+    try
+    {
+      result = (double)GeosCoordinateSequence_getX(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_get_y(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","getY", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","getY", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  {
+    try
+    {
+      result = (double)GeosCoordinateSequence_getY(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_get_z(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","getZ", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","getZ", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  {
+    try
+    {
+      result = (double)GeosCoordinateSequence_getZ(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_get_ordinate(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  size_t arg2 ;
+  size_t arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  size_t val3 ;
+  int ecode3 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","getOrdinate", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","getOrdinate", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "size_t","getOrdinate", 3, argv[1] ));
+  } 
+  arg3 = static_cast< size_t >(val3);
+  {
+    try
+    {
+      result = (double)GeosCoordinateSequence_getOrdinate(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence___len__(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  unsigned int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","getSize", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  {
+    try
+    {
+      result = (unsigned int)GeosCoordinateSequence_getSize(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_CoordinateSequence_dimensions(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  unsigned int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","getDimensions", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
+  {
+    try
+    {
+      result = (unsigned int)GeosCoordinateSequence_getDimensions(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassGeometry;
+
+SWIGINTERN void delete_GeosGeometry(GeosGeometry *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosGeometry(GeosGeometry *arg1) {
+    delete_GeosGeometry(arg1);
+}
+
+
+/*
+  Document-method: Geos::Geometry.clone
+
+  call-seq:
+    clone -> Geometry
+
+Create a duplicate of the class.
+*/
+SWIGINTERN VALUE
+_wrap_Geometry_clone(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","clone", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_clone(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_geom_type(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  char *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","geomType", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (char *)GeosGeometry_geomType(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_type_id(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","typeId", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (int)GeosGeometry_typeId(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_normalize(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","normalize", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      GeosGeometry_normalize(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_srid(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","getSRID", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (int)GeosGeometry_getSRID(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_sride___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","setSRID", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  ecode2 = SWIG_AsVal_int(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","setSRID", 2, argv[0] ));
+  } 
+  arg2 = static_cast< int >(val2);
+  {
+    try
+    {
+      GeosGeometry_setSRID(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_dimensions(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","getDimensions", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = GeosGeometry_getDimensions(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_size_t(static_cast< size_t >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_num_geometries(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","getNumGeometries", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = GeosGeometry_getNumGeometries(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_size_t(static_cast< size_t >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_intersection(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","intersection", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry *","intersection", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_intersection(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_buffer(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  double arg2 ;
+  int arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  double val2 ;
+  int ecode2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  {
+    arg3 = DEFAULT_QUADRANT_SEGMENTS;
+  }
+  if ((argc < 1) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","buffer", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  ecode2 = SWIG_AsVal_double(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","buffer", 2, argv[0] ));
+  } 
+  arg2 = static_cast< double >(val2);
+  if (argc > 1) {
+    ecode3 = SWIG_AsVal_int(argv[1], &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","buffer", 3, argv[1] ));
+    } 
+    arg3 = static_cast< int >(val3);
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_buffer(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_convex_hull(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","convexHull", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_convexHull(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_difference(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","difference", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry *","difference", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_difference(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_sym_difference(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","symDifference", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry *","symDifference", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_symDifference(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_boundary(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","boundary", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_boundary(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_union(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","geomUnion", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry *","geomUnion", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_geomUnion(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_point_on_surface(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","pointOnSurface", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_pointOnSurface(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_centroid(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","getCentroid", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_getCentroid(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_envelope(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","getEnvelope", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_getEnvelope(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_relate(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  char *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","relate", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry *","relate", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (char *)GeosGeometry_relate(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_FromCharPtr((const char *)result);
+  delete[] result;
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_line_merge(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","lineMerge", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_lineMerge(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_simplify(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  double arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  double val2 ;
+  int ecode2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","simplify", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  ecode2 = SWIG_AsVal_double(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","simplify", 2, argv[0] ));
+  } 
+  arg2 = static_cast< double >(val2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_simplify(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_topology_preserve_simplify(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  double arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  double val2 ;
+  int ecode2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","topologyPreserveSimplify", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  ecode2 = SWIG_AsVal_double(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","topologyPreserveSimplify", 2, argv[0] ));
+  } 
+  arg2 = static_cast< double >(val2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometry_topologyPreserveSimplify(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_relate_pattern(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","relatePattern", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","relatePattern", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","relatePattern", 3, argv[1] ));
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_relatePattern(arg1,(GeosGeometry const *)arg2,(char const *)arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return vresult;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_disjointq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","disjoint", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","disjoint", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_disjoint(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_touchesq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","touches", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","touches", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_touches(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_intersectsq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","intersects", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","intersects", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_intersects(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_crossesq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","crosses", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","crosses", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_crosses(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_withinq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","within", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","within", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_within(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_containsq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","contains", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","contains", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_contains(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_overlapsq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","overlaps", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","overlaps", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_overlaps(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_eqlq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","equals", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","equals", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_equals(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_eql_exactq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  double arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  double val3 ;
+  int ecode3 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","equalsExact", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","equalsExact", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  ecode3 = SWIG_AsVal_double(argv[1], &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","equalsExact", 3, argv[1] ));
+  } 
+  arg3 = static_cast< double >(val3);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_equalsExact(arg1,(GeosGeometry const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_emptyq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","isEmpty", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_isEmpty(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_validq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","isValid", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_isValid(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_simpleq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","isSimple", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_isSimple(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_ringq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","isRing", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_isRing(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_has_zq___(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","hasZ", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (bool)GeosGeometry_hasZ(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_area(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","area", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (double)GeosGeometry_area(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+
+/*
+  Document-method: Geos::Geometry.length
+
+  call-seq:
+    length -> double
+
+Size or Length of the Geometry.
+*/
+SWIGINTERN VALUE
+_wrap_Geometry_length(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","length", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (double)GeosGeometry_length(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Geometry_distance(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  double result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry *","distance", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","distance", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (double)GeosGeometry_distance(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_double(static_cast< double >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassPoint;
+
+SWIGINTERN void delete_GeosPoint(GeosPoint *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosPoint(GeosPoint *arg1) {
+    delete_GeosPoint(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_Point_coord_seq(int argc, VALUE *argv, VALUE self) {
+  GeosPoint *arg1 = (GeosPoint *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosCoordinateSequence *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPoint, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPoint *","getCoordSeq", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPoint * >(argp1);
+  {
+    try
+    {
+      result = (GeosCoordinateSequence *)GeosPoint_getCoordSeq(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassLineString;
+
+SWIGINTERN void delete_GeosLineString(GeosLineString *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosLineString(GeosLineString *arg1) {
+    delete_GeosLineString(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_LineString_coord_seq(int argc, VALUE *argv, VALUE self) {
+  GeosLineString *arg1 = (GeosLineString *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosCoordinateSequence *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosLineString, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosLineString *","getCoordSeq", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosLineString * >(argp1);
+  {
+    try
+    {
+      result = (GeosCoordinateSequence *)GeosLineString_getCoordSeq(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassLinearRing;
+
+SWIGINTERN void delete_GeosLinearRing(GeosLinearRing *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosLinearRing(GeosLinearRing *arg1) {
+    delete_GeosLinearRing(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_LinearRing_coord_seq(int argc, VALUE *argv, VALUE self) {
+  GeosLinearRing *arg1 = (GeosLinearRing *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosCoordinateSequence *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosLinearRing, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosLinearRing *","getCoordSeq", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosLinearRing * >(argp1);
+  {
+    try
+    {
+      result = (GeosCoordinateSequence *)GeosLinearRing_getCoordSeq(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassPolygon;
+
+SWIGINTERN void delete_GeosPolygon(GeosPolygon *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosPolygon(GeosPolygon *arg1) {
+    delete_GeosPolygon(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_Polygon_exterior_ring(int argc, VALUE *argv, VALUE self) {
+  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPolygon *","getExteriorRing", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosPolygon_getExteriorRing(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Polygon_num_interior_rings(int argc, VALUE *argv, VALUE self) {
+  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPolygon *","getNumInteriorRings", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
+  {
+    try
+    {
+      result = GeosPolygon_getNumInteriorRings(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_size_t(static_cast< size_t >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Polygon_interior_ring_n(int argc, VALUE *argv, VALUE self) {
+  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPolygon *","getInteriorRingN", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","getInteriorRingN", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosPolygon_getInteriorRingN(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassGeometryCollection;
+
+SWIGINTERN void delete_GeosGeometryCollection(GeosGeometryCollection *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosGeometryCollection(GeosGeometryCollection *arg1) {
+    delete_GeosGeometryCollection(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_GeometryCollection_get_geometry_n(int argc, VALUE *argv, VALUE self) {
+  GeosGeometryCollection *arg1 = (GeosGeometryCollection *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometryCollection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometryCollection *","getGeometryN", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometryCollection * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","getGeometryN", 2, argv[0] ));
+  } 
+  arg2 = static_cast< size_t >(val2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosGeometryCollection_getGeometryN(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassMultiPoint;
+
+SWIGINTERN void delete_GeosMultiPoint(GeosMultiPoint *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosMultiPoint(GeosMultiPoint *arg1) {
+    delete_GeosMultiPoint(arg1);
+}
+
+swig_class SwigClassMultiLineString;
+
+SWIGINTERN void delete_GeosMultiLineString(GeosMultiLineString *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosMultiLineString(GeosMultiLineString *arg1) {
+    delete_GeosMultiLineString(arg1);
+}
+
+swig_class SwigClassMultiLinearRing;
+
+SWIGINTERN void delete_GeosMultiLinearRing(GeosMultiLinearRing *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosMultiLinearRing(GeosMultiLinearRing *arg1) {
+    delete_GeosMultiLinearRing(arg1);
+}
+
+swig_class SwigClassMultiPolygon;
+
+SWIGINTERN void delete_GeosMultiPolygon(GeosMultiPolygon *self){
+        GEOSGeom geom = (GEOSGeom) self;
+        GEOSGeom_destroy(geom);
+    }
+SWIGINTERN void
+free_GeosMultiPolygon(GeosMultiPolygon *arg1) {
+    delete_GeosMultiPolygon(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_create_point(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","createPoint", 1, argv[0] ));
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)createPoint(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_create_line_string(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","createLineString", 1, argv[0] ));
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)createLineString(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_create_linear_ring(int argc, VALUE *argv, VALUE self) {
+  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosCoordinateSequence *","createLinearRing", 1, argv[0] ));
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)createLinearRing(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_create_polygon(int argc, VALUE *argv, VALUE self) {
+  GeosLinearRing *arg1 = (GeosLinearRing *) 0 ;
+  GeosLinearRing **arg2 = (GeosLinearRing **) 0 ;
+  size_t arg3 ;
+  int res1 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  {
+    arg2 = NULL;
+    arg3 = 0;
+  }
+  if ((argc < 1) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosLinearRing, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosLinearRing *","createPolygon", 1, argv[0] ));
+  }
+  if (argc > 1) {
+    {
+      if (NIL_P(argv[1]))
+      {
+        arg2 = NULL;
+        arg3 = 0;
+      }
+      else
+      {
+        /* Make sure the input can be treated as an array. */
+        Check_Type(argv[1], T_ARRAY);
+        
+        /* Get the length */
+        arg3 = RARRAY_LEN(argv[1]);
+        
+        /* Allocate space for the C array. */
+        arg2 = (GeosLinearRing**) malloc(arg3*sizeof(GeosLinearRing*));
+        
+        for(size_t i = 0; i<arg3; i++)
+        {
+          /* Get the Ruby Object */
+          VALUE item = rb_ary_entry(argv[1],i);
+          
+          /* Get the underlying pointer and give up ownership of it. */
+          GeosLinearRing *ring = NULL;
+          int convertResult = SWIG_ConvertPtr(item, (void**)&ring, SWIGTYPE_p_GeosLinearRing, SWIG_POINTER_DISOWN);
+          if (!SWIG_IsOK(convertResult)) {
+            SWIG_exception_fail(SWIG_ArgError(convertResult), "in method '" "createPolygon" "', argument " "1"" of type '" "GeosLinearRing *""'");
+          }
+          
+          /* Put the pointer in the array */
+          arg2[i] = ring;
+        }    
+      }
+    }
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)createPolygon(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  {
+    if (arg2) {
+      free((void*) arg2);
+    }
+  }
+  return vresult;
+fail:
+  {
+    if (arg2) {
+      free((void*) arg2);
+    }
+  }
+  return Qnil;
+}
+
+
+swig_class SwigClassPrepared;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_Prepared_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_Prepared_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosPreparedGeometry);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_Prepared(int argc, VALUE *argv, VALUE self) {
+  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  GeosPreparedGeometry *result = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosGeometry const *","GeosPreparedGeometry", 1, argv[0] )); 
+  }
+  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
+  {
+    try
+    {
+      result = (GeosPreparedGeometry *)new_GeosPreparedGeometry((GeosGeometry const *)arg1);
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosPreparedGeometry(GeosPreparedGeometry *self){
+        GEOSPreparedGeometry *prep = (GEOSPreparedGeometry *) self;
+        return GEOSPreparedGeom_destroy(prep);
+    }
+SWIGINTERN void
+free_GeosPreparedGeometry(GeosPreparedGeometry *arg1) {
+    delete_GeosPreparedGeometry(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_Prepared_containsq___(int argc, VALUE *argv, VALUE self) {
+  GeosPreparedGeometry *arg1 = (GeosPreparedGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPreparedGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPreparedGeometry *","contains", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPreparedGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","contains", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosPreparedGeometry_contains(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Prepared_contains_properlyq___(int argc, VALUE *argv, VALUE self) {
+  GeosPreparedGeometry *arg1 = (GeosPreparedGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPreparedGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPreparedGeometry *","containsProperly", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPreparedGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","containsProperly", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosPreparedGeometry_containsProperly(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Prepared_coversq___(int argc, VALUE *argv, VALUE self) {
+  GeosPreparedGeometry *arg1 = (GeosPreparedGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPreparedGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPreparedGeometry *","covers", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPreparedGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","covers", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosPreparedGeometry_covers(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_Prepared_intersectsq___(int argc, VALUE *argv, VALUE self) {
+  GeosPreparedGeometry *arg1 = (GeosPreparedGeometry *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPreparedGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosPreparedGeometry *","intersects", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosPreparedGeometry * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","intersects", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (bool)GeosPreparedGeometry_intersects(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = (result ? Qtrue : Qfalse);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassSTRtree;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_STRtree_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_STRtree_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosSTRtree);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_STRtree(int argc, VALUE *argv, VALUE self) {
+  int arg1 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  GeosSTRtree *result = 0 ;
+  
+  {
+    arg1 = 10;
+  }
+  if ((argc < 0) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  if (argc > 0) {
+    ecode1 = SWIG_AsVal_int(argv[0], &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","GeosSTRtree", 1, argv[0] ));
+    } 
+    arg1 = static_cast< int >(val1);
+  }
+  {
+    try
+    {
+      result = (GeosSTRtree *)new_GeosSTRtree(arg1);
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosSTRtree(GeosSTRtree *self){
+        GEOSSTRtree *tree = (GEOSSTRtree *) self;
+        return GEOSSTRtree_destroy(tree);
+    }
+SWIGINTERN void
+free_GeosSTRtree(GeosSTRtree *arg1) {
+    delete_GeosSTRtree(arg1);
+}
+
+
+/*
+  Document-method: Geos::STRtree.insert
+
+  call-seq:
+    insert(g, item)
+
+Insert one or more new elements in the STRtree.
+*/
+SWIGINTERN VALUE
+_wrap_STRtree_insert(int argc, VALUE *argv, VALUE self) {
+  GeosSTRtree *arg1 = (GeosSTRtree *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  GeosIndexItem arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosSTRtree, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosSTRtree *","insert", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosSTRtree * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","insert", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    arg3 = (GeosIndexItem) argv[1];
+  }
+  {
+    try
+    {
+      GeosSTRtree_insert(arg1,(GeosGeometry const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_STRtree_remove(int argc, VALUE *argv, VALUE self) {
+  GeosSTRtree *arg1 = (GeosSTRtree *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  GeosIndexItem arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosSTRtree, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosSTRtree *","remove", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosSTRtree * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","remove", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    arg3 = (GeosIndexItem) argv[1];
+  }
+  {
+    try
+    {
+      GeosSTRtree_remove(arg1,(GeosGeometry const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_STRtree_query(int argc, VALUE *argv, VALUE self) {
+  GeosSTRtree *arg1 = (GeosSTRtree *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  GeosQueryCallback arg3 ;
+  GeosIndexItem arg4 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  
+  {
+    arg3 = GeosSTRtree_query_callback;
+  }
+  {
+    arg4 = (GeosIndexItem) Qnil;
+  }
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosSTRtree, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosSTRtree *","query", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosSTRtree * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","query", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      GeosSTRtree_query(arg1,(GeosGeometry const *)arg2,arg3,arg4);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_STRtree_each(int argc, VALUE *argv, VALUE self) {
+  GeosSTRtree *arg1 = (GeosSTRtree *) 0 ;
+  GeosQueryCallback arg2 ;
+  GeosIndexItem arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  {
+    arg2 = GeosSTRtree_query_callback;
+  }
+  {
+    arg3 = (GeosIndexItem) Qnil;
+  }
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosSTRtree, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosSTRtree *","iterate", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosSTRtree * >(argp1);
+  {
+    try
+    {
+      GeosSTRtree_iterate(arg1,arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassWktReader;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_WktReader_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_WktReader_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWktReader);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_WktReader(int argc, VALUE *argv, VALUE self) {
+  GeosWktReader *result = 0 ;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  {
+    try
+    {
+      result = (GeosWktReader *)new_GeosWktReader();
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosWktReader(GeosWktReader *self){
+        GEOSWKTReader *reader = (GEOSWKTReader*) self;
+        GEOSWKTReader_destroy(reader);
+    }
+SWIGINTERN void
+free_GeosWktReader(GeosWktReader *arg1) {
+    delete_GeosWktReader(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_WktReader_read(int argc, VALUE *argv, VALUE self) {
+  GeosWktReader *arg1 = (GeosWktReader *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWktReader, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWktReader *","read", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWktReader * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","read", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosWktReader_read(arg1,(char const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+swig_class SwigClassWktWriter;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_WktWriter_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_WktWriter_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWktWriter);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_WktWriter(int argc, VALUE *argv, VALUE self) {
+  GeosWktWriter *result = 0 ;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  {
+    try
+    {
+      result = (GeosWktWriter *)new_GeosWktWriter();
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosWktWriter(GeosWktWriter *self){
+        GEOSWKTWriter *writer = (GEOSWKTWriter*) self;
+        GEOSWKTWriter_destroy(writer);
+    }
+SWIGINTERN void
+free_GeosWktWriter(GeosWktWriter *arg1) {
+    delete_GeosWktWriter(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_WktWriter_write(int argc, VALUE *argv, VALUE self) {
+  GeosWktWriter *arg1 = (GeosWktWriter *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  char *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWktWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWktWriter *","write", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWktWriter * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","write", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (char *)GeosWktWriter_write(arg1,(GeosGeometry const *)arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassWkbReader;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_WkbReader_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_WkbReader_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWkbReader);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_WkbReader(int argc, VALUE *argv, VALUE self) {
+  GeosWkbReader *result = 0 ;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  {
+    try
+    {
+      result = (GeosWkbReader *)new_GeosWkbReader();
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosWkbReader(GeosWkbReader *self){
+        GEOSWKBReader *reader = (GEOSWKBReader*) self;
+        GEOSWKBReader_destroy(reader);
+    }
+SWIGINTERN void
+free_GeosWkbReader(GeosWkbReader *arg1) {
+    delete_GeosWkbReader(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_WkbReader_read(int argc, VALUE *argv, VALUE self) {
+  GeosWkbReader *arg1 = (GeosWkbReader *) 0 ;
+  unsigned char *arg2 = (unsigned char *) 0 ;
+  size_t arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int alloc2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbReader, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbReader *","read", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbReader * >(argp1);
+  {
+    /* %typemap(in) (const unsigned char* wkb, size_t size) (int alloc2 = 0) */
+    if (SWIG_AsCharPtrAndSize(argv[0], (char**)&arg2, &arg3, &alloc2) != SWIG_OK)
+    SWIG_exception(SWIG_RuntimeError, "Expecting a string");
+    /* Don't want to include last null character! */
+    arg3--;
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosWkbReader_read(arg1,(unsigned char const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbReader_read_hex(int argc, VALUE *argv, VALUE self) {
+  GeosWkbReader *arg1 = (GeosWkbReader *) 0 ;
+  unsigned char *arg2 = (unsigned char *) 0 ;
+  size_t arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int alloc2 = 0 ;
+  GeosGeometry *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbReader, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbReader *","readHEX", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbReader * >(argp1);
+  {
+    /* %typemap(in) (const unsigned char* wkb, size_t size) (int alloc2 = 0) */
+    if (SWIG_AsCharPtrAndSize(argv[0], (char**)&arg2, &arg3, &alloc2) != SWIG_OK)
+    SWIG_exception(SWIG_RuntimeError, "Expecting a string");
+    /* Don't want to include last null character! */
+    arg3--;
+  }
+  {
+    try
+    {
+      result = (GeosGeometry *)GeosWkbReader_readHEX(arg1,(unsigned char const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) GeosGeometry */
+    
+    if (result == NULL)
+    SWIG_exception(SWIG_RuntimeError, message);
+    
+    GeosGeometry *geom = result;
+    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
+    
+    switch (geomId)
+    {
+    case GEOS_POINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_LINEARRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_POLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOINT:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTILINESTRING:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_MULTIPOLYGON:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
+      break;
+    case GEOS_GEOMETRYCOLLECTION:
+      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
+      break;
+    }
+  }
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class SwigClassWkbWriter;
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_WkbWriter_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_WkbWriter_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWkbWriter);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_WkbWriter(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *result = 0 ;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  {
+    try
+    {
+      result = (GeosWkbWriter *)new_GeosWkbWriter();
+      DATA_PTR(self) = result;
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN void delete_GeosWkbWriter(GeosWkbWriter *self){
+        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
+        GEOSWKBWriter_destroy(writer);
+    }
+SWIGINTERN void
+free_GeosWkbWriter(GeosWkbWriter *arg1) {
+    delete_GeosWkbWriter(arg1);
+}
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_output_dimensions(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","getOutputDimension", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  {
+    try
+    {
+      result = (int)GeosWkbWriter_getOutputDimension(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_output_dimensionse___(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","setOutputDimension", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  ecode2 = SWIG_AsVal_int(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","setOutputDimension", 2, argv[0] ));
+  } 
+  arg2 = static_cast< int >(val2);
+  {
+    try
+    {
+      GeosWkbWriter_setOutputDimension(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_byte_order(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","getByteOrder", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  {
+    try
+    {
+      result = (int)GeosWkbWriter_getByteOrder(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_byte_ordere___(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","setByteOrder", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  ecode2 = SWIG_AsVal_int(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","setByteOrder", 2, argv[0] ));
+  } 
+  arg2 = static_cast< int >(val2);
+  {
+    try
+    {
+      GeosWkbWriter_setByteOrder(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_include_srid(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool result;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","getIncludeSRID", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  {
+    try
+    {
+      result = (bool)GeosWkbWriter_getIncludeSRID(arg1);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_include_sride___(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  bool arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool val2 ;
+  int ecode2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","setIncludeSRID", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","setIncludeSRID", 2, argv[0] ));
+  } 
+  arg2 = static_cast< bool >(val2);
+  {
+    try
+    {
+      GeosWkbWriter_setIncludeSRID(arg1,arg2);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_write(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  size_t *arg3 = (size_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  size_t temp3 = 0 ;
+  unsigned char *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  {
+    /* %typemap(in, numinputs=0) size_t *size (size_t temp3 = 0) */
+    arg3 = &temp3;
+  }
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","write", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","write", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (unsigned char *)GeosWkbWriter_write(arg1,(GeosGeometry const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) unsigned char* */
+  }
+  {
+    /* %typemap(argout) size_t *size */
+    vresult = SWIG_FromCharPtrAndSize((const char*)result, *arg3);
+  }
+  {
+    /* %typemap(freearg) size_t *size */
+    std::free(result);
+  }
+  return vresult;
+fail:
+  {
+    /* %typemap(freearg) size_t *size */
+    std::free(result);
+  }
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_WkbWriter_write_hex(int argc, VALUE *argv, VALUE self) {
+  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
+  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
+  size_t *arg3 = (size_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  size_t temp3 = 0 ;
+  unsigned char *result = 0 ;
+  VALUE vresult = Qnil;
+  
+  {
+    /* %typemap(in, numinputs=0) size_t *size (size_t temp3 = 0) */
+    arg3 = &temp3;
+  }
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GeosWkbWriter *","writeHEX", 1, self )); 
+  }
+  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GeosGeometry const *","writeHEX", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
+  {
+    try
+    {
+      result = (unsigned char *)GeosWkbWriter_writeHEX(arg1,(GeosGeometry const *)arg2,arg3);
+    }
+    catch (const std::exception& e)
+    {
+      SWIG_exception(SWIG_RuntimeError, e.what());
+    }
+  }
+  {
+    /* %typemap(out) unsigned char* */
+  }
+  {
+    /* %typemap(argout) size_t *size */
+    vresult = SWIG_FromCharPtrAndSize((const char*)result, *arg3);
+  }
+  {
+    /* %typemap(freearg) size_t *size */
+    std::free(result);
+  }
+  return vresult;
+fail:
+  {
+    /* %typemap(freearg) size_t *size */
+    std::free(result);
+  }
+  return Qnil;
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_GeosMultiPolygonTo_p_GeosGeometryCollection(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometryCollection *)  ((GeosMultiPolygon *) x));
+}
+static void *_p_GeosMultiPointTo_p_GeosGeometryCollection(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometryCollection *)  ((GeosMultiPoint *) x));
+}
+static void *_p_GeosMultiLineStringTo_p_GeosGeometryCollection(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometryCollection *)  ((GeosMultiLineString *) x));
+}
+static void *_p_GeosMultiLinearRingTo_p_GeosGeometryCollection(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometryCollection *)  ((GeosMultiLinearRing *) x));
+}
+static void *_p_GeosPolygonTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *)  ((GeosPolygon *) x));
+}
+static void *_p_GeosMultiPolygonTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiPolygon *) x));
+}
+static void *_p_GeosPointTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *)  ((GeosPoint *) x));
+}
+static void *_p_GeosLineStringTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *)  ((GeosLineString *) x));
+}
+static void *_p_GeosLinearRingTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *)  ((GeosLinearRing *) x));
+}
+static void *_p_GeosMultiPointTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiPoint *) x));
+}
+static void *_p_GeosMultiLineStringTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiLineString *) x));
+}
+static void *_p_GeosMultiLinearRingTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiLinearRing *) x));
+}
+static void *_p_GeosGeometryCollectionTo_p_GeosGeometry(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GeosGeometry *)  ((GeosGeometryCollection *) x));
+}
+static void *_p_swig__IteratorTo_p_swig__ConstIterator(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((swig::ConstIterator *)  ((swig::Iterator *) x));
+}
+static swig_type_info _swigt__p_GeosCoordinateSequence = {"_p_GeosCoordinateSequence", "GeosCoordinateSequence *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosGeometry = {"_p_GeosGeometry", "GeosGeometry *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosGeometryCollection = {"_p_GeosGeometryCollection", "GeosGeometryCollection *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosLineString = {"_p_GeosLineString", "GeosLineString *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosLinearRing = {"_p_GeosLinearRing", "GeosLinearRing *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosMultiLineString = {"_p_GeosMultiLineString", "GeosMultiLineString *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosMultiLinearRing = {"_p_GeosMultiLinearRing", "GeosMultiLinearRing *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosMultiPoint = {"_p_GeosMultiPoint", "GeosMultiPoint *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosMultiPolygon = {"_p_GeosMultiPolygon", "GeosMultiPolygon *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosPoint = {"_p_GeosPoint", "GeosPoint *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosPolygon = {"_p_GeosPolygon", "GeosPolygon *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosPreparedGeometry = {"_p_GeosPreparedGeometry", "GeosPreparedGeometry *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosSTRtree = {"_p_GeosSTRtree", "GeosSTRtree *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosWkbReader = {"_p_GeosWkbReader", "GeosWkbReader *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosWkbWriter = {"_p_GeosWkbWriter", "GeosWkbWriter *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosWktReader = {"_p_GeosWktReader", "GeosWktReader *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GeosWktWriter = {"_p_GeosWktWriter", "GeosWktWriter *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GeosLinearRing = {"_p_p_GeosLinearRing", "GeosLinearRing **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **|VALUE *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_swig__ConstIterator = {"_p_swig__ConstIterator", "swig::ConstIterator *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_swig__GC_VALUE = {"_p_swig__GC_VALUE", "swig::GC_VALUE *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_swig__Iterator = {"_p_swig__Iterator", "swig::Iterator *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_GeosCoordinateSequence,
+  &_swigt__p_GeosGeometry,
+  &_swigt__p_GeosGeometryCollection,
+  &_swigt__p_GeosLineString,
+  &_swigt__p_GeosLinearRing,
+  &_swigt__p_GeosMultiLineString,
+  &_swigt__p_GeosMultiLinearRing,
+  &_swigt__p_GeosMultiPoint,
+  &_swigt__p_GeosMultiPolygon,
+  &_swigt__p_GeosPoint,
+  &_swigt__p_GeosPolygon,
+  &_swigt__p_GeosPreparedGeometry,
+  &_swigt__p_GeosSTRtree,
+  &_swigt__p_GeosWkbReader,
+  &_swigt__p_GeosWkbWriter,
+  &_swigt__p_GeosWktReader,
+  &_swigt__p_GeosWktWriter,
+  &_swigt__p_char,
+  &_swigt__p_p_GeosLinearRing,
+  &_swigt__p_p_void,
+  &_swigt__p_size_t,
+  &_swigt__p_swig__ConstIterator,
+  &_swigt__p_swig__GC_VALUE,
+  &_swigt__p_swig__Iterator,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_GeosCoordinateSequence[] = {  {&_swigt__p_GeosCoordinateSequence, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosGeometry[] = {  {&_swigt__p_GeosPolygon, _p_GeosPolygonTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiPolygon, _p_GeosMultiPolygonTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosPoint, _p_GeosPointTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosGeometry, 0, 0, 0},  {&_swigt__p_GeosLineString, _p_GeosLineStringTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosLinearRing, _p_GeosLinearRingTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiPoint, _p_GeosMultiPointTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiLineString, _p_GeosMultiLineStringTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiLinearRing, _p_GeosMultiLinearRingTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosGeometryCollection, _p_GeosGeometryCollectionTo_p_GeosGeometry, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosGeometryCollection[] = {  {&_swigt__p_GeosMultiPolygon, _p_GeosMultiPolygonTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiPoint, _p_GeosMultiPointTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiLineString, _p_GeosMultiLineStringTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiLinearRing, _p_GeosMultiLinearRingTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosGeometryCollection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosLineString[] = {  {&_swigt__p_GeosLineString, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosLinearRing[] = {  {&_swigt__p_GeosLinearRing, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosMultiLineString[] = {  {&_swigt__p_GeosMultiLineString, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosMultiLinearRing[] = {  {&_swigt__p_GeosMultiLinearRing, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosMultiPoint[] = {  {&_swigt__p_GeosMultiPoint, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosMultiPolygon[] = {  {&_swigt__p_GeosMultiPolygon, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosPoint[] = {  {&_swigt__p_GeosPoint, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosPolygon[] = {  {&_swigt__p_GeosPolygon, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosPreparedGeometry[] = {  {&_swigt__p_GeosPreparedGeometry, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosSTRtree[] = {  {&_swigt__p_GeosSTRtree, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosWkbReader[] = {  {&_swigt__p_GeosWkbReader, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosWkbWriter[] = {  {&_swigt__p_GeosWkbWriter, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosWktReader[] = {  {&_swigt__p_GeosWktReader, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GeosWktWriter[] = {  {&_swigt__p_GeosWktWriter, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GeosLinearRing[] = {  {&_swigt__p_p_GeosLinearRing, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_void[] = {  {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_size_t[] = {  {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_swig__ConstIterator[] = {  {&_swigt__p_swig__ConstIterator, 0, 0, 0},  {&_swigt__p_swig__Iterator, _p_swig__IteratorTo_p_swig__ConstIterator, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_swig__GC_VALUE[] = {  {&_swigt__p_swig__GC_VALUE, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_swig__Iterator[] = {  {&_swigt__p_swig__Iterator, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_GeosCoordinateSequence,
+  _swigc__p_GeosGeometry,
+  _swigc__p_GeosGeometryCollection,
+  _swigc__p_GeosLineString,
+  _swigc__p_GeosLinearRing,
+  _swigc__p_GeosMultiLineString,
+  _swigc__p_GeosMultiLinearRing,
+  _swigc__p_GeosMultiPoint,
+  _swigc__p_GeosMultiPolygon,
+  _swigc__p_GeosPoint,
+  _swigc__p_GeosPolygon,
+  _swigc__p_GeosPreparedGeometry,
+  _swigc__p_GeosSTRtree,
+  _swigc__p_GeosWkbReader,
+  _swigc__p_GeosWkbWriter,
+  _swigc__p_GeosWktReader,
+  _swigc__p_GeosWktWriter,
+  _swigc__p_char,
+  _swigc__p_p_GeosLinearRing,
+  _swigc__p_p_void,
+  _swigc__p_size_t,
+  _swigc__p_swig__ConstIterator,
+  _swigc__p_swig__GC_VALUE,
+  _swigc__p_swig__Iterator,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+
+  clientdata = clientdata;
+
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+
+  /* When multiple interpeters are used, a module could have already been initialized in
+     a different interpreter, but not yet have a pointer in this interpreter.
+     In this case, we do not want to continue adding types... everything should be
+     set up already */
+  if (init == 0) return;
+
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+  
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+	type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+    
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+	if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+	  cast->type = ret;
+	  ret = 0;
+	} else {
+	  /* Check for casting already in the list */
+	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+	  if (!ocast) ret = 0;
+	}
+      }
+
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+  printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+
+  if (init_run) return;
+  init_run = 1;
+
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+/*
+
+*/
+#ifdef __cplusplus
+extern "C"
+#endif
+SWIGEXPORT void Init_geos(void) {
+  size_t i;
+  
+  SWIG_InitRuntime();
+  mGeos = rb_define_module("Geos");
+  
+  SWIG_InitializeModule(0);
+  for (i = 0; i < swig_module.size; i++) {
+    SWIG_define_class(swig_module.types[i]);
+  }
+  
+  SWIG_RubyInitializeTrackings();
+  
+  SwigClassGCVALUE.klass = rb_define_class_under(mGeos, "GCVALUE", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_swig__GC_VALUE, (void *) &SwigClassGCVALUE);
+  rb_undef_alloc_func(SwigClassGCVALUE.klass);
+  rb_define_method(SwigClassGCVALUE.klass, "inspect", VALUEFUNC(_wrap_GCVALUE_inspect), -1);
+  rb_define_method(SwigClassGCVALUE.klass, "to_s", VALUEFUNC(_wrap_GCVALUE_to_s), -1);
+  SwigClassGCVALUE.mark = 0;
+  SwigClassGCVALUE.trackObjects = 0;
+  
+  swig::GC_VALUE::initialize();
+  
+  
+  SwigClassConstIterator.klass = rb_define_class_under(mGeos, "ConstIterator", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_swig__ConstIterator, (void *) &SwigClassConstIterator);
+  rb_undef_alloc_func(SwigClassConstIterator.klass);
+  rb_define_method(SwigClassConstIterator.klass, "value", VALUEFUNC(_wrap_ConstIterator_value), -1);
+  rb_define_method(SwigClassConstIterator.klass, "dup", VALUEFUNC(_wrap_ConstIterator_dup), -1);
+  rb_define_method(SwigClassConstIterator.klass, "inspect", VALUEFUNC(_wrap_ConstIterator_inspect), -1);
+  rb_define_method(SwigClassConstIterator.klass, "to_s", VALUEFUNC(_wrap_ConstIterator_to_s), -1);
+  rb_define_method(SwigClassConstIterator.klass, "next", VALUEFUNC(_wrap_ConstIterator_next), -1);
+  rb_define_method(SwigClassConstIterator.klass, "previous", VALUEFUNC(_wrap_ConstIterator_previous), -1);
+  rb_define_method(SwigClassConstIterator.klass, "==", VALUEFUNC(_wrap_ConstIterator___eq__), -1);
+  rb_define_method(SwigClassConstIterator.klass, "+", VALUEFUNC(_wrap_ConstIterator___add__), -1);
+  rb_define_method(SwigClassConstIterator.klass, "-", VALUEFUNC(_wrap_ConstIterator___sub__), -1);
+  SwigClassConstIterator.mark = 0;
+  SwigClassConstIterator.destroy = (void (*)(void *)) free_swig_ConstIterator;
+  SwigClassConstIterator.trackObjects = 0;
+  
+  SwigClassIterator.klass = rb_define_class_under(mGeos, "Iterator", ((swig_class *) SWIGTYPE_p_swig__ConstIterator->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_swig__Iterator, (void *) &SwigClassIterator);
+  rb_undef_alloc_func(SwigClassIterator.klass);
+  rb_define_method(SwigClassIterator.klass, "value=", VALUEFUNC(_wrap_Iterator_valuee___), -1);
+  rb_define_method(SwigClassIterator.klass, "dup", VALUEFUNC(_wrap_Iterator_dup), -1);
+  rb_define_method(SwigClassIterator.klass, "next", VALUEFUNC(_wrap_Iterator_next), -1);
+  rb_define_method(SwigClassIterator.klass, "previous", VALUEFUNC(_wrap_Iterator_previous), -1);
+  rb_define_method(SwigClassIterator.klass, "inspect", VALUEFUNC(_wrap_Iterator_inspect), -1);
+  rb_define_method(SwigClassIterator.klass, "to_s", VALUEFUNC(_wrap_Iterator_to_s), -1);
+  rb_define_method(SwigClassIterator.klass, "==", VALUEFUNC(_wrap_Iterator___eq__), -1);
+  rb_define_method(SwigClassIterator.klass, "+", VALUEFUNC(_wrap_Iterator___add__), -1);
+  rb_define_method(SwigClassIterator.klass, "-", VALUEFUNC(_wrap_Iterator___sub__), -1);
+  SwigClassIterator.mark = 0;
+  SwigClassIterator.destroy = (void (*)(void *)) free_swig_Iterator;
+  SwigClassIterator.trackObjects = 0;
+  rb_define_const(mGeos, "GEOS_VERSION_MAJOR", SWIG_From_int(static_cast< int >(3)));
+  rb_define_const(mGeos, "GEOS_VERSION_MINOR", SWIG_From_int(static_cast< int >(4)));
+  rb_define_const(mGeos, "GEOS_VERSION", SWIG_FromCharPtr("3.4.0dev"));
+  rb_define_const(mGeos, "GEOS_JTS_PORT", SWIG_FromCharPtr("1.12.0"));
+  rb_define_const(mGeos, "GEOS_CAPI_VERSION_MAJOR", SWIG_From_int(static_cast< int >(1)));
+  rb_define_const(mGeos, "GEOS_CAPI_VERSION_MINOR", SWIG_From_int(static_cast< int >(8)));
+  rb_define_const(mGeos, "GEOS_CAPI_VERSION_PATCH", SWIG_From_int(static_cast< int >(0)));
+  rb_define_const(mGeos, "GEOS_CAPI_FIRST_INTERFACE", SWIG_From_int(static_cast< int >(1)));
+  rb_define_const(mGeos, "GEOS_CAPI_LAST_INTERFACE", SWIG_From_int(static_cast< int >((1+8))));
+  rb_define_const(mGeos, "GEOS_CAPI_VERSION", SWIG_FromCharPtr("3.4.0dev-CAPI-1.8.0"));
+  rb_define_const(mGeos, "GEOS_POINT", SWIG_From_int(static_cast< int >(GEOS_POINT)));
+  rb_define_const(mGeos, "GEOS_LINESTRING", SWIG_From_int(static_cast< int >(GEOS_LINESTRING)));
+  rb_define_const(mGeos, "GEOS_LINEARRING", SWIG_From_int(static_cast< int >(GEOS_LINEARRING)));
+  rb_define_const(mGeos, "GEOS_POLYGON", SWIG_From_int(static_cast< int >(GEOS_POLYGON)));
+  rb_define_const(mGeos, "GEOS_MULTIPOINT", SWIG_From_int(static_cast< int >(GEOS_MULTIPOINT)));
+  rb_define_const(mGeos, "GEOS_MULTILINESTRING", SWIG_From_int(static_cast< int >(GEOS_MULTILINESTRING)));
+  rb_define_const(mGeos, "GEOS_MULTIPOLYGON", SWIG_From_int(static_cast< int >(GEOS_MULTIPOLYGON)));
+  rb_define_const(mGeos, "GEOS_GEOMETRYCOLLECTION", SWIG_From_int(static_cast< int >(GEOS_GEOMETRYCOLLECTION)));
+  rb_define_const(mGeos, "GEOS_WKB_XDR", SWIG_From_int(static_cast< int >(GEOS_WKB_XDR)));
+  rb_define_const(mGeos, "GEOS_WKB_NDR", SWIG_From_int(static_cast< int >(GEOS_WKB_NDR)));
+  
+  initGEOS(noticeHandler, errorHandler);
+  
+  rb_define_module_function(mGeos, "version", VALUEFUNC(_wrap_version), -1);
+  
+  SwigClassCoordinateSequence.klass = rb_define_class_under(mGeos, "CoordinateSequence", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosCoordinateSequence, (void *) &SwigClassCoordinateSequence);
+  rb_define_alloc_func(SwigClassCoordinateSequence.klass, _wrap_CoordinateSequence_allocate);
+  rb_define_method(SwigClassCoordinateSequence.klass, "initialize", VALUEFUNC(_wrap_new_CoordinateSequence), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "clone", VALUEFUNC(_wrap_CoordinateSequence_clone), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "set_x", VALUEFUNC(_wrap_CoordinateSequence_set_x), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "set_y", VALUEFUNC(_wrap_CoordinateSequence_set_y), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "set_z", VALUEFUNC(_wrap_CoordinateSequence_set_z), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "set_ordinate", VALUEFUNC(_wrap_CoordinateSequence_set_ordinate), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "get_x", VALUEFUNC(_wrap_CoordinateSequence_get_x), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "get_y", VALUEFUNC(_wrap_CoordinateSequence_get_y), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "get_z", VALUEFUNC(_wrap_CoordinateSequence_get_z), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "get_ordinate", VALUEFUNC(_wrap_CoordinateSequence_get_ordinate), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "length", VALUEFUNC(_wrap_CoordinateSequence___len__), -1);
+  rb_define_method(SwigClassCoordinateSequence.klass, "dimensions", VALUEFUNC(_wrap_CoordinateSequence_dimensions), -1);
+  SwigClassCoordinateSequence.mark = 0;
+  SwigClassCoordinateSequence.destroy = (void (*)(void *)) free_GeosCoordinateSequence;
+  SwigClassCoordinateSequence.trackObjects = 0;
+  
+  SwigClassGeometry.klass = rb_define_class_under(mGeos, "Geometry", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosGeometry, (void *) &SwigClassGeometry);
+  rb_undef_alloc_func(SwigClassGeometry.klass);
+  rb_define_method(SwigClassGeometry.klass, "clone", VALUEFUNC(_wrap_Geometry_clone), -1);
+  rb_define_method(SwigClassGeometry.klass, "geom_type", VALUEFUNC(_wrap_Geometry_geom_type), -1);
+  rb_define_method(SwigClassGeometry.klass, "type_id", VALUEFUNC(_wrap_Geometry_type_id), -1);
+  rb_define_method(SwigClassGeometry.klass, "normalize", VALUEFUNC(_wrap_Geometry_normalize), -1);
+  rb_define_method(SwigClassGeometry.klass, "srid", VALUEFUNC(_wrap_Geometry_srid), -1);
+  rb_define_method(SwigClassGeometry.klass, "srid=", VALUEFUNC(_wrap_Geometry_sride___), -1);
+  rb_define_method(SwigClassGeometry.klass, "dimensions", VALUEFUNC(_wrap_Geometry_dimensions), -1);
+  rb_define_method(SwigClassGeometry.klass, "num_geometries", VALUEFUNC(_wrap_Geometry_num_geometries), -1);
+  rb_define_method(SwigClassGeometry.klass, "intersection", VALUEFUNC(_wrap_Geometry_intersection), -1);
+  rb_define_method(SwigClassGeometry.klass, "buffer", VALUEFUNC(_wrap_Geometry_buffer), -1);
+  rb_define_method(SwigClassGeometry.klass, "convex_hull", VALUEFUNC(_wrap_Geometry_convex_hull), -1);
+  rb_define_method(SwigClassGeometry.klass, "difference", VALUEFUNC(_wrap_Geometry_difference), -1);
+  rb_define_method(SwigClassGeometry.klass, "sym_difference", VALUEFUNC(_wrap_Geometry_sym_difference), -1);
+  rb_define_method(SwigClassGeometry.klass, "boundary", VALUEFUNC(_wrap_Geometry_boundary), -1);
+  rb_define_method(SwigClassGeometry.klass, "union", VALUEFUNC(_wrap_Geometry_union), -1);
+  rb_define_method(SwigClassGeometry.klass, "point_on_surface", VALUEFUNC(_wrap_Geometry_point_on_surface), -1);
+  rb_define_method(SwigClassGeometry.klass, "centroid", VALUEFUNC(_wrap_Geometry_centroid), -1);
+  rb_define_alias(SwigClassGeometry.klass, "center", "centroid");
+  rb_define_method(SwigClassGeometry.klass, "envelope", VALUEFUNC(_wrap_Geometry_envelope), -1);
+  rb_define_method(SwigClassGeometry.klass, "relate", VALUEFUNC(_wrap_Geometry_relate), -1);
+  rb_define_method(SwigClassGeometry.klass, "line_merge", VALUEFUNC(_wrap_Geometry_line_merge), -1);
+  rb_define_method(SwigClassGeometry.klass, "simplify", VALUEFUNC(_wrap_Geometry_simplify), -1);
+  rb_define_method(SwigClassGeometry.klass, "topology_preserve_simplify", VALUEFUNC(_wrap_Geometry_topology_preserve_simplify), -1);
+  rb_define_method(SwigClassGeometry.klass, "relate_pattern", VALUEFUNC(_wrap_Geometry_relate_pattern), -1);
+  rb_define_method(SwigClassGeometry.klass, "disjoint?", VALUEFUNC(_wrap_Geometry_disjointq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "touches?", VALUEFUNC(_wrap_Geometry_touchesq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "intersects?", VALUEFUNC(_wrap_Geometry_intersectsq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "crosses?", VALUEFUNC(_wrap_Geometry_crossesq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "within?", VALUEFUNC(_wrap_Geometry_withinq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "contains?", VALUEFUNC(_wrap_Geometry_containsq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "overlaps?", VALUEFUNC(_wrap_Geometry_overlapsq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "eql?", VALUEFUNC(_wrap_Geometry_eqlq___), -1);
+  rb_define_alias(SwigClassGeometry.klass, "==", "eql?");
+  rb_define_method(SwigClassGeometry.klass, "eql_exact?", VALUEFUNC(_wrap_Geometry_eql_exactq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "empty?", VALUEFUNC(_wrap_Geometry_emptyq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "valid?", VALUEFUNC(_wrap_Geometry_validq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "simple?", VALUEFUNC(_wrap_Geometry_simpleq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "ring?", VALUEFUNC(_wrap_Geometry_ringq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "has_z?", VALUEFUNC(_wrap_Geometry_has_zq___), -1);
+  rb_define_method(SwigClassGeometry.klass, "area", VALUEFUNC(_wrap_Geometry_area), -1);
+  rb_define_method(SwigClassGeometry.klass, "length", VALUEFUNC(_wrap_Geometry_length), -1);
+  rb_define_method(SwigClassGeometry.klass, "distance", VALUEFUNC(_wrap_Geometry_distance), -1);
+  SwigClassGeometry.mark = 0;
+  SwigClassGeometry.destroy = (void (*)(void *)) free_GeosGeometry;
+  SwigClassGeometry.trackObjects = 0;
+  
+  SwigClassPoint.klass = rb_define_class_under(mGeos, "Point", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosPoint, (void *) &SwigClassPoint);
+  rb_undef_alloc_func(SwigClassPoint.klass);
+  rb_define_method(SwigClassPoint.klass, "coord_seq", VALUEFUNC(_wrap_Point_coord_seq), -1);
+  SwigClassPoint.mark = 0;
+  SwigClassPoint.destroy = (void (*)(void *)) free_GeosPoint;
+  SwigClassPoint.trackObjects = 0;
+  
+  SwigClassLineString.klass = rb_define_class_under(mGeos, "LineString", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosLineString, (void *) &SwigClassLineString);
+  rb_undef_alloc_func(SwigClassLineString.klass);
+  rb_define_method(SwigClassLineString.klass, "coord_seq", VALUEFUNC(_wrap_LineString_coord_seq), -1);
+  SwigClassLineString.mark = 0;
+  SwigClassLineString.destroy = (void (*)(void *)) free_GeosLineString;
+  SwigClassLineString.trackObjects = 0;
+  
+  SwigClassLinearRing.klass = rb_define_class_under(mGeos, "LinearRing", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosLinearRing, (void *) &SwigClassLinearRing);
+  rb_undef_alloc_func(SwigClassLinearRing.klass);
+  rb_define_method(SwigClassLinearRing.klass, "coord_seq", VALUEFUNC(_wrap_LinearRing_coord_seq), -1);
+  SwigClassLinearRing.mark = 0;
+  SwigClassLinearRing.destroy = (void (*)(void *)) free_GeosLinearRing;
+  SwigClassLinearRing.trackObjects = 0;
+  
+  SwigClassPolygon.klass = rb_define_class_under(mGeos, "Polygon", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosPolygon, (void *) &SwigClassPolygon);
+  rb_undef_alloc_func(SwigClassPolygon.klass);
+  rb_define_method(SwigClassPolygon.klass, "exterior_ring", VALUEFUNC(_wrap_Polygon_exterior_ring), -1);
+  rb_define_method(SwigClassPolygon.klass, "num_interior_rings", VALUEFUNC(_wrap_Polygon_num_interior_rings), -1);
+  rb_define_method(SwigClassPolygon.klass, "interior_ring_n", VALUEFUNC(_wrap_Polygon_interior_ring_n), -1);
+  SwigClassPolygon.mark = 0;
+  SwigClassPolygon.destroy = (void (*)(void *)) free_GeosPolygon;
+  SwigClassPolygon.trackObjects = 0;
+  
+  SwigClassGeometryCollection.klass = rb_define_class_under(mGeos, "GeometryCollection", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosGeometryCollection, (void *) &SwigClassGeometryCollection);
+  rb_undef_alloc_func(SwigClassGeometryCollection.klass);
+  rb_define_method(SwigClassGeometryCollection.klass, "get_geometry_n", VALUEFUNC(_wrap_GeometryCollection_get_geometry_n), -1);
+  SwigClassGeometryCollection.mark = 0;
+  SwigClassGeometryCollection.destroy = (void (*)(void *)) free_GeosGeometryCollection;
+  SwigClassGeometryCollection.trackObjects = 0;
+  
+  SwigClassMultiPoint.klass = rb_define_class_under(mGeos, "MultiPoint", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiPoint, (void *) &SwigClassMultiPoint);
+  rb_undef_alloc_func(SwigClassMultiPoint.klass);
+  SwigClassMultiPoint.mark = 0;
+  SwigClassMultiPoint.destroy = (void (*)(void *)) free_GeosMultiPoint;
+  SwigClassMultiPoint.trackObjects = 0;
+  
+  SwigClassMultiLineString.klass = rb_define_class_under(mGeos, "MultiLineString", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiLineString, (void *) &SwigClassMultiLineString);
+  rb_undef_alloc_func(SwigClassMultiLineString.klass);
+  SwigClassMultiLineString.mark = 0;
+  SwigClassMultiLineString.destroy = (void (*)(void *)) free_GeosMultiLineString;
+  SwigClassMultiLineString.trackObjects = 0;
+  
+  SwigClassMultiLinearRing.klass = rb_define_class_under(mGeos, "MultiLinearRing", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiLinearRing, (void *) &SwigClassMultiLinearRing);
+  rb_undef_alloc_func(SwigClassMultiLinearRing.klass);
+  SwigClassMultiLinearRing.mark = 0;
+  SwigClassMultiLinearRing.destroy = (void (*)(void *)) free_GeosMultiLinearRing;
+  SwigClassMultiLinearRing.trackObjects = 0;
+  
+  SwigClassMultiPolygon.klass = rb_define_class_under(mGeos, "MultiPolygon", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiPolygon, (void *) &SwigClassMultiPolygon);
+  rb_undef_alloc_func(SwigClassMultiPolygon.klass);
+  SwigClassMultiPolygon.mark = 0;
+  SwigClassMultiPolygon.destroy = (void (*)(void *)) free_GeosMultiPolygon;
+  SwigClassMultiPolygon.trackObjects = 0;
+  rb_define_module_function(mGeos, "create_point", VALUEFUNC(_wrap_create_point), -1);
+  rb_define_module_function(mGeos, "create_line_string", VALUEFUNC(_wrap_create_line_string), -1);
+  rb_define_module_function(mGeos, "create_linear_ring", VALUEFUNC(_wrap_create_linear_ring), -1);
+  rb_define_module_function(mGeos, "create_polygon", VALUEFUNC(_wrap_create_polygon), -1);
+  
+  SwigClassPrepared.klass = rb_define_class_under(mGeos, "Prepared", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosPreparedGeometry, (void *) &SwigClassPrepared);
+  rb_define_alloc_func(SwigClassPrepared.klass, _wrap_Prepared_allocate);
+  rb_define_method(SwigClassPrepared.klass, "initialize", VALUEFUNC(_wrap_new_Prepared), -1);
+  rb_define_method(SwigClassPrepared.klass, "contains?", VALUEFUNC(_wrap_Prepared_containsq___), -1);
+  rb_define_method(SwigClassPrepared.klass, "contains_properly?", VALUEFUNC(_wrap_Prepared_contains_properlyq___), -1);
+  rb_define_method(SwigClassPrepared.klass, "covers?", VALUEFUNC(_wrap_Prepared_coversq___), -1);
+  rb_define_method(SwigClassPrepared.klass, "intersects?", VALUEFUNC(_wrap_Prepared_intersectsq___), -1);
+  SwigClassPrepared.mark = 0;
+  SwigClassPrepared.destroy = (void (*)(void *)) free_GeosPreparedGeometry;
+  SwigClassPrepared.trackObjects = 0;
+  
+  SwigClassSTRtree.klass = rb_define_class_under(mGeos, "STRtree", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosSTRtree, (void *) &SwigClassSTRtree);
+  rb_define_alloc_func(SwigClassSTRtree.klass, _wrap_STRtree_allocate);
+  rb_define_method(SwigClassSTRtree.klass, "initialize", VALUEFUNC(_wrap_new_STRtree), -1);
+  rb_define_method(SwigClassSTRtree.klass, "insert", VALUEFUNC(_wrap_STRtree_insert), -1);
+  rb_define_method(SwigClassSTRtree.klass, "remove", VALUEFUNC(_wrap_STRtree_remove), -1);
+  rb_define_method(SwigClassSTRtree.klass, "query", VALUEFUNC(_wrap_STRtree_query), -1);
+  rb_define_method(SwigClassSTRtree.klass, "each", VALUEFUNC(_wrap_STRtree_each), -1);
+  SwigClassSTRtree.mark = (void (*)(void *)) mark_GeosSTRtree;
+  SwigClassSTRtree.destroy = (void (*)(void *)) free_GeosSTRtree;
+  SwigClassSTRtree.trackObjects = 0;
+  
+  SwigClassWktReader.klass = rb_define_class_under(mGeos, "WktReader", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosWktReader, (void *) &SwigClassWktReader);
+  rb_define_alloc_func(SwigClassWktReader.klass, _wrap_WktReader_allocate);
+  rb_define_method(SwigClassWktReader.klass, "initialize", VALUEFUNC(_wrap_new_WktReader), -1);
+  rb_define_method(SwigClassWktReader.klass, "read", VALUEFUNC(_wrap_WktReader_read), -1);
+  SwigClassWktReader.mark = 0;
+  SwigClassWktReader.destroy = (void (*)(void *)) free_GeosWktReader;
+  SwigClassWktReader.trackObjects = 0;
+  
+  SwigClassWktWriter.klass = rb_define_class_under(mGeos, "WktWriter", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosWktWriter, (void *) &SwigClassWktWriter);
+  rb_define_alloc_func(SwigClassWktWriter.klass, _wrap_WktWriter_allocate);
+  rb_define_method(SwigClassWktWriter.klass, "initialize", VALUEFUNC(_wrap_new_WktWriter), -1);
+  rb_define_method(SwigClassWktWriter.klass, "write", VALUEFUNC(_wrap_WktWriter_write), -1);
+  SwigClassWktWriter.mark = 0;
+  SwigClassWktWriter.destroy = (void (*)(void *)) free_GeosWktWriter;
+  SwigClassWktWriter.trackObjects = 0;
+  
+  SwigClassWkbReader.klass = rb_define_class_under(mGeos, "WkbReader", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosWkbReader, (void *) &SwigClassWkbReader);
+  rb_define_alloc_func(SwigClassWkbReader.klass, _wrap_WkbReader_allocate);
+  rb_define_method(SwigClassWkbReader.klass, "initialize", VALUEFUNC(_wrap_new_WkbReader), -1);
+  rb_define_method(SwigClassWkbReader.klass, "read", VALUEFUNC(_wrap_WkbReader_read), -1);
+  rb_define_method(SwigClassWkbReader.klass, "read_hex", VALUEFUNC(_wrap_WkbReader_read_hex), -1);
+  SwigClassWkbReader.mark = 0;
+  SwigClassWkbReader.destroy = (void (*)(void *)) free_GeosWkbReader;
+  SwigClassWkbReader.trackObjects = 0;
+  
+  SwigClassWkbWriter.klass = rb_define_class_under(mGeos, "WkbWriter", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_GeosWkbWriter, (void *) &SwigClassWkbWriter);
+  rb_define_alloc_func(SwigClassWkbWriter.klass, _wrap_WkbWriter_allocate);
+  rb_define_method(SwigClassWkbWriter.klass, "initialize", VALUEFUNC(_wrap_new_WkbWriter), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "output_dimensions", VALUEFUNC(_wrap_WkbWriter_output_dimensions), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "output_dimensions=", VALUEFUNC(_wrap_WkbWriter_output_dimensionse___), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "byte_order", VALUEFUNC(_wrap_WkbWriter_byte_order), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "byte_order=", VALUEFUNC(_wrap_WkbWriter_byte_ordere___), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "include_srid", VALUEFUNC(_wrap_WkbWriter_include_srid), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "include_srid=", VALUEFUNC(_wrap_WkbWriter_include_sride___), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "write", VALUEFUNC(_wrap_WkbWriter_write), -1);
+  rb_define_method(SwigClassWkbWriter.klass, "write_hex", VALUEFUNC(_wrap_WkbWriter_write_hex), -1);
+  SwigClassWkbWriter.mark = 0;
+  SwigClassWkbWriter.destroy = (void (*)(void *)) free_GeosWkbWriter;
+  SwigClassWkbWriter.trackObjects = 0;
+}
+

Modified: trunk/swig/ruby/ruby.i
===================================================================
--- trunk/swig/ruby/ruby.i	2011-11-06 03:25:10 UTC (rev 3517)
+++ trunk/swig/ruby/ruby.i	2011-11-24 22:07:19 UTC (rev 3518)
@@ -75,7 +75,7 @@
         Check_Type($input, T_ARRAY);
 
         /* Get the length */
-        $2 = RARRAY($input)->len;
+        $2 = RARRAY_LEN($input);
       
         /* Allocate space for the C array. */
         $1 = (GeosLinearRing**) malloc($2*sizeof(GeosLinearRing*));



More information about the geos-commits mailing list