In an OpenLayers map I have data of several hundred/thousand buildings. There are also like ~100 other objects on the map which can move. I need to check each 100 ms if a object can see another with a maximum viewrange of say 1000 m.

For the maxviewrange I implemented an OK solution (checking distance only if src or dst moved).

Now I need to check if a line from src to dst intersects with any building. I would create a boundingbox using src and dst, then query all buildings in the boundingbox and check for an intersection with the line src dst.


I think that this is a pretty suboptimal implementation. Maybe there are some fancy implementations for the problem... But I just could not find one in OpenLayers.

Has anyone an idea to improve that or a link to a function I just did not notice?

1 Answer 1


I just did not implement ot but I might found a very performant solution. When creating the buildings they need to be stored in an indexstructure. Like this can the boundingbox check solved without checking each building.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.