A Public Transport Mapping Example Using perl and mySQL
Extended Abstract for the SVG Open 2003 Conference, 13-18 July,
2003
There exists an ongoing challenge for presenting public
transport internet information in an optimal way. This challenge
was greatly eased with the introduction of SVG. Benefits are
experienced for intending passengers, as SVG opens up a whole new
way of organising information about public transport services,
times and routes.
My proposed presentation deals with a public transport mapping
and information site currently being constructed for services in the City of
Brisbane, Queensland, Australia. The Brisbane region is the
third-most populous in Australia. For the purpose of the example,
we restricted our database to the major rail operator, covering
Queensland, and the major bus operator in Brisbane. To illustrate
the scale of the project, the Brisbane City Council area is home
to 900,000 people. The database contains about 8000 stopping
places and 1900 route kilometres.
The presentation will concentrate on what we discovered when
putting everything together.
The live internet address is at
http://qroti.com/placeinfo/map/. QROTI (Queensland's Railways
On The Internet) was established in 1996 as a non-profit
organisation, providing an independent source of rail transport
information in the area. It's from this base that we were able to
explore the possibility of including all modes of public transport
(i.e. rail, bus and ferry) in our website portfolio using SVG.
We used perl and mySQL in the project due to their free nature
and potential for rapid application development. The target user
agents were Internet Explorer 6 for Windows and the Adobe SVG
Viewer 2, as they are the most popular combination in the
field.
The original data sources (MapInfo Interchange Format for transport routes
and Comma Separated Values for timetables) were imported into mySQL
using custom perl scripts. perl scripts are also used to
dynamically generate timetables and maps to the web from the mySQL
tables.
Our development approach emphasised the following:
- Small transmission size over the network.
- Densely hyperlinked maps.
- High compatibility with varying user agents.
- Protection of intellectual property.
Features of the example are:
- Maps can be generated to show all services in a suburb, route
span or around a bus stop (typically up to 5km extent). These can
show all streets, routes, stops, water features and various
labelling of landmarks - this selection strikes a balance between document size and
usability.
- Maps can also be generated to show a full route (or several
combined routes); including stops on that route (typically up to
25km extent). To save document size, only major streets are shown
for a user's frame of reference.
- The following items on a map are hyperlinked:
- Bus stops / Railway stations - shows details about that place
as well as the local timetable and the routes passing.
- Bus routes / Train lines (not yet online) - shows routes
passing at that point.
- Suburb names (not yet online) - shows features in that suburb,
redrawing the SVG map accordingly.
- Coordinates specifying map elements are obfuscated to make
reverse-engineering of the data set more difficult.
- Text-on-a-path is well used here in the labelling of routes and
streets
- Data is rendered to the SVG stream in an interlaced format,
exercising the progressive rendering abilities of user agents.
- Spatial details can be generalised at wider zoom levels,
eliminating redundant nodes from being rendered to the SVG
stream.
Features that can be added once we have a full corpus of data
might be:
- Graduate the size of stop symbols and/or route lines according
to the frequency of service, as a visual cue to the user.
- Dynamic labelling of routes and stops, so that printed maps
have greater utility.
- A route map starting at a given stop, oriented so that the up
direction is in the direction of travel at that stop.
Examples of things we learnt were:
- Adobe SVG Viewer didn't like external style sheets when
printing out our web pages with embedded SVG maps. It treated them
like no styles existed. Therefore regrettably we had to go with
inline style sheets.
- Adobe SVG Viewer doesn't currently support tool tips natively.
Therefore we went with two alternative factors: firstly we rendered
"mouseover" details as status bar updates. Secondly we gave users
the option to show a more detailed rendering with more labels,
presumably more useful in printouts. We found that custom tool tip
SVG routines were too bandwidth-heavy for our taste.
- As SVG is new to most users, we had to explicitly spell out hints
on the same page as the map. We did this because
we wanted them to fully utilise the
zoom/pan features of the user agent.
- SVG rendering takes a relatively heavy toll on the user agent
machine. We aimed for high quality maps with features such as
anti-aliasing. Maybe we need to revisit that approach for greater
user accessibility. However it helps illustrate that an SVG map
server is more scalable than those traditionally using
server-rasterisation.
- The perl scripts generating SVG are sustainable even in a
shared hosting environment with per-request compilation. We expect
a dedicated environment with plenty of RAM and the use of mod_perl
to bring pleasing results.
- perl scripts can use the Compress::Zlib CPAN module to give
inline gzip compression. However at the time of writing we still
have an intermittent bug in the rendering stream. When the bug
doesn't occur, we are getting compressed document sizes at 25-30%
of the original. This allows almost all our maps to come in at
under 100K as transmitted.
About the Author
Brendan Morley is the Technical Director of Proceed Media Pty
Ltd, an Australian Company. The company exists as an intellectual
property placeholder for any technology developed for the QROTI web
site. Brendan developed this work in after-hours time, having seen
the potential of SVG fairly early on and spending perhaps the last
18 months on this project. He is also interested in public
transport (rail in particular) and perl programming. He sees that
one way to get people out of their cars is easy-to-understand
public transport information. QROTI is his
gift to the community of Queensland. However, commercial enquiries
are always welcome!
[ENDS]