Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Question about web programming, maps to be specific

Tags:

maps

The prof gave us an assigment to finish in the next couple of months, we have to write a web app that is basically a mapping system for a floor of a building. Like a very very simple version of google maps, people need to be able to look up a room and be able to get directions from one part of the floor to another. I have never done any major web programming and don't even know how to start. Is there a google maps or mapquest API that I can use or do I have to start it from scratch? I'm not asking anyone to solve it for me, just nudge me in the right direction so as where to start.

like image 952
MapStress Avatar asked Dec 20 '25 17:12

MapStress


1 Answers

I would suggest thinking of the task as three parts:

  1. Displaying the image of the map (probably, for best efficiency, as lazily-loaded tiles like Google Maps does)
  2. Representing the rooms and the connections between them, probably as a graph. Using a graph allows you to easily use a well-documented algorithm like A* or Dijkstra's to find the shortest route from point A to point B.
  3. Converting from a click on the image to a node on the graph, and from a node on the graph to a point in the image. Probably each node should just store a pair of (x,y) coordinates.

With an arrangement like this, all your code has to do is:

The first time the user clicks
{
  Identify the nearest node to their click as node A;
}
The second time the user clicks
{
  Identify the nearest node to their click as node B;
  Use Dijkstras Algorithm or A* to find the shortest route from node A to node B;
  For each edge in the resulting route
  {
    Add a line to the image of the map;
  }
  Mark node A with a green dot and node B with a red dot (or something);
}
like image 159
AlcubierreDrive Avatar answered Dec 24 '25 11:12

AlcubierreDrive



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!