[mapserver-users] PostGIS wildcard expression and blank map

Johan Forsman Johan.Forsman at LA.GOV
Wed Dec 2 12:27:25 EST 2009


Hello All:

I have a vexing problem where wildcard expressions in my mapfile return blank maps (tested directly in the browser address bar) when queried against a PostGIS database, but work perfectly against a shapefile. 

There are no errors indicated in the log. In fact, the log indicates that it finds all the data alright:

(snip)
[Wed Dec 02 11:02:28 2009].890000 msPostGISLayerWhichShapes got 20691 records in result.
(snip)
[Wed Dec 02 11:02:28 2009].921000 msPostGISReadShape called.
[Wed Dec 02 11:02:28 2009].921000 msPostGISReadShape: [welluse] "P-R"
[Wed Dec 02 11:02:28 2009].921000 msPostGISReadShape: [newid] "001-1060"
[Wed Dec 02 11:02:28 2009].921000 msPostGISReadShape: [index] 4
[Wed Dec 02 11:02:28 2009].921000 msPostGISReadShape: [shape] POINT (577278.4106000000600000 3355380.4495999999000000)
[Wed Dec 02 11:02:28 2009].921000 msPostGISLayerNextShape called.
(snip)

There are indeed 20691 records in the table. The "welluse" field contains entries that start with one of the letters "P", "N", "T", "Z", or "O", and are classified based on these letters.

The mapfile contains the following relevant lines:

(snip)
CLASSITEM "welluse"
  CLASS
    NAME "Public"
    EXPRESSION /P^/
(snip)

Using

	EXPRESSION /P^/

returns nothing from PostGIS, but the proper results from the shapefile (all records that start with the letter "P" in the field "welluse"). There are no errors returned from PostGIS, just a blank map and entries as shown in the log snippet above.

Using

	EXPRESSION /P-R/

returns the correct results (all records with "P-R" in the field "welluse") from PostGIS and the shapefile.

I have tried crafting an expression using the SQL "LIKE" operator, e.g. various forms of

	EXPRESSION ([welluse] like 'P%')

which usually works in SQL, but appears to not be supported in this instance based on all the syntax errors in the log after trying it, hence trying the regex above.

I am certain I am missing something obvious, but I would nevertheless appreciate your advice. I am trying to migrate the point data to PostGIS to improve on the query performance which is too poor using shapefiles on our humble server. Then I may be back to ask why php_cgi.exe crashes in ntdll.dll every time I try to query a dataset in PostGIS but works fine (but too slow) when using shapefiles, but I'll leave that for a later time.

I am currently using the MS4W beta from earlier this autumn, version 3 I think. It shipped with MS 5.4.2, but I have updated the to the RC1 version of MS 5.6 while looking for a solution to the php crashes (no difference).

Thanks in advance,
Johan.

----------------------
Johan Forsman
Geologist
Safe Drinking Water Program
Louisiana Department of Health and Hospitals
Office of Public Health
Telephone: 225.342.7309
Telefax: 225.342.7303




More information about the mapserver-users mailing list