<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>I'm not sure if the unioning desired is dynamic & user driven or not. Robert's WPS solution will work if such a dynamic union is required - carried out at runtime as requested by the user and driven by user supplied parameters.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span>Another possibility, which mapserver is quite capable of serving, can be achieved using Postgis - a data management tool rather than simple shapefiles. Load each shapefile into a Postgis database and use the database for the required data processing.</span></div><div style="color:
 rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span>As a relational database, the Postgis "layer" served as WMS or WMS can be the result of a query which unions the two layers - also at runtime - but as directed by the server (actually the SQL statement in mapserver that defines the layer being served).</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">This approach abstracts (separates) the delivery of the spatial data by mapserver from the
 underlying data manipulation (UNIONING) in Postgis.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">For example, the data layer served by mapserver is defined by a Postgis SQL on two tables (shapefiles) a & b - (a) being properties & (b) waterfalls:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; background-color: transparent; font-style: normal;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">"select distinct a.id,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
 arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">        a.name,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">        a.owner as owner_name,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">        b.name as waterfall_name,<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier
 New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">        ST_Union(a.geom, b.geom) as geomunion</span><br><span></span>where ST_Intersects(a.geom, b.geom);"<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">The output is the geometric union of each waterfall with the each property it interects spatially, along with attributes from both tables. This is admittedly simplistic, and probably needs some refinement to be robust in the real world, but hopefully it illustrates how this sort of union can perhaps be served by mapserver without a
 WPS.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">Also, note that the SQL can be modified on the fly, using either OGC filter encoding or mapserver variable substitution, to accept an additional where clause so that the user can select a waterfall name or property owner name as a filter, & just return the matching records, which also provides some of the user control of parameters that a more sophisticated WPS can provide.<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color:
 transparent; font-style: normal;">Given the layer is defined by a join on two tables which is carried out at runtime - the result will always be current - so results may change between requests as the contents of the underlying tables change.<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">Cheers<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div>Brent Wood<br><br><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span
 style="font-weight:bold;">From:</span></b> Robert Sanson <Robert.Sanson@asurequality.com><br> <b><span style="font-weight: bold;">To:</span></b> mapserver-users@lists.osgeo.org; saka royban <sakaroyban@yahoo.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, December 30, 2013 9:44 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [mapserver-users] Intersect and Union with mapserver<br> </font> </div> <div class="y_msg_container"><br>What you need is a Web Processing Service (WPS). The client app needs to allow the user to select the two layers to UNION or Intersect, then pass the request to the WPS which performs the task, and passes the resulting layer back to the client for display. I don't believe Mapserver can do this yet, although it could participate in the selection process and the display of the result. <br><br>regards,<br><br>Robert<br><br>>>> saka royban <<a
 ymailto="mailto:sakaroyban@yahoo.com" href="mailto:sakaroyban@yahoo.com">sakaroyban@yahoo.com</a>> 30/12/2013 6:21 a.m. >>><br>Thanks steve.<br>Because i'm kind of ArcGIS-oriented guy, i should explain what i see there<br>and loonking for that here.<br>Supppose that 2 verctor layers as input, Union analysis produces another<br>vector layer with attributes of both input layers while features of input<br>layers are UNIONED.<br>I hope i have explained well what i have in my mind.<br><br>(and sorry for my english, as well).<br><br>Regards<br><br><br><br>--<br>View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/Intersect-and-Union-with-mapserver-tp5095717p5095731.html" target="_blank">http://osgeo-org.1560.x6.nabble.com/Intersect-and-Union-with-mapserver-tp5095717p5095731.html </a><br>Sent from the Mapserver - User mailing list archive at Nabble.com.<br>_______________________________________________<br>mapserver-users
 mailing list<br><a ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a> <br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br><br><br><br>This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.<br><br>This message has been scanned for Malware and Viruses by Websense Hosted Security.<br>www.websense.com<br>_______________________________________________<br>mapserver-users mailing list<br><a ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
 target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br><br><br></div> </div> </div>  </div></body></html>