I have records in a table representing bus routes, with SQL Server spatial columns for the actual route geometry. (They're stored in a Geography
column type.)
I use OpenLayers to display these bus routes on top of an OpenStreetMap layer.
In instances where the bus routes overlap, currently you cannot see anything but the top route. I've tried using transparency on the lines, but it doesn't look that great.
Is there a way, either in OpenLayers or SQL Server spatial, to take overlapping lines and shift them slightly (but keep them parallel) in order to have them all visible? If nothing is built in to handle this, is there a standard algorithm to accomplish this?
SQL Server Spatial Tools has a method, ShiftGeometry
, that will shift a geometry (not geography) over by a given X and Y amount.
So, you could, for each successive geography:
Alternatively, rather than shift lines over, fatten them up:
Looks expensive!
OpenLayers may have something for this. If not, it may have better primitives for accomplishing it. On SQL Server, it's going to be very CPU intensive. Intersects aren't cheap, and you will very quickly need to perform a lot of intersects.