Thursday, February 26, 2015

Tangram: An Open Source Map Rendering Library

I have a Raspberry Pi project that I'd love to use street maps for, but it would be a daunting challenge for me to figure out how to read map data and write the code to draw the maps on screen. It's why I was delighted to discover Tangram ES, which is a library for rendering 2D and 3D maps using OpenGL ES 2 with data from OpenStreetMap. The library works on a number of devices, including of course Raspberry Pi.

Patricio Gonzalez Vivo (from the video above) and the team at Mapzen are responsible for the open source project, which is an offshoot of their WebGL map rendering library, Tangram. While Tangram ES is still a work-in-progress, they've been using Raspberry Pi 2 to speed up their development of the library and they're ready for more people to take it for a spin.

Structured a lot like a research and development lab, Mapzen is a startup founded with the idea that mapping done collaboratively, transparently, and in the open can produce more resilient software, and ultimately, better maps. Their focus is on open source tools and using open data to create the building blocks for future mapping applications, including search & geocoding, routing, and transit, in addition to the rendering work they’re doing with Tangram.

Patricio is a graphics engineer on Tangram, responsible for implementing different graphical features such as tessellation, lights, materials, environmental maps, and other CG effects. The team also includes Brett Camper, who is Mapzen’s co-founder, as well as Peter Richardson, Ivan Willing, and Karim Naaji. The ES version of Tangram was started by Matt Blair and Varun Talwar.

“Last December Karim and I thought it could be interesting to get Tangram ES running on a Raspberry Pi,” said Patricio. “At the beginning we thought it would be difficult and probably slow, but at the end we were surprised by the speed of the app and how easy the implementation was. Cross-platform C++ development is possible!”

“In a way, the Pi is an ideal test platform for developing graphics software that targets low-power systems,” said Matt. “The OpenGL ES 2 implementation on the Pi is the strictest that we've encountered, so it has become our gold standard for ensuring correct usage of OpenGL. The only major missing piece on the Pi was a compiler that supports C++11, which Tangram uses extensively. However since the Pi is a complete Linux distribution, installing the packages we needed with apt was a breeze.”

Don’t have to take Matt’s word for it; you can install and test drive Tangram ES on the Raspberry Pi right now:

Installing Tangram ES

Using Raspbian, here's how to install the Tangram ES library from the command line and execute the included sample code:

sudo apt-get update
sudo apt-get install cmake g++-4.7 libcurl4-openssl-dev
cd ~
git clone https://github.com/tangrams/tangram-es.git
cd tangram-es
git submodule init && git submodule update
make rpi
cd build/rpi/bin
./tangram

No comments:

Post a Comment