[geos-devel] PostGIS CVS has GEOS support
David Blasby
dblasby at refractions.net
Wed Apr 9 14:54:14 EDT 2003
The PostGIS CVS now has GEOS support.
Here's some instructions. The Makefile is a bit "iffy" right now until
paul takes a look at it.
So if things dont work for you they should fix themselves in a few days.
USE AT OWN RISK.
a. this version of GEOS leaks memory very quickly (nothing is ever deleted)
b. using relate()-type function with a geometrycollection will throw an
error
c. functions added are:
relate(g1,g2) - returns the 3*3 matrix
relate_pattern(g1,g2,pattern) - returns true if relate(g1,g2) is
'compatible' with pattern.
overlaps(g1,g2) - returns true if g1 overlaps g2
contains(g1,g2) - returns true if g1 contains g2
within(g1,g2)- returns true if g1 is within g2
crosses(g1,g2)- returns true if g1 crossesg2
intersects(g1,g2)- returns true if g1 intersectsg2
touches(g1,g2)- returns true if g1 touches g2
disjoint(g1,g2)- returns true if g1 disjoint from g2
isvalid(g) - returns true if g1 is a valid geometry
These are defined in the OGC SF SQL specification - they are not always
what you might think!
http://www.opengis.org/techno/specs/99-049.pdf
Here's what to do (EXACTLY like a normal postgis install)
0. install GEOS
1. get new postgis CVS
2. set PGSQL_SRC to your postgresql source (like normal)
3. make
- if you have troubles compiling postgis_geos_wrapper.cpp,
something like this should do the trick (with 2 warning):
g++ -Wall postgis_GEOSwrapper.cpp -c -I/usr/local/include
-I/usr/local/include/geos
4. make install
5. create your database
6. install plpgsql language in your new database
7. install the postgis.sql file in your new database
8. TEST: upload the two new tables in postgis/regress/
psql geos2 < relate_test 555 relate() tests
psql geos2 < isvalid_test 806 isvalid() tests
9. TEST: check results
select relate(g1,g2),result, relate(g1,g2)=result from relate_test ;
This should give 0 rows:
select relate(g1,g2),result from relate_test where
relate(g1,g2)!=result;
select isvalid(g), result, comment from validtest ;
This should give 0 rows, but gives 7 because GEOS says
repeated points are invalid, but JTS 1.3 says they are.
This will be fixed soon.
select g,isvalid(g), result,comment from validtest where isvalid(g)
!= result;
More information about the geos-devel
mailing list