I'm currently working on a project that simulates a map with routes on it that allows users to decide their destination, and the system will calculate the shortest path to it. The map should receives real-time traffic data in which the traffic flow changes along the way while the vehicle is travelling. When the traffic flow ch开发者_StackOverflow中文版anges, the system will then calculate another shortest path by avoiding the traffic.
How exactly should I store the details of the routes in the database? I was thinking about: longitude, latitude, distance of the route, width, I'm not too sure if I'm doing it correctly.
Thank you for your attention.
What version of SQL Server are you using? If you are using SQL Server 2008 you can simply store the data is a column which uses the geography data type which will allow you to store the points of the route needed as true lan/long. Then you can retreive the stored route and simply display it.
You will almost certainly want to check some of the literature on GIS data structures, especially ways of modelling networks. Routes are usually made up of a number of sub-routes and so on down until you get to a road segment from one junction to another. What your proposed storage scheme omits entirely is any notions of connectivity between segments and sub-routes. There's a lot of good work in Open GIS for data standards -- I'm not familiar with it but it is probably a good place to start Googling.
I guess you might be intending to model each different route as a different polyline -- but if you are how will you deal with routes which are coincident over some sub-route ?
精彩评论