[geos-devel] GEOS with PostGIS - how to

Paul Ramsey pramsey at refractions.net
Tue May 27 18:40:34 EDT 2003


Dave,
For our own PostGIS/GEOS implementation, do we still have an outstanding memory 
management issue? I believe we were not deleting GEOS geometries, and thus 
leaking memory.
Paul

Quoting David Blasby <dblasby at refractions.net>:

> We have gotten GEOS to work (with exceptions) with PostGIS.
> 
> The solution is quite simple - you have to link the C++ standard library
> into postgresql.  For a complete technical discussion on this, see the
> previous messages in the GEOS mailing list.
> 
> THIS IS EXPERIMENTAL
> 
> Linking stdc++ (the c++ standard library) into postgresql is done by
> setting the LDFLAGS environment variable and running configure.
> 
> 1. move to your postgresql source directory
> 2. LDFLAGS=-lstdc++ ./configure <whatever options you want to compile
> postgresql with>
> 3. make clean;make; make install
> 4. verify that your postmaster has libstdc++:
>      [postgres at hydra init.d]$ ldd /opt/pgsql73/bin/postmaster
>          libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3
> (0x40028000)
>          libz.so.1 => /lib/libz.so.1 (0x40075000)
>          libreadline.so.4.2 => /lib/libreadline.so.4.2 (0x40084000)
>          libncurses.so.5 => /lib/libncurses.so.5 (0x400ae000)
>          libcrypt.so.1 => /lib/libcrypt.so.1 (0x400ef000)
>          libresolv.so.2 => /lib/libresolv.so.2 (0x4011c000)
>          libnsl.so.1 => /lib/libnsl.so.1 (0x4012e000)
>          libdl.so.2 => /lib/libdl.so.2 (0x40144000)
>          libm.so.6 => /lib/libm.so.6 (0x40147000)
>          libc.so.6 => /lib/libc.so.6 (0x40169000)
>          libgpm.so.1 => /usr/lib/libgpm.so.1 (0x402a6000)
>          /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> 
>    NOTICE "libstdc++-libc6.2-2.so.3" in the list.
> 
> Next you need the most up-to-date postgis.
> 
> 1. checkout the postgis CVS archive
> 2. compile and install
> 3. there are several new GEOS related functions, so I suggest you run
> the postgis.sql install file into a new database.
> 
> To test:
> 
> dblasby=# select disjoint('LINESTRING(0 0,0 0)'::geometry, 'LINESTRING(0
> 0,0 1)'::geometry );
> ERROR:  GEOS disjoin() threw an error!
> 
> 
> More test are available:
> 
> 1. cd to the postgis regress directory
> 2. load the  isvalid test data with something like:
> 	psql  dblasby < isvalid_test
> 3. load the relate test data with something like:
> 	psql  dblasby <  relate_test
> 4. you should see two new tables in your database 'validtest' and
> 'relate_test'.
> 5. run these tests - you should get the same answers:
> dblasby=# select count(*) from relate_test WHERE  relate (g1,g2) <> result;
>   count
> -------
>       0
> (1 row)
> dblasby=# select count(*) from relate_test WHERE  relate (g1,g2) = result;
>   count
> -------
>     555
> (1 row)
> dblasby=# select count(*) from validtest WHERE isvalid(g) = result;
>   count
> -------
>     799
> (1 row)
> dblasby=# select count(*) from validtest WHERE isvalid(g) <> result;
>   count
> -------
>       7
> (1 row)
> 
> 
> NOTE: the 7 "errors" in the validtest are okay - repeated points in JTS
> 1.2 are invalid, but valid in 1.3.  GEOS is currently based on JTS 1.2,
> but the test results are based on JTS 1.3.
> 
> 
> Please report to this list that you have successfully installed it and
> it works on your system.
> 
> 
> dave
> ps. I have not changed how postgis includes the new functions like
> norman suggested in "RE: [geos-devel] Re: [postgis-users] GEOS /
> Predicates Update" to the postgis mailing list.  Thats a todo.
> 
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
> 







More information about the geos-devel mailing list