Actually, there is one more way to write the query, which might be superior to the two I mentioned above: (3) Use GeomOverlayTouchingFilter (or its Par variant). GeomOverlayXxxFilter functions take two drawings, overlay them, then return records from the first drawing which are in the specified spatial relation with any record in the second drawing. (GeomOverlayXxx functions just return pairs of records, like the SELECT in the first post.) The result table of GeomOverlayXxxFilter is writable = directly updatable. Now, there are two obstacles to using GeomOverlayTouchingFilter on the MAP file posted above. First, the MAP file doesn't have drawings. That's solvable, we can just CREATE DRAWING using SQL, or we can use ComponentFieldDrawing to create virtual drawings to pass to GeomOverlayTouchingFilter. Second and more difficult, you are interested in touches not just with any record from [Trbn-WFL001 Table], but only with those that have [Prjct/Othr]='P'. That's solvable, we can create a query that would perform this filtering, create a drawing on that query, then pass that drawing to GeomOverlayTouchingFilter. Here's an example solution: --SQL9 CREATE QUERY [Trbn Filtered] ( PROPERTY 'Text' 'SELECT * FROM [Trbn-WFL001 Table] WHERE [Prjct/Othr]=\'P\';', PROPERTY 'FieldCoordSystem.Geom' ComponentProperty([Trbn-WFL001 Table], 'FieldCoordSystem.Geom') ); CREATE DRAWING [Trbn Filtered Drawing] ( PROPERTY 'Table' '[Trbn Filtered]', PROPERTY 'FieldGeom' 'Geom' ); CREATE DRAWING [Prprty Drawing] ( PROPERTY 'Table' '[Prprty Table]', PROPERTY 'FieldGeom' 'Geom' ); UPDATE CALL GeomOverlayTouchingFilter( [Prprty Drawing], [Trbn Filtered Drawing], 0) SET [Infr] = TRUE; First, we create a query that filters data in [Trbn-WFL001 Table]. That can be done interactively, obviously. The only interesting part of the CREATE QUERY statement is that in addition to setting the text of the query, we are also copying the coordinate system of the Geom field -- we need that because we are going to create the drawing on that query. Second, we create a drawing on the query, and also a drawing on the other table. Nothing special. This can also be done interactively. Last, we call GeomOverlayTouchingFilter on the two drawings and then we UPDATE the result. Once your data becomes large, you can upgrade GeomOverlayTouchingFilter to GeomOverlayTouchingFilterPar and specify that you want to perform the overlay using multiple threads, this will make it run faster. Hope this helps.
|