One way of pulling your one to many relationship from postgresql is to use the layer template to set it to a URL, such as a php script, that passes the city value and that php script then does a query to your postgresql database and presents the results. There have been posts to the mapserver list about this and I believe that Richard Greenwood has published a paper that discusses this technique.
The other way to present one to many relationships, and a method that I have employed recently, is to embed a URLs right into your shapefile so that when a user queries each city, they see the URL and click on that to show the one to many results. The url being one that looks like the one you would have created in the above example. Please do some searches in the list archive on "querying" and maybe you will find examples of these methods. Also - check the mapserver documentation on templates. Hope this helps. D. Pagurek -----Original Message----- From: UMN MapServer Users List [mailto:[EMAIL PROTECTED] On Behalf Of Carlo Calvino Sent: Thursday, October 20, 2005 11:53 AM To: [email protected] Subject: [UMN_MAPSERVER-USERS] one-to-many relationship between Mapserver and PostgreSQL Hello everybody, I use Mapserver to publish some .SHP files. Let's take into consideration a city layer. We use the Query function to see the data associated with the city feature, for example, the name of the city, the population etc. This data is stored in the shapefile. This works fine. Furthermore, I use postgresql as a database. In one database I have a table called "Monuments". For each city, there are several monuments. So the relationship between the city and the monument is one-to-many. Inside MapServer I wish to click on a city, and the result is the information inside the shapefile, and also the monuments found in the postgresql database. Of course, there is the same primary key inside the shapefile table and the postgresql table, that is the name of the city. But How i connect MapServer with PostgreSQL?
