[Mapserver-users] How can I create JOINS in PHP/Mapscript

Chip Hankley Chip.Hankley at rmtinc.com
Fri Jul 2 10:41:29 EDT 2004


> Is there a *joinObj *in PHP/Mapscript ?
>
> How can I join two tables to make a query like the sql :
> /SELECT cities.* FROM cities,countries WHERE 
> cities.country_id=countries.country_id AND country_name="Spain"
> /

There is a Join Object that is part of the map file:

http://mapserver.gis.umn.edu/doc42/mapfile-reference.html#join

Although I don't see it listed in the Objects in the PHP mapscript
guide. Not sure if you can CHANGE the way you have it set up in the
mapfile from mapscript (yet).

However, the beauty of using mapscript is that you can leverage all of
the functionality of PHP (or Perl or Python) that has nothing to do with
MapServer. So, you can easily get the attribute "Spain" from one of your
layers using simple, map-script based queries. From there, you can
initiate a connection to a database, and issue any query you want,
return the results, and incorporate them into your output. This approach
really has nothing to do with mapscript / MapServer, but is just basic
PHP.

hth...

chip

Outgoing messages, along with any attachments, are scanned for viruses at RMT prior to sending.
------------------------------------------------------------------------------
NOTICE--This email may contain confidential and privileged information 
for the sole use of the intended recipient.  Any review or distribution
by others is strictly prohibited.  If you are not the intended recipient,
please contact the sender immediately and delete all copies.



More information about the mapserver-users mailing list