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]开发者_StackOverflow 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
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 :)
One strategy I use when I need to generate graphs from data in a db is to extract the data in some kind of XML way (e.g. Oracle SQLX or Cocoon XSP/ESQL or eXist-db XQuery) and process it through an XSLT to generate SVG. Good old Cocoon is fine for this kind of job if you don't want to write any code (except the XSL of course ;-).
The SVG itself can be loaded in some graphic tools to reprocess.
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.
If I were in your shoes, the very first thing I'd do is try to prove that the Google Maps API won't work for your application. Then, maybe, prove that ArcGIS won't work. (Even if they don't work, they're widely used, and you get to add lines to your CV.)
精彩评论