Thursday, June 12, 2014

CartoType: Maply Mobile Renderer

Here's the short version, I've made a deal with Graham Asher at CartoType.  We're going to use the Maply renderer to speed up CartoType's map rendering.


Let's start with the basics.  What is CartoType?

CartoType


CartoType is a map rendering and routing package for iOS, Android, Windows, and other platforms.  It's largely implemented in C++ and it's used in a bunch of mobile apps.

What I really like about it is precision.  Label layout, in particular, is gorgeous.  Even the buildings and roads have a very pleasant, thoughtful, look to them.  It's also focused on offline maps, which is an underserved area, I think.

On to the details.  What are we doing?

Maply Mobile Renderer


We're interfacing CartoType to Maply using the CartoType API.  And the Maply API, obviously.

Here's how we're going to approach the development.  The first two phases will make tiled image maps work better and the third will focus on vector maps.

Phase 1: Image Tiles


This work duplicates what some of our clients have already done.  We're going to use the CartoType renderer for map tiles and hand them over to Maply.  It will look a bit like this.

CartoType Denmark

That's a snapshot from the test app, so obviously we're part way there.  What remains is to interface the two packages a little more tightly.  We can render things in the right size, deal with seams, make the label replication a little smarter and improve the caching system.

Phase 2: Image Tiles + Labels


Labels are one of the biggest problems with image based maps. When you rotate, the labels don't.  When you zoom in the labels get blurry.  We can fix that.

CartoType Denmark

In this phase we rip the labels off of the underlying map tiles and render them separately.  Maply has a rudimentary label layout module which we'll make use of.  It won't be as sophisticated as CartoType's current support, but it's adequate.

This phase will produce something people can really use, I think.

Phase 3: Vector Maps


Obviously the real goal is fully vector based rendering.  We'll support everything that Maply does that CartoType does as well.  That means labels, roads, polygons, dashed lines, and so on.

Maply Brazil


Translating these concepts into Maply will be easy in some cases, like roads, and hard in others, like label layout.  Most of the vector support exists in Maply and we'll be making use of custom shaders and textures and the new road widening capabilities.

For labels, we'll use a combination of the CartoType font rendering system and Maply's dynamic texture management.  It should be nice and fast.

Motivation & The Future


I'd run into CartoType in a number of user and client accounts.  Sometimes they had to decide if they wanted speed with Maply or precision with CartoType.  I found myself asking "Why not both?"  So here we are.

Something that interests me is label layout in a dynamic map.  It can never be as good as for a static map, but it can be much better than we do now.  I'm excited to try out some ideas and see how far we can take it.

I'm committed to keeping WhirlyGlobe-Maply open source, but I intend to build on the platform for commercial offerings.  This is a standard approach to commercial open source and I've planned to do it all along.  The Maply Mobile Renderer should be the first offering, but it won't be the last.

No comments:

Post a Comment