This question already has an answer here:
I am doing indoor multi-floor routing using pgRouting.
At the moment, I have a dummy network system created to analyze shortest routes between locations with the results served as a WMS layer in GeoServer. My initial test of the system only included a simple network created on the same z-plane, and everything works perfectly.
At that point, I created some mock interior floor plans to create indoor networks on two separate floors. For simplicity, I simply assigned the z-elevation of the bottom floor as ‘0’ and the upper floor as ‘10’. I then created the vertical corridors (e.g. elevators and stairs) in ArcScene to make sure the vertical connections existed, resulting in a fully-connected 3D network.
Using the SQL code found here https://github.com/mapcentia/geocloud2/blob/master/app/scripts/sql/pgr_createTopology3D.sql, I created the modified pgr_createTopology3d and pgr_pointToIdZ functions to build topology on the 3D network. Following that, I followed normal procedure for building the SQL View to serve the queried results as a layer to GeoServer.
Now that I have the 3D network in the routing system, I tried running some test queries across different floors to ensure that it routes appropriately; unfortunately it does not. Instead, the system continues to operate on the same z-plane, and seems to ignore the z-values in the vertices, meaning a route is returned, but only on the plane with z-levels assigned as ‘0’. I’m guessing this has to do with the SQL Statement that’s entered when creating the SQL View in GeoServer. Right now, the statement is as follows:
SELECT ST_MakeLine(route.geom) FROM ( SELECT geom FROM pgr_fromatob('ways', %x1%, %y1%, %x2%, %y2% ) ORDER BY seq) AS route
That statement above is passing to/from lat/longs to the table ‘ways’ to produce the resulting shortest path; however, there’s nothing in there to give the query any sort of z-information.
Is that where things are going wrong and not correctly routing across multiple floors?
If so, can anyone provide insight on how to correct the SQL Statement to consider z-values?
I’m no SQL expert and been trying a number of different modifications, but nothing working as of yet.