[mapserver-users] PostGIS function calls in query template?
Michael Scharber
mscharber at josh.ucsd.edu
Thu Aug 30 14:25:42 PDT 2001
Hi Paul (Dave too),
Thanks (to both of you) for your input. It makes sense to me now that the
.html template is something that gets filled in after the query executes,
meaning Mapserver/PostGIS wouldn't have any knowledge of those derived
fields before hand. Just for kicks I tried to get around it the easy way
(similar to Dave's initial suggestion to tack on the extra fields I need
directly into the table definition) by creating a view with the derived
fields I want (e.g x(shape) as "longitude", y(shape) as "latitude",
z(shape) as "height"). I made the corresponding change to my .map file
for Mapserver and the browsing, zoom in, zoom out etc, works just
fine...however any queries now bomb. I get "msSearchDiskTree(): Unable to
access file.".
Any suggestions/explanations as to why this is failing? The only thing I
changed in all of my Mapserver config is:
DATA "shape from monument_catalog"
to
DATA "shape from ss_monument_catalog" (the view)
Thanks again,
Michael
On Thu, 30 Aug 2001, Paul Ramsey wrote:
> Hi Michael,
> The short answer, is 'no' you cannot do this. When mapserver is pulling
> attributes from the database, it is checking the system tables to find
> the attribute names, then pulling just those values. It might be
> possible to make some changes to the postgis access code to allow users
> to specify additional attributes as 'x(geometry) as xcoord' additions to
> the SQL statement.
> A more expedient workaround is to use PHP/Mapscript as your programming
> base, get the geometry ID's from a given query and then use the direct
> PHP->pgsql connection to do whatever additional queries you want to do.
> Probably less hacky in the long run.
> Paul
>
> Michael Scharber wrote:
> >
> > How can I use a derived field in a Mapserver query template .html file?
> > I mean, can I wrap an attribute from a relation with a PostGIS geometry
> > field (used as a layer in Mapserver) with a function call?
> >
> > ex. [x(shape)] to present the user with the x (Longitude in my case) of a
> > tuples' shape (geometry) attribute.
> >
> > TIA
> >
> > Michael Scharber
> >
> > --
> > *******************************************************
> > Michael Scharber
> > Scripps Institution of Oceanography
> > Institute of Geophysics and Planetary Physics
> > 8785 Biological Grade
> > IGPP Room 4212
> > La Jolla, CA 92037
> >
> > mscharber at josh.ucsd.edu
> > (858)534-1750
> > *******************************************************
>
--
*******************************************************
Michael Scharber
Scripps Institution of Oceanography
Institute of Geophysics and Planetary Physics
8785 Biological Grade
IGPP Room 4212
La Jolla, CA 92037
mscharber at josh.ucsd.edu
(858)534-1750
*******************************************************
More information about the MapServer-users
mailing list