Saturday, 7 July 2018

Determining what side of line point is on using PostGIS?


I want this in order to generate house numbers, odd or even depending on wether a feature is on one side of a street line or not . Thanks




In the end i think the most portable way is to use this( BTW line is actually 'linestring' not segment):


ST_LineCrossingDirection( linefromAtoB,streetline) <0 where A is the point , B is ST_ShortestPoint(thepoint,streetline); if <0 then linefromAtoB enters through the left of The streetline; if >0 the it enters from right side of streetline). You have to determine what street line is closest to each point first.




I made a mistake: C is the symmetric of A in relation to B= ST_ShortestPoint(thepoint,streetline). C's coordinates are XC=2*(XB-XA) -XA and for y YC=2*(YB-YA) -YA.
ST_LineCrossingDirection( linefromAtoC,streetline) <0 where A is the point , ; if <0 then linefromAtoC enters through the left of The streetline; if >0 the it enters from right side of streetline). You have to determine what street line is closest to each point first.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...