mdiener21 / python-geospatial-analysis-cookbook

Over 60 recipes to work with topology, overlays and indoor routing
https://www.packtpub.com/big-data-and-business-intelligence/python-geospatial-analysis-cookbook
MIT License
132 stars 51 forks source link

different floor layers are connected without stairs / elevators #1

Closed gischy closed 8 years ago

gischy commented 8 years ago

Hello,

I have tried to create a simple route network. I followed the tutorial steps. Im wondering why it is possible to route over different floors without having placed any stairs or elevators in the network lines. I have two layers with route network lines having the two attributes type "indoor way" and type_id "0". Currently just facing the problem that different layers get connected at intersecting floor route points of indoor ways.

mdiener21 commented 8 years ago

Have you read through the chapter ? and it does not work ? data issues are a big problem and every little detail needs to be in order for this all to work. The provided data sets only route from one floor to the next over stairs or elevators. Otherwise you have some problem. all steps 1.2.3 are listed in Chapter 8 in the book.

mdiener21 commented 8 years ago

Caution when combining the networklines is needed, if you do NOT have the data in 3D then it does NOT work,plus alll the 3D functions created too.

gischy commented 8 years ago

I followed exactly the tutorial steps. Its hard to debug that issue and i really cant get it working, sorry.

I edited the attributes of the files e01_network_lines_3857.shp and e02_network_lines_3857.shp and removed the stairs used by the example route. By replacing the attributes type and type_id from stairs to indoor way and from 3 to 0. After dropping all table in the database and starting with the edited files i got the same results. Routing over intersecting floor points is still possible. 3D Routing works over every instersecting points from different layers regardless the type and type_id.

I checked the database tables servel times without finding anything suspicious. As in the indrz_create_3d_networklines.sql script:

-- fill the 3rd coordinate according to their floor number UPDATE geodata.ch08_e01_networklines_routing SET wkb_geometry=ST_Translate(ST_Force_3Dz(wkb_geometry),0,0,1); UPDATE geodata.ch08_e02_networklines_routing SET wkb_geometry=ST_Translate(ST_Force_3Dz(wkb_geometry),0,0,2);

the floorlayers are set correctly in the database.

Commenting out the section following section did not even changed anything in the example route the ch08-05_indoor_3d_route.py outputs.

-- update stairs, ramps and elevators to match with the next layer UPDATE geodata.networklines_3857 SET wkb_geometry=ST_AddPoint(wkb_geometry, ST_EndPoint(ST_Translate(wkb_geometry,0,0,1))) WHERE type_id=3 OR type_id=5 OR type_id=7; -- remove the second last point UPDATE geodata.networklines_3857 SET wkb_geometry=ST_RemovePoint(wkb_geometry,ST_NPoints(wkb_geometry) - 2) WHERE type_id=3 OR type_id=5 OR type_id=7;

Maybe you can try it to validate that after removing the stairs next to the starting point does not effect the route in the example at chapter 8 in the book?

mdiener21 commented 8 years ago

@gischy I am not sure I understand your problem. You want to create a route that does NOT travel over the stairs or elevator ? if yes then set the elevelation of each floor to a large Z value such as 100m shown here..UPDATE geodata.ch08_e01_networklines_routing SET wkb_geometry=ST_Translate(ST_Force_3Dz(wkb_geometry),0,0,100); UPDATE geodata.ch08_e02_networklines_routing SET wkb_geometry=ST_Translate(ST_Force_3Dz(wkb_geometry),0,0,200);

mdiener21 commented 8 years ago

@gischy the source of routing results is controled by the two custom functions pgr_pointtoid3d.sql and pgr_createTopology3d.sql if you play with these you can control your routing results too.

gischy commented 8 years ago

Ich habe nocheinmal versucht eine Problembeschreibung zu erstellen: problem

mdiener21 commented 8 years ago

@gischy If you want to chat, I am on skype at "mdiener21" it is complicated to explain, SInce each floor is stored in a separate table and assigned an arbitrary Z elevation value, then all floors are merged into one single data set used in the routing call.

The uncommented SQL selects all the typeid=3 5 or 7 and creates a NEW POINT along the linestring exactly at the END of the LINESTRING and moves it to the Floor ABOVE it, if that makes sense. SInce the data flow goes from bottom to top meaning during data creation we only add stairs or elevators that go UP...meaning the top floor in a building would NEVER have any stairs or elevators in the data set.

mdiener21 commented 8 years ago

also you have not removed the stairs..you have only comment out the creation of the new POINT along the stairs, meaning the stairs are still connected geometrically. I could write at least 4 Chapters on the data alone if I had the time.

gischy commented 8 years ago

added you on skype, my account: gischy

mdiener21 commented 8 years ago

fixed