Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating maps Dynamically

I am looking to generate transport maps in a style similar to the iconic London underground [tube] map.

These maps will change from time to time and many will be required so instead of drawing them up manually in inkscape [or similar] I am hoping to have them generated dynamically from a db or dataset.

Does anyone know if there is any library apis etc. out there that would help with this task, or any suggestions in general of how [or how not] to go about this ?

I am thinking svg's would be the best way to go with this, plus there may be need for basic interactivity down the line.

I am working in php so otherwise it's GDlib, ImageMagick ?

Thanks in advance.

.k

like image 250
Keith Avatar asked Jan 18 '11 03:01

Keith


People also ask

What is dynamic map?

The Dynamic map is an interactive map where the user can freely pan and zoom. On this map, it is possible to place large amounts of markers and to link them with loaded data. This type of visualization will be stored on a server of MapCreator; the so-called hosted solution.

What features make a map dynamic or interactive?

In an interactive online map, the user can view additional landmarks and points of interest by zooming in and out of the map. These points of interest will reveal additional details when clicked on. In an Dynamic Map, the user can view layers of data by zooming in and out of the map.


1 Answers

Well, the answer really isnt in how to use GD or ImageMagick, there are manuals for that. As for helper libraries, most libraries focus on graphing, anything else you will have to write yourself. Your best bet as a solution would be to have your admin interface generate the images when data in the backend changes and cache the images, since there's no reason to build the image every time someone accesses it.

For generating maps, i think your best bet would be defining stations with one or many 'lines' which determine some sort of indicator of relationship to the stations around, and an x,y. You'd probably only need to determine a 'parent' station since you're just drawing lines from a-b. That way you can position them in the same manner as they're typically rendered on the actual trains, use the lines and surrounding stations to draw mappings.

Doesn't sound like too difficult a problem. 3 tables:

  • stations [stationid,name,x,y,meta1,meta2],
  • placements [placementid,stationid,lineid,parentstationid],
  • lines [lineid,name,meta1,meta2,colour,etc].

SVG would be pretty good at this sort of thing, and you would avoid the whole image building and caching process, but be wary of browser support issues.

Sounds like a pretty interesting project though, good luck :)

like image 199
jhogendorn Avatar answered Oct 09 '22 05:10

jhogendorn