[Mapserver-users] PHP/mapscript + PostGIS
Vinko Vrsalovic
vinko at cprsig.cl
Wed Apr 7 05:12:25 PDT 2004
On Fri, Apr 02, 2004 at 08:44:30PM +0100, Ruggero Valentinotti wrote:
> Hi list!
> I need to use PostGIS for some vector layers joined to other tables in my database...
> I'm using also several shapefile layers.
> Everything works fine except for these two functions when I try to query the PostGIS vector layers:
> drawQuery()
> queryByShape()
>
> I have built OID and GIST indexes on my tables.
>
>
> Things improves if I use drawQuery() on a single layer (active layer),
> but queryByShape() always fails.
I stumbled upon a similar problem. I reported it some weeks ago, but got
no response (probably because nobody understood me :-) ). My guess is
that MapScript's query functions are designed and built for shapefiles,
not for PostGIS layers.
I haven't had the time to dig deeper in the issue.
> I have found some messagges about these problems in the mapserver and postgis mailing lists,
> but I can't find a solution or a workaround...
The workaround is to do the query in the DB, using SQL and the PostGIS
operators, such as:
SELECT * from mytable where mygeon && user_entered_geom_in_geo_units
and
intersects(mygeom,user_entered_geom_in_geo_units);
(user_entered_geom_in_geo_units is, for instance, a GeomFromText('MULTIPOLYGON(...)',SRID))
If you need to draw the result, you can add the DB result as a new layer
to the mapObj
--
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl
More information about the MapServer-users
mailing list