[postgis-users] ST_Touches and line segment

Martin Davis mbdavis at refractions.net
Thu Mar 19 11:26:22 PDT 2009


Yes, an auxilary matching function would also work well, and might be 
more modular.  Although it's always nice to keep APIs as narrow as 
possible, and in this case since the input is simply a string, there's a 
lot of latitude in the semantics of how that string is interpreted.

One advantage of a separate function is that the intersection matrix 
string could be computed once, and, and then the matching function could 
be used potentially several times on it (if there was some wierd 
situation which wasn't accounted for in the pattern language).  Of 
course, you could skip having a pattern language completely, and simply 
express the logic in the host language - but this is likely to be less 
clear than a special-purpose language.

One advantage of having the pattern matching take place inside the 
relate function is that allows for potential optimization.  Some 
patterns might not require a full relationship computation (e.g. 
interiors intersect).

Kevin Neufeld wrote:
> That might be a nice expansion (or as an array list) - I know I've 
> come across situations where it would have been useful.
>
> Or/And, you could provide some routines that return TRUE on successful 
> pattern matches, ie. ST_MatrixMatches('101-F00-FF2','1TT-F*T-***').  
> In the same manner, one would only compute relate once (presumably in 
> a subquery) and then compare the matrices.
>
> -- Kevin
>
> Martin Davis wrote:
>> I've had some thoughts that it would be nice to extend the concept of 
>> Intersection Matrix Pattern to allow OR combinations of patterns.  
>> This seems to indicate that it's also necessary to be able to specify 
>> different patterns for different combinations of geometry dimension.
>>
>> Perhaps a syntax like:
>>
>> "PP:***-*1*-*** LL:1***-***-*** PL:***-1**-***"
>>
>> The LP pattern can be automatically inferred from this.
>>
>> Note that I'm also using a "dashed triplet" syntax, which is more 
>> readable than a solid string of 9 chars (think phone numbers or IP 
>> addresses)
>>
>>
>> Kevin Neufeld wrote:
>>> Martin Davis wrote:
>>>> Kevin Neufeld wrote:
>>>>>
>>>>> If you have overlapping polygons then use ST_Relate with a custom 
>>>>> matrix.  IE. ST_Relate(g1, g2, '****1****') will return TRUE for 
>>>>> all geometry pairs where the intersection of the boundaries occur 
>>>>> on a line (1).
>>>> You need to know the type of the input geometries.   The above 
>>>> pattern will work for polygons, but not for lines.  The L/L and P/L 
>>>> situation require different patterns:
>>>>
>>>> L/L: 1********
>>>> P/L: ***1*****
>>>
>>> Ah, yes, of course :)
>>> The symmetric relation is also true:
>>>
>>> L/P: *1*******
>>>
>>> -- Kevin
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-users mailing list