From 4131cef145db7a96660ef0a3c0a9dceb66afcc9f Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 9 Sep 2004 19:08:45 +0000 Subject: [PATCH] Added FAQ for mapserver section and entries on SQL spatial queries. git-svn-id: http://svn.osgeo.org/postgis/trunk@791 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/postgis.xml | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/doc/postgis.xml b/doc/postgis.xml index f2b952099..884024f7b 100644 --- a/doc/postgis.xml +++ b/doc/postgis.xml @@ -1900,6 +1900,95 @@ END + + Frequently Asked Questions + + + + + + When I use an EXPRESSION in my map + file, the condition never returns as true, even though I know + the values exist in my table. + + + + Unlike shape files, PostGIS field names have to be + referenced in EXPRESSIONS using lower + case. + + EXPRESSION ([numlanes] >= 6) + + + + + + The FILTER I use for my Shape files is not working for + my PostGIS table of the same data. + + + + Unlike shape files, filters for PostGIS layers use SQL + syntax (they are appended to the SQL statement the PostGIS + connector generates for drawing layers in Mapserver). + + FILTER "type = 'highway' and numlanes >= 4" + + + + + + My PostGIS layer draws much slower than my Shape file + layer, is this normal? + + + + In general, expect PostGIS layers to be 10% slower than + equivalent Shape files layers, due to the extra overhead + involved in database connections, data transformations and + data transit between the database and Mapserver. + + If you are finding substantial draw performance + problems, it is likely that you have not build a spatial index + on your table. + + postgis# CREATE INDEX geotable_gix ON geotable USING GIST ( geocolumn ); +postgis# SELECT update_geometry_stats(); -- For PGSQL < 8.0 +postgis# VACUUM ANALYZE; -- For PGSQL >= 8.0 + + + + + + My PostGIS layer draws fine, but queries are really + slow. What is wrong? + + + + For queries to be fast, you must have a unique key for + your spatial table and you must have an index on that unique + key. + + You can specify what unique key for mapserver to use + with the USING UNIQUE clause in your + DATA line: + + DATA "the_geom FROM geotable USING UNIQUE gid" + + If your table does not have an explicit unique column, + you can "fake" a unique column by using the PostgreSQL row + "oid" for your unique column. "oid" is the default unique + column if you do not declare one, so enhancing your query + speed is a matter of building an index on your spatial table + oid value. + + postgis# CREATE INDEX geotable_oid_idx ON geotable (oid); + + + + + + Advanced Usage @@ -1965,6 +2054,14 @@ END + + + The parser for Mapserver PostGIS layers is fairly primitive, + and is case sensitive in a few areas. Be careful to ensure that all + SQL keywords and all your USING clauses are in + upper case, and that your USING UNIQUE clause + precedes your USING SRID clause. + -- 2.40.0