Tuesday, March 4th, 2008...12:27 am

Behind the Scenes of the Crime Map

By: Robert Baskin (Online Director)

Jump to Comments

On February 19th, we decided to create the Crime Map. We launched it March 3rd, just 13 days later. This is our story.

We decided to retrieve the crimes data from the Yale Police Department daily crime logs. The next task was how to present the data. We knew we wanted a map, and for a while we toyed with the idea of creating our own Flash map. Google Maps was always an option, but we can’t customize the look and feel as much, and it doesn’t show the names of campus buildings. Eventually, we decided that an established mapping solution with an easy API was worth using, so we chose Google Maps. The only major problem we had with it was that their GMarkerManager doesn’t have a removeAll() or clear() function (which we needed when we cleared the map to show new crimes), so we turned to the basically second-party MarkerManager script. It’s a bit slow with a
lot of markers, so we limit the results to 100 crimes so the browser doesn’t hang for 5-10 seconds.

Then we turned to the table of crimes, which we had to regenerate on every Ajax request. We went with Scriptaculous’ Builder functionality. As we can say about many things, it worked great. in everything except Internet Explorer. First of all, IE demands that all nodes are appended to a <tbody> instead of directly to the table. And it requires that you build the entire <tbody> before appending it to the <table>. But we finally got it working. And after some basic testing, we actually found that it was faster than creating the table by setting innerHTML, but we may revisit that. (We tested this with Firebug’s JavaScript profilers in Firefox 3 Beta 3, so the results are definitely not comprehensive.)

We ran into some fun issues with the tab box structure for the form on the left - look for an upcoming blog post here that will talk a bit more about the tab boxes.

Overall, we’re very excited about what we came up with. We think the data is relevant and well-presented, and it’s very cool to take a feature from conception to launch in less than two weeks. We hope that you find it useful.

Robert Baskin
Online Director
Yale Daily News

Leave a Reply

You must be logged in to post a comment.