I have OSM .shp file of buildings. I created vertices along each line of the building in that way: vertices (red) & mid points (green). The mid points made by ST_Line_Interpolate_Point() after breaking the buildings to lines.
I have single location (blue star) from which I want to make lines to all vertices, such that the lines not intersects the buildings (blue lines OK, black lines NOT OK).
I started that way:
WITH cross_lines AS ( SELECT DISTINCT ST_MakeLine(vertices.geom, ST_GeomFromText('POINT(lon lat)', 4326)) AS lines_geom FROM vertices, buildings --vertices are green+red ) SELECT DISTINCT cross_lines.lines_geom FROM cross_lines, buildings WHERE ST_Touches(cross_lines.lines_geom, buildings.geom);
The result is as follows:
- I use ST_Touches and not ST_Intersects because from some reason it gives me best results. It gives me almost all the lines but-
- It ignores the mid points made by ST_Line_Interpolate_Point() (green).
Is it possible ST_Line_Interpolate_Point not locating points exactly on the lines of the buildings?