Lines as Long as You Like

Today, inspired by a recent donation*, I finally got around to speeding up the display of long route lines (i.e., the line marking a route on the trip planner map). Previously, long route lines would take a long time to show up, and when a line was too long, it just wouldn’t show up at all, possibly crashing the user’s browser. Obviously not good.berryjam.ru

What happened was, I got notification of a donation and saw that the person making the donation lives in Beaverton. I tried getting a route from Beaverton to downtown Portland, but the route never came up because the line was too long. I felt bad that someone had made a donation but might not even be able to get directions over a relatively short distance, so I got to work on fixing the problem.rtisnab.ru

So, skipping over the technical aspects, I’ll just say that now it should be possible to get a route of just about any length. It still takes a while to generate a really long route, but once the route info gets back to the user’s browser, the line drawing is almost instantaneous. Even for short routes there’s a noticeable speedup.

This has been bugging me for a long time, so I’m glad it’s finally fixed. As usual, if you notice any problems, please let us know.

* Big thanks to Rebecca in Beaverton.

Scroll Wheel Zooming Added

A few days ago Google added scroll wheel zooming to their public maps API. Today, I enabled that feature in the trip planner. It was really simple, only requiring the addition of one line of JavaScript code.

This feature has been available on the official Google Maps site for a while, but it wasn’t available to third party developers until three days ago [1].

Another feature Google released recently is the ability to encode long lines for more efficient rendering. For long routes, this means the annoying “this script is taking a long time, do you want to continue popup” shouldn’t come up again.

We haven’t incorporated this into the trip planner yet but will some time in the next week or so (it’s a bit more complicated than adding scroll wheel zooming). I wrote some code that does the line encoding; now I just need to set up the back end to encode lines before sending them to the Web.

[1] Google Maps blog post about scroll wheel zooming