Great open source map tools for Web developers
- 18 July, 2012 10:02
A long time ago, when Web 2.0 was just Web 1.0, we had to ask people for directions, copy them down, and hope we had a foldable map to help us find our way. Then along came MapQuest, followed by Google Maps in 2005. Today, it seems impossible to imagine finding our way without handheld phones and Web-based maps.
Google Maps and its cousins Yahoo Maps and MapQuest have grown into integral parts of the Web. It's now odd for a website to offer an address without a map showing the location and offering directions. The mapping APIs made it easy for people to insert snippets of maps into their websites; now the maps are everywhere.
The explosive growth and endless optimism came crashing to an end in October 2011, when Google started charging heavy users. Light users could still get the services for free, but everyone else was going to pay to support the big map in the sky. It wasn't as tragic as it might seem, but Google's decision was one of the first to signal the end of totally free era.
While some groused, others saw opportunity. Before the price change, everyone was happy to let the big companies do the hard work because no one wanted to compete with a free service from Google. Why pay for what you could get for free? The new prices were steep enough to open the door to competition, making it possible for new companies to get traction.
These new stacks use liberal amounts of open source software mixed with proprietary tools and services. You do what you want on your own and pay for what you can't do. Open source licenses give you the control. While some will still grouse about not getting everything for free, there's no doubt the new marketplace offers many more options and opportunities than before.
To understand the breadth and depth of this new ecosystem, I spent some time building maps and hacking code using these tools. The options are expanding quickly as companies are building their own databases for holding geographical data, their own rendering tools for building maps, and their own software for embedding the maps in websites. I built maps, added data, created overlays, and stuck virtual pushpins all over the place.
The new tools are great, but the up-and-comers will continue to face stiff competition from the big companies. MapQuest still has the prettiest maps, in my opinion. Microsoft's Bing Maps offer a neat bird's-eye view that gives a nicer perspective than vertical photos. Google has been pumping more money into better 3D imagery and better street-level views -- including those you can take offline. Google is also rapidly integrating Google Maps with its other databases. It's now possible, for instance, to search the maps with the name of a business. All of the above are competing, it turns out, with Apple, which is releasing its own mapping tools for iOS developers.
Of course, these commercial juggernauts have plenty of resources to draw your attention to their mapping tools. The list that follows highlights some of the smaller upstarts that seem ready to give the bigger companies some true competition. The tools are smooth, elegant, and flexible. They're going to give the big companies a real run.
OpenStreetMap The source of data for many of these programs is OpenStreetMap, a big collection of coordinates and names for streets around the world. If you want a map, you can grab this huge collection of coordinates and plot them. Voilà¡¼/p>
The real fun comes if you create an account on the website. Suddenly, an Edit button appears and you can fire up an editor to make changes as you would in a wiki built around text. The site keeps getting better and better as people add roads, streams, and trails to the data set.
The license is a bit tighter than many of the standard open source licenses. If you improve the data, you have to share your improvements with everyone. You can do what you want with any maps you create, but once you start sharing the maps built with improved data, you must share the data too. In the parlance of open source licenses, the stickiness quotient is high. If you start using the data, you'll be stuck contributing.
The OpenStreetMap servers also distribute the raw tiles built from this data, but the project discourages any use that puts a strain on its equipment. The website points to a long list of companies that turn the data into services that you can use.
You can edit your own neighborhood with the browser-based interface of OpenStreetMap, an open source collective building the data structures that describe the world.
OSGeoOSGeo is a collection of open source packages for creating maps and displaying them in browsers. Some of the projects are old and effectively obsolete, and some are newer versions that effectively replace the old ones.
Some of the tools are for building applications. For instance, MapFish is a collection of server-routines written to make it simpler for you to get your mapping data into a coherent form. It projects some background layers, then you insert your data on top.
The group has been building upon this core, which seems to have become stable in 2007. Among the newer projects is GeoMoose, a tool for mixing OpenLayers data with geographic data overlays. It's popular with real estate tax departments in state governments.
Most of the OSGeo projects are protected by generous BSD or MIT licenses.
TileMill If you're a Web programmer who loves maps, you'll find TileMill to be the greatest combination since electricity met semiconductors. The tool combines open source data with a language for controlling how the data is rendered. When you're done, TileMill will spit out all of the tiles that your mapping application presents to the user.
The core of the product is Carto, a language for describing how the fonts, lines, and colors are combined. It is, for most intents and purposes, a version of CSS. You design your maps with the same corner of your brain that you use to determine the look for your Web pages. If you want the major streets to be thicker, you bump up the number next to the CSS-like parameter "line-width."
TileMill turns open source data about the world into map tiles that allow you to customize (or experiment with) the look of your maps.
There are also a wide variety of open data sources to drive your fun. I started poking around and was soon putting labels on railroads all over the United States. The software pulled the numbers from a large collection of open data sets.
TileMill offers a surprisingly large range of options to the map designer, and the tool makes it quite easy to produce a map with just a few clicks. The trouble is that it's quite hard to produce something beautiful. It might be cheaper to hire someone with real talent.
More mapping sourcesIf you're building your site or application out of the Ext framework, you'll want to look at GeoExt. The code will fill a panel with data from OpenStreetMap, then let you add your own layers and pop-ups to make the maps more presentable. The best class name may be the Symbolizer, which lets you put arbitrary vector shapes in a layer floating above the map. The code is available with a BSD license.
Most of the mapping systems serve up tiles rendered at the right resolution. It's a sound approach that allows the rendering algorithm to move quickly, but it's not particularly efficient if users zoom in and out.
JQVMap is a collection of vector outlines of the major countries embedded into a jQuery plug-in. You install it in your Web page and point the code at a DIV, which is then filled with a zoomable map. The parameters let you choose the colors and add mouse-over overlays. It's a simple way to let someone select a country by clicking on a map.
Modest Maps is a solid, basic API for putting up a map in a DIV. It's like Google Maps, but open source. You point the API at your DIV and choose a source of map tiles; Modest Maps pretty much does the rest.
HTMAPL is a jQuery plug-in that pairs HTML with Modest Maps to streamline Web mapmaking.
A skilled artist can work wonders with the OpenStreetMap data. Some of my favorites come from Stamen, a general design studio that has been releasing the tiles under a Creative Commons license. The Terrain maps are nice, but the watercolor maps are eye opening. The colors run together as if they were painted by hand with a messy watercolor brush.
Most of the mapping tools are built with Web technology stacks because most people assume the maps will be consumed by mobile browsers. MapNik is written in C++ for desktop users, although it offers Python bindings that might be used in browser-based applications.
The code is essentially a big pipe for juggling geographic data and feeding it into the AGG rendering library, the "antigrain" tool that does a great job with antialiasing. The quality shows too -- MapNik maps have some of the most pleasing details I've seen. Google has been a big supporter of this project during recent Summers of Code, and I hope that continues. Desktop users need maps too.
The commerce behind the toolsAll of these open source tools don't come out of nowhere. TileMill, for instance, was created by MapBox, a company that makes its money by selling downloads of the map tiles. You can fiddle with the data and make all of the pretty pictures for free, but once people look at your map tiles more than 3,000 times in a month, it's time to pay.
The higher-priced plans offer more than just endless streams of map tiles. You get analytical charts that help you understand who is looking at which corner of the globe. MapBox has a cloud-based infrastructure that can optimize your maps to make sure they work as smoothly as possible in the mobile browsers.
MapBox contributes a fair amount of open source code, including not only TileMill but also Wax, a tool that makes it a bit easier to use libraries like Modest Maps to embed MapBox tiles in your site. My favorite part of Wax is TileJSON, a basic format for wrapping up the data about the tiles.
This example at stamen.com shows the use of Stamen's Watercolor, Toner, and Terrain tiles within the same map.
OpenGeo is another company built around a collection of open source projects. You can work with the community edition of its suite or invest in its enterprise version. The four different price points correspond to more and more stability and support on Java servers. The group is happy to add features or develop other software as consultants too.
If you're just playing with maps, CloudMade is a good place to begin. CloudMade gives away some maps it created from OpenStreetMap data. Like the data, these are protected by the Creative Commons-Share Alike license. If you want to make use of these tiles, CloudMade offers Leaflet, a full-featured library for putting maps in Web pages. It's small and optimized for adding extra layers and pins. Here's an example I made with Leaflet.
What if you want to go deeper? If you're interested in connecting location with games, for instance, you'll want to visit the business end of CloudMade where they're pioneering this integration. One library, for instance, helps you figure out the weather and time of the person playing your game. The game can adjust itself using this data so that the action on the screen can take place in the dark if it's night or light if it's day. Or maybe you just want to serve up the opposite of the grim reality surrounding the player. If it's a cold and gray January day, you could offer tropical weather in your game.
Another clever idea is sponsored locations, in which advertisers might pay you to include a connection with their local business. If someone is near the coffee shop, the game could tell the user about a discount coupon and even offer to unlock certain levels for free if they redeem it. In one blog post, the company notes that our brains love dopamine and that it's tightly linked with seeking out and searching. In other words, games plus marketing yield dopamine for the user and money for the company.
This collection of mapping tools and the companies behind them show the power of open source to unlock competition while encouraging cooperation. Everyone has an incentive to contribute data to the central pool kept by OpenStreetMap, yet everyone is also striving to outdo the next company with better code and prettier renderings.
There's no doubt that Google is feeling some pressure from this ersatz collective. The company announced it was lowering its prices dramatically, knocking down fees almost 90 percent from $4 per 1,000 views to 50 cents per 1,000 views. This price will be billed only to sites that regularly exceed 25,000 views per day.
While this is a dramatic change, I'm not certain it would be enough to turn me away from these open source alternatives. While there's no doubt that the major Web companies provide great tools, there's something wonderful about controlling your own destiny. The ability to customize my own map tiles is so dangerously seductive that I'm sure I'll lose too many hours fiddling with the colors and the fonts so the maps look just so. Sure it's work, but the power and control are hard to beat.
Read more about application development in InfoWorld's Application Development Channel.
Join the Computerworld Australia group on Linkedin. The group is open to IT Directors, IT Managers, Infrastructure Managers, Network Managers, Security Managers, Communications Managers.
H-1B loophole may help California utility offshore IT jobs
TPG should pay rural levy for each FTTB service: NBN Co
TPG should pay rural levy for each FTTB service: NBN Co
NBN Co hits 105Mbps in limited FTTN trial
NBN Co seeks ‘early resolution’ of TPG fibre threat