Map

Broadband Map: more points, faster loading

We’ve upgraded our broadband map! It tracks ten times as many lit buildings and is faster! How was this magic accomplished?

First, let’s back up and take a tour of the map as it was. In a word: KML.

KML (Keyhole Markup Language) is XML with geolocation data elements added. If you’ve ever viewed points in Google Earth, you’ve probably seen KML at work. Google Maps natively supports loading KML and it turned out to be a pretty good option for mapping static points. Because Google is adding the markers to the map directly, a KML layer can have thousands of markers instead of hundreds.

To create the broadband map I wrote ruby scripts (rake tasks) that parsed our points data into five KML layers: central offices, lit buildings, EoC coverage, and two for DSL coverage. To handle DSL and EoC coverage — transparent circles centered on a central office — I generated KML files that specified circular polygons and styling. I parsed the central office data, checked to see if it was DSL or EoC, and then calculated 30 points in a circle around the central office to form the “circular” outline. KML allowed us to specify markers for the points and the coloring/alpha transparency for the polygons.

A typical central office point:

[sourcecode language=”xml”]

<Placemark>
<name>Central Office</name>
<description>1049 N 3RD ST</description>
<styleUrl>#co</styleUrl>
<Point>
<coordinates>-99.73335,32.45157</coordinates>
</Point>
</Placemark>

[/sourcecode]

A typical DSL coverage area:

[sourcecode language=”xml”]

<Placemark>
<styleUrl>#dsl</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-83.98093654387421,34.36732
-83.98223988881587,34.377583641421
-83.98610089352155,34.38739925343817
-83.99235158080776,34.39633761734606
-84.0007192406632,34.40400774531366
-84.01083826638533,34.41007402694737
-84.02226611564771,34.414270964430926
-84.0345027021283,34.416414840563384
-84.047012361531,34.41641179853356
-84.05924741293154,34.41426197152358
-84.07067225958019,34.41005947684825
-84.08078694721617,34.40398827489286
-84.08914912417283,34.39631407865723
-84.09539342448822,34.38737267628853
-84.09924741825832,34.377555188181574
-84.10054343536446,34.36729091466242
-84.0992257603099,34.35702853400504
-84.09535290688325,34.34721647931155
-84.08909490101796,34.338283354195156
-84.08072571817662,34.33061924065349
-84.07061122840484,34.324558709131544
-84.05919318972609,34.3203662631982
-84.04696999212386,34.31822484342311
-84.0344749848322,34.31822788188992
-84.02225331528727,34.32037524603256
-84.01083826639099,34.32457324438945
-84.00072809828428,34.33063869403101
-83.9923643811702,34.33830687658559
-83.98611274732286,34.347243043725804
-83.98224689468306,34.35705698027416
-83.98093654387421,34.36732
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>

[/sourcecode]

KML worked out great, except for two things. First, it was slow. Turning on the DSL layer could take up to ten seconds to complete — an eternity in modern browsing! Second, our lit buildings’ data quickly ran up against Google’s size and complexity limits for KML data. We had to split our DSL coverage into two layers because of the size limits. To fully bring up all 300,000 lit buildings would’ve required over ten KML layers to be loaded in sequence. At that point we’d be talking over a minute to load the points.

Last week I was determined to get a solution. At first I thought that network linked KML files would be the key. After all, the Google Maps documentation said it was the way to go if you needed to render a large number of points. The idea here is to have a bunch of KML files split out by region and Google Maps will only load the files that are needed. Parsing our existing KML files into regions was a bit tricky and I never came up with a good solution. The files I generated would work just fine in Google Earth, but I never got them to load correctly in Google Maps. I suspect that I was running into the Google Maps limit of no more than ten network links per KML file.

My research led me back to Google Fusion Tables. Fusion Tables have always been labeled “experimental” in the maps documentation, but faced with slow load times, too many points, and recalcitrant XML I figured it was worth a shot. In a word: Wow! If you’ve seen the broadband map lately, then you can see the kind of speed this change has brought. Points now load so quickly that they seem as if they are native map features. We are completely pleased with their result.

Google Fusion Tables are essentially spreadsheets on the web, but spreadsheets that have a direct connection to Google Maps and that can natively import KML files — even KML files that define polygons. For our purposes they’re essentially fast hosting for our KML and that’s perfect! But it gets even better. With Fusion Tables we’re able to change the marker styling with the click of a mouse in the browser, change info window text directly, load different columns of data, completely control the coloring of the layer polygons, and get access to a bunch of really nifty map features that are simply unavailable to standard points. Most of that was possible before, but required recompiling the KML and uploading the file.

Article written by

Leave a Reply

“The real test is not what bells and whistles a company has, but when fires start how they are subdued. Broadband has routinely provided more than prompt responses – they have delivered proactive resolutions.”

Jeremy Finch
Just Windows and Doors