Creating a floor plan route (Google Maps)
I'm currently in talks with a client regarding a project I'm not entirely sure I can achieve, but out of curiosity I would like to know where I can start to look for more information on how to.
The client basically wants to create a Web-based appli开发者_JS百科cation that shows the floor plan of a large building, and on user request it displays directions to and from different rooms within the building. To make things easier to understand, I've grabbed a random floor plan from our friend Google so I can explain a scenario:
Floor Plan
Now, imagine a user wants to find out how to get from '40 Seat Classroom' to '70 Seat Classroom'. My client wants the application to show the route on the floorplan of how to get from that particular room to the other.
The building we want to do this for is huge, with 100s of rooms which means 1000s of different route scenarios, so this wouldn't be a case of creating graphics for every scenario!
Is there any way of doing this? Given the fact that the application would need to pretty much know exactly where all the possible routes are, this is something pretty much exactly like Google maps. It would be great if we could use Google Map's api to create directions around a custom floor-plan, but I'm pretty sure this is not possible!
Any advise on what direction to take would be greatly appreciated.
Thank you,
Ash
Use the map only to create a graph representation of it (v.g. each room a node, and each point of the corridor with an access to a room another node, plus a node for corridor intersections). Store with your nodes which point of the map they represent. Link the nodes with segments representing the distance.
Now you just use POD (Plain Old Dijkstra*) and calculate the path using the graph.
Follow the path and draw a line in the map linking the points represented by the nodes in your map.
*: Or whatever way it is written..
精彩评论