I would like to retrieve the set of buildings I can see from a given location (point -lat,lng) and orientation (interval of angles) + certainly with a given depth (e.g. 100 meters). Ideally I would like as output something like: from angle 1 to angle2 the user can see building 1, from angle 2 to angle3 we see building 2.
Data = Polygons representing the buildings of a city in shapefile.
input: a location and an orientation (angle range) to represent the visual perception of a person.
output:
Version 1 - a list of {BuildingID}
Version 2 (better)- list of {BuildingID, set of visible segments for each building (facade of buildings)}
Version 3 (ideal output) - a list of {buildingID, angle ranges}. (for exemple , from angle 1 to angle2 the user can see building 1, from angle 2 to angle3 we see building 2, etc..)
Toolbox I can use: PostGis, QGis, ruby, R
start of solution for output v1:
- creating a triangle representing the simplified visual scope of the user for a given point and orientation (internval of angle) and with a certain radius/deepth (e.g. 100 meters)
- computing intersection with buildings (e.g. ST_INTERSECTION) and visual scope. but a building can hide another one so pure intersection between visual scope and buildings might add no visible buildings. this issue need to be tackled.
update: potential solution 2
- creating a triangle representing the simplified visual scope of the user for a given point and orientation (internval of angle) and with a certain radius/deepth (e.g. 100 meters)
- creating n rays (LINE) at different angles filling the scopes.
- transforming all buildings(POLYGONS) into SEGMENTS/LINES
- for each ray finding the closest SEGMENT and the related buildingID. (ST_DISTANCE , ST_DWithin)
at this stage so we should have a list of rays and the related building ID.
- then we could aggregate this list {ranges of angle,related building ID}.
Any idea about a more efficient way to do?