[postgis-users] Left of/Right of test

Andreas Neumann a.neumann at carto.net
Wed Jul 24 00:04:53 PDT 2013


Hi Nyall,

Interesting approach - need to test it if it works reliable with my data.

Thanks for sharing the idea.

Andreas

Am 24.07.2013 00:31, schrieb Nyall Dawson:
> 
> Another approach is to use the ST_OffsetCurve function to create two copies 
> of the linestring, one which is slightly offset to the left (eg 
> "st_offsetcurve(geom, 1)"), and one which is offset to the right 
> ("st_offsetcurve(geom, -1)"). Then you test the minimum distance from the 
> point to each of the offset curves to determine whether it's closer to the 
> left side or right side of the linestring.
> 
> eg, something along the lines of:
> 
> CASE WHEN ST_Distance(point_geom, ST_OffsetCurve(line_geom, 1)) < 
> ST_Distance(point_geom, ST_OffsetCurve(line_geom, -1)) THEN 'left' ELSE 
> 'right' END
> 
> Hope that helps!
> Nyall
> 
> 
> 
> 
> On Wednesday, 24 July 2013 05:07:09 UTC+10, Andreas Neumann wrote:
>>
>> Hi Stephen and all, 
>>
>> Thank you for your proposal. I think I will try your proposal with 
>> projection and cross-product. Will write a PostgreSQL left_of function. 
>>
>> Thanks, 
>> Andreas 
>>
> 
>  
> 



More information about the postgis-users mailing list