Thursday, December 13, 2012

WhirlyGlobe Component 2.1 (Alpha)

I've put together an Alpha distribution for the new WhirlyGlobe Component.  The naming scheme is changing to match the API.  Because.

The next version of WhirlyGlobe is 2.1, so this is the WhirlyGlobe-Maply Component 2.1 (alpha).  I'm sure it'll live up to that designation.

It sure doesn't *look* unstable.

New Features

There is a ton of new stuff in WhirlyGlobe 2.1 and the Component.  Here's a short, non-exhaustive list.

  • Continuous zoom mode in the view.  Let's us get much closer to the surface of the globe and much farther away.
  • Better animate to position support, including offsets.
  • More rendering hints, including a new Zbuffer variant just for globes.
  • OpenGL ES 2.0, but it's off.  Leave it off (for now).
  • More locational feedback from the view controller, mostly utility methods.
  • Vector databases (shape files) with simple queries.
  • 3D shapes, including spheres, circles, cylinders, lines, and ballistic curves.
  • Stickers, which are like markers, but bigger.  And curved.
  • Invisible vectors used just for selection.
  • More layer control.
  • Private headers for WhirlyGlobeViewController if you want to subclass.  Not for the faint of heart.
  • Explicit stop/start animation calls.  Don't know why they weren't there before.
  • A userObject on the selectable objects.  Nobody wanted to subclass, so here you go.
  • Retina support is finally complete and properly debugged.
  • Automatic 2D label layout.  That's right.  You heard me.
In addition to all the new features, things just work better.  Quad paging layers are much better optimized.  Try it with OpenStreetMap... it's kind of astounding.

To get it, use the develop branch on github.  If you'd rather have a binary distribution, drop me a line and I'll send you the link.

No doubt I've broken something critical and left something out.  The sooner I find it, the sooner I can call this "beta".

Monday, December 10, 2012

WhirlyGlobe/CartoDB demo and AppNation IV

José Navarro put together this neat little demo a few months ago.  It uses WhirlyGlobe and CartoDB, which is something I'd like to see more of.  Seems like a natural combination.


He talks about it a little on his blog.  Looks like he was using the raw API since it was pre-Component... which is impressive.  Now some of that would be a bit easier.

Anyway, neat little example and it's fun to see people using WhirlyGlobe.  Especially people who don't make me sign an NDA and swear never to reveal our work together.  [cough]

APPNATION IV


I'm going to be at APPNATION this week.  Yes, apparently it is all caps.  It's the PREMIER app conference that's within walking distance of my house and happened to give me free exhibit space to hock my wares.  So hocking I shall be.

My clients are usually the big firms that make apps for even bigger firms.  This seems like the sort of thing they might send their project managers to.  So I'm stalking users, basically.

Wednesday, November 28, 2012

WhirlyGlobe Component - Version 1.10

A few weeks ago I published Version 1.01 for the Component.  Shortly afterwards, I pulled it.  The retina support was a mess.

The New Version


So here is Version 1.10.  It's actually been out for a while and users have been downloading it.  So far, no complaints.

That clears up the retina support, fixes a bug with MBTiles, and adds the pole coverage for Spherical Mercator projections.

Use Version 1.10 for the foreseeable future.  The next one will be based on WhirlyGlobe 2.1, which has a ton of changes.

More Stuff


I'm doing quite a lot of development on WhirlyGlobe at the moment.  Some of the goodies include:

  • OpenGL ES 2.0 support (shaders!)
  • A 3D shape layer - Spheres, cylinders, parabolic curves
  • Stickers and chunks - Useful for slapping an image over a geographic area
  • Lots and lots of bug fixes and performance improvements

In other news, my clients like the Components.  That means lots of development on those and most new features represented immediately.  The quad paging layers have been thoroughly tested in the develop branch and are scary good with a high performance data source.

All of this stuff goes into client projects first.  I can rarely show those, and never when they're under development.  So you'll just have to take my word that Bing imagery looks fantastic on the globe with a Retina display.  Until I work up an example anyway.

Thursday, November 1, 2012

WhirlyGlobe Component: Vectors

I'm running a bit behind on new describing new functionality.    A few weeks ago I added vector support to the WhirlyGlobe Component.

The toolkit itself has had vector support since 1.0.  That's kinda my thing.  Images are everyone else's thing, though so that's what went in to the Component first.

Some Vectors, no doubt.
So great, how do they work?

WGVectorObject

The WGVectorObject is a wrapper around the more complex classes in the WhirlyGlobe API.  If you want better control, go use those.  If you want to do a few simple operations, WGVectorObject will do.

A WGVectorObject can represent one or more features.  It's a little goofy, but makes sense once you start slinging them around.  Just treat them as somewhat opaque.

First thing you'll want to do is load them.  There are a variety of ways.

Vectors From GeoJSON

As the heading implies, you can load GeoJSON.  Here's a quick example that looks for a named file in the bundle, loads that into a WGVectorObject and then adds it to the globe.

                    
NSString *fileName = [[NSBundle mainBundle] pathForResource:name ofType:@"geojson"];
if (fileName)
{
  NSData *jsonData = [NSData dataWithContentsOfFile:fileName];
  if (jsonData)
  {
    WGVectorObject *wgVecObj = [WGVectorObject VectorObjectFromGeoJSON:jsonData];
    WGComponentObject *compObj = [globeViewC addVectors:[NSArray arrayWithObject:wgVecObj]];
  }
}

If you're generating the files yourself or reading from a remote service, it's nice, but it's slow.  Who would think parsing geometry out of a text file would be slow?  I'm shocked.

Vectors From Scratch

You can also create vector data from scratch.  You can make points, linears, and areals.  The following methods are part of WGVectorObject.
                    
/// Construct with a single point
- (id)initWithPoint:(WGCoordinate *)coord attributes:(NSDictionary *)attr;

/// Construct with a linear feature (e.g. line string)
- (id)initWithLineString:(WGCoordinate *)coords numCoords:(int)numCoords attributes:(NSDictionary *)attr;

/// Construct as an areal with an exterior
- (id)initWithAreal:(WGCoordinate *)coords numCoords:(int)numCoords attributes:(NSDictionary *)attr;

/// Add a hole to an existing areal feature
- (void)addHole:(WGCoordinate *)coords numCoords:(int)numCoords;

Just gather your WGCoordinate structures into an array and pass them in for linear or areal.  For points, just pass in the one and if you need to create holes (in an areal), call that method after you've created the areal.

Vectors From Shapefiles

Lastly, you can read vector data out of Shapefiles.  I wrap these things in a database-like object so I can do (somewhat) fast lookups.  The object you want is called a MaplyVectorDatabase, but it's only in the source tree at the moment.  I haven't updated the pre-compiled Component.

I'm exposing functionality as I need it, so the MaplyVectorDatabase object just does the following for now.
                    
/// Construct from a shapefile in the bundle
+ (MaplyVectorDatabase *) vectorDatabaseWithShape:(NSString *)shapeName;

/// Return vectors that match the given SQL query
- (MaplyVectorObject *)fetchMatchingVectors:(NSString *)sqlQuery;

/// Search for all the areals that surround the given point (in geographic)
- (MaplyVectorObject *)fetchArealsForPoint:(MaplyCoordinate)coord;

Maply?  Yes, Maply.  All new functionality is Maply, with WhirlyGlobe reserved for things that are globe specific.  Surprisingly, that's very little.

Anyway, the basic idea with a MaplyVectorDatabase is that you create it with that shapefile name and then run simple queries against it.  I've exposed the fetch matching vectors and fetch areals for point (e.g. point in poly search).  That's enough to reimplement the WhirlyGlobeApp, but I'm sure I'll expose more in the future.

As with the WhirlyGlobe API, the Component is going to build cache files next to your shapefiles.  There will be one name.mbr and one name.sqlite file.  If they don't exist, the toolkit will build them and that'll be sloooow.  So grab them out of the simulator and stick them in your bundle.

Displaying Vectors

Once you've got some vectors, you can display them.  As always, bigger batches are better, smaller are slower.  The call to add vectors to a WhirlyGlobeViewController is just like so.

WGComponentObject *compObj = [globeViewC addVectors:[NSArray arrayWithObject:wgVecObj]];

Vectors are then eligible for selection and they'll turn up in your globe view controller delegate like everything else.  They show up after labels and markers in priority, as their search is run last.

Upcoming Stuff

There's a lot more in the pipeline for WhirlyGlobe, Maply, and the Components.  Most of my time is devoted to WhirlyGlobe/Maply projects for clients and they're all spinning stuff back in to the toolkits.  Some of it is structural, such as OpenGL ES 2.0 support and some is pure features, such as a Shape layer.

Coming up next is WhirlyGlobe 2.1, which will be a minor release of what's in the master branch.  Primarily tweaks for retina, caps for the Spherical Mercator layers, and random bug fixes.

Wednesday, October 17, 2012

WhirlyGlobe Component - Version 1.01

I've pushed a minor update to the Component and uploaded a corresponding binary distribution.

The update contains a few fairly minor fixes.  First, the big one.

There's, like, snow up there and stuff.
For Spherical Mercator based tile sets, you can turn on pole coverage and have it make up some polygons for the poles.  It picks the texture coordinate right in the middle, so whatever color you have there is the color you get.

The results depend a lot on what the images are doing.  It works well for some, not as well for others. But at least it's covered.

A user noticed that my extents for the web mercator projection were wrong.  That's now fixed and vector data will now correctly overlay.  I was wondering about that, but I hadn't gotten around to looking at it.  Let's hear it for users.

The component is now compiled for armv7s as well.  And, yay, the distribution got much bigger.

That's all in the master branch.  There's a lot of interesting stuff going on in the develop branch, which I'll post about soon.

Thursday, October 11, 2012

State Of The Map USA - Portland

I'm presenting at SOTM in Portland this weekend.  It's a 25min talk on WhirlyGlobe and how I use OpenStreetMap data.

As promised, here are the slides.  Missing the videos, obviously, those are huge.

Data

The apps I show used a variety of free data sets.  Here they are.


Apps


As I mention in the talk, I can't show much of my work; my users can be secretive.  Of those users who are not, here is a sampling of interesting apps and a few of my test apps.

Thursday, September 20, 2012

Maply - First Look



I've been busily working on an a sister toolkit to WhirlyGlobe called Maply.  It's a flat map based on the same technology.

It's working well enough to show.  So with minimal fanfare, here it is.




That video is recorded live off an iPad using AirPlay.  It results in a very clear picture, but it's not doing justice to the interactivity and you can't see where I tap.  Still, it gets the point across.


Features

The video covers the details pretty well, but here's a quick list of features Maply supports.

  • Image tile sets - Maply can page image data from a local repository (e.g. MapBox Tiles) or from a remote one (e.g. OpenStreetMap).
  • Vectors - A developer can overlay their own data set, such as the country one shown above.
  • Markers - Marker images can be overlaid in both screen space and 3D.
  • Labels - Same for label text.
  • Selection - All vectors, markers, and labels are selectable.  Developers can make of that what they will.
  • UIView overlay - Maply can associate a UIView with a geolocation and track it around accordingly.  This is nice for selection boxes or something custom enough to require a UIView.


Technical Details

I imply that Maply is separate toolkit from WhirlyGlobe.  In fact, it's not.  There are a few unique objects for each, but the vast majority of code is shared.  Far more than I was expecting, actually.

It's all checked in to github in the develop branch, so if you're extremely daring... though I wouldn't recommend it.  I'll do a beta release for the Maply Component in the next few weeks.  Wait for that.


Future Stuff

Maply is likely to be the far more popular option so I'll surreptitiously rebrand a lot of the low level Whirly objects as Maply.  WhirlyGlobe will remain, though most of it can now handle both WhirlyGlobe and Maply display systems.

With the early releases of WhirlyGlobe I focused on the toolkit and only later came out with the WhirlyGlobe Component.  This time I'm reversing that.  The focus is on the Maply Component with the low level API being secondary.

What's next is tuning.  The gesture recognizers could use some work, I haven't even hooked up the most interesting feature (It's 3D, you don't need to look straight down), and there are always a thousand little issues that turn up when you use it in a real app.

I'd like a real client project to drive that and "real" means money.  If you have one, let me know.  Maply is ready to to be the custom map engine for your app.

Monday, September 17, 2012

How low can WhirlyGlobe go?

Since I've started demoing the OpenStreetMap support I've gotten this question a lot:  Just how far down can WhirlyGlobe go?

You know, for driving directions between London and San Diego.
It can go down pretty far.  Yup.

The gesture recognizers get goofy down this far, honestly.  The whole "spinning" thing is kind of stupid and the momentum calculations are kind of bogus.

If this kind of thing becomes common, let me know and I'll make the gestures a little more intelligent. Or you could always, ya know, pay me.

Wednesday, September 12, 2012

WhirlyGlobe - The App

The WhirlyGlobe App update has been approved on the app store.  Now the money'll start rolling in.

Oh wait, it's free.  Damn.

Anyway, it's up there.  It's just the WhirlyGlobeApp example in the source tree.  You can compile it for yourself if you like and now you can download it.  Again.  How exciting.

Monday, September 10, 2012

Knight Foundation Proposal

I recently put together a proposal for the Knight News Challenge on mobile.  I'll detail it here for any interested parties.  It's a good sketch of where I'm thinking of taking WhirlyGlobe and its sister toolkit.

I've got a link in the proposal pointing here, so I may fill it in with a few more pictures and details.  Check back.

Some Background

I'm a full time iOS consultant.  I build iPhone and iPad apps for other people.  I write code, sometimes I manage, and I plan.  Consulting is nice, but I like a little focus in my work, so I developed WhirlyGlobe on my own dime.  That's an interactive 3D toolkit for iPad and iPhone that lets you add a globe to your app.  You can overlay all sorts of interesting data, interact with it and so on.

After the first few releases I realized it was too complicated, so I made it much, much simpler.  Check out the video for the WhirlyGlobe Component, which is the easy to use version.

Introducing Maply

The next step is a 2D(ish) map based on the WhirlyGlobe technology.  I'm developing it now and a preliminary version should be out within a month.  I expect it to be more popular than WhirlyGlobe as it has a broader appeal.

Like WhirlyGlobe, Maply is based on OpenGL ES which lets me do some interesting things.  Also like WhirlyGlobe it will be focused on performance and fidelity.  In other words it'll be fast and pretty, same as its sibling toolkit.

The Problem

I have a lot of WhirlyGlobe users now, most of them are fairly inexperienced with Geographic Information Systems (GIS) or Cartographic data processing.  They can handle the imagery, particularly if they point WhirlyGlobe at an existing data source, but they're lost on vector data.

There are many free and open sources of vector data.  The US government is a wonderful source of data, as are OpenStreetMap and Natural Earth for more focused data sets.  Processing it all is confusing, though, and my users have a difficult time.  Most just grab a simple static data set for vectors if they do anything at all.

Getting ahold of good data is just the first step, alas.  It needs to be processed into smaller units which can be paged at appropriate levels for the user to see.  Consistent size is important for both display and fetching over the network.  A user needs to process their data set, if it's large, into a form appropriate for the use.

Now there are some great proprietary tool chains for doing just this.  However, they're big complicated tools and I'd like to see more in the free domain.

The Goal

I want to make that process easier.  On the image tile side I'm reasonably happy with what's there.  On the vector side, it's much harder in the open source realm.

The goal is to first, add consistent support to WhirlyGlobe and Maply for fetching large vector data sets from a remote server.  Now I've done similar things in the past, but they're all very specific to a particular client.  This would be open and applicable to a wider range of data sets.  This is where most of the software development would occur and I understand the problems well enough.

Then the goal is to build out an open tool chain for processing large vector data sets into a compatible form.  Much of this would be identifying the tools, trying things out and then documenting how we did it.  This problem has been solved innumerable times in a proprietary way.  The goal here is to make it simple and make it open.


To that end, I'd like to use open source tools like QGIS for editing, pull from OpenStreetMap where appropriate and publish out to services like CartoDB.  None of that is particularly hard from an engineering perspective, but it's tricky for users.  Documenting that process is going to be key.

Lastly, I'd want to process a few example data sets and make them available for reuse.  OpenStreetMap data is an obvious target for this and I've contemplated a couple of small projects there.  One might be creating a clean base map without labels.  A second would be processing the building outlines into a vector data set in this new form.



Thursday, September 6, 2012

WhirlyGlobe 2.0: New Features

The WhirlyGlobe API is now officially on version 2.0.  Looking back, I'm impressed with what got done since 1.2.  Yay me.

The WhirlyGlobe Component is what I'm pushing for new users.  It's much easier to use and I'm liking the early feedback.  There's still a complex toolkit underneath it and that's what this is.

You can get WhirlyGlobe 2.0 from github.


Of iPad Melting & Sales Offices

I have two main sets of users:  The folks who want to toss a few markers on a spinny globe (sales offices) and the hard core map display folks (iPad melting).  The Component is for the first group, but WhirlyGlobe 2.0 is for the second.

A lot of 2.0 features were developed for specific clients.  They're just kind enough to let me release it all for free!  Ha, as if.  I have a big complicated contract and a lawyer with a specialty in intellectual property.

Anyway, what clients want can be summed up like so:  MORE!  BIGGER!  So that's what 2.0 is about.  I'll break the updates down by popularity.

Some Interesting Random Features

You're going to get bored the further down you read.  I'm already getting bored.  So let's start with some useful features.

On Demand Rendering

WhirlyGlobe is now keeping track of whether anything moved or faded or changed.  If it didn't, then the toolkit stops rendering.  It'll start again when something moves or changes.  Really, it should have already been doing that, so let's never speak of this again.

One of these iPads is busy melting a hole in your lap.  Can you tell which?

Oh and it doesn't work with particle systems, because... well that's kind of obvious.  Just turn it off if you're using particle systems.


Vector Layer Enhancements

Vector lines can now support width and be filled.  Under the right circumstances this looks really cool.  All my cool examples are proprietary.  So... yeah.  It works, trust me.

We can now read GeoJSON for vector features.  It's slow (woo, text) but easy to understand and a bit more web-y than Shapefiles.


UIView Overlays

You can now tie a UIView to a geographic location and have WhirlyGlobe move it around for you.  It'll even disappear when it's behind the globe.

That screen label is a UIView.  Trust me.

This has to be the #1 feature that people were pissed off wasn't already there.  Use it sparingly.  If you use this for more than a handful of UIViews it will be slow.  If you then complain that it's slow I'll set up a video chat so I can stare at you disapprovingly.


Quad Display Layer and Its Ilk

I've discussed these before and there's not much more to say.  They're awesome and incredibly useful for paging image data.

Oh, OpenStreetMap you so... free.

You can also page vector data with them, but you have to set up the data sources yourself.  I realize that can be difficult and that's why I charge by the hour.

Here's a short list of things you can do with the quad display layer:

  • Page from a MapBox Tiles database
  • Read from a network data source in the standard(ish) Google Tile Format
  • Set up data with ImageChopper and page it locally with a SphericalEarthQuadLayer
    • ImageChopper has been updated to produce an image pyramid
  • Page from your own data source with a TileQuadLoader
  • Read data on demand from a properly organized vector data source.
Much of the good stuff has been hooked up to the WhirlyGlobe Component and you can use it there.


Screen Space Objects

You can call them 2D markers, screen space objects or billboards.  Whatever you want to call them, they're now in WhirlyGlobe.



Screen space objects are pretty simple.  Give WhirlyGlobe a location to track and it'll move the label or marker around appropriately.  They'll also disappear if they fall behind the globe.

Both labels and markers support them.  Just set the @screen attribute to YES.  They'll show up correctly in the selection layer too.


Performance Enhancements

WhirlyGlobe sits on top of a real rendering engine.  A small, simple one but a rendering engine nonetheless.  These changes all center on the rendering engine itself.  The first one is, hey, you can now measure performance in the renderer.

Culling is important, but not ideal.  Basically, you have objects in memory that you're not rendering.  That sucks, but it does happen.  The rendering engine now has a culling tree it will sort Drawables in to and then consult before rendering.

OpenGL buffer management is always great fun, if you find annoying and weird things fun.  Luckily, I do.  So now I'm managing buffer and texture IDs so we can reuse them rather than allocate them, which is slow.  So slow.

Usually you want to do Z buffering.  Sometimes you want to kick it old school with priority based rendering.  Actually, in general you don't want to do that, but I do occasionally.  So now that's an option in the renderer.

Things I Changed Just To Mess With You

Some things I changed because I was in a mood to.  The big one was the great renaming and sorting.  Files moved around, I got strict about naming and the WhirlyKit/WhirlyGlobe distinction appeared.  WhirlyMap is also in there, but that's going to change name again.  Just because.

The layer thread teardown has changed a bit.  You can now ask the layer thread to release or delete things for you.  This was actually to fix a few ordering problems, but it's still kind of weird.

Layers changed a bit in general.  There's now a shutdown call and you're expected to respect shutdown and dealloc, but you may not get one before the other.  The number of people writing their own layers is vanishingly small, so I'm not going to sweat it.


Other Things I'll Use More Later

Some things are in WhirlyGlobe 2.0 but not fully formed.  I'm using them here and there, but their full potential has yet to be realized.  So be warned.

On demand paging was a big theme of 2.0.  The quad display layers are pretty tightly coupled with what the viewer is doing, but the UpdateDisplayLayer is not.  It's a fairly casual update based on time and location.  That's useful for... you know... stuff.

Support for random coordinate systems is halfway there in WhirlyGlobe.  I've got Spherical Mercator and a few others, but it's hardly complete.  That will change when the map toolkit comes out.

WhirlyGlobe 1.2 added caching for complex features, such as lofted polygons, but I was never entirely happy with it.  Right now the GeometryLayer exists to throw random polygons into the scene.  At some point in the future, these two will meet... somehow.

Sometimes you need to update geometry every frame.  Not as much as you think you do, so be cautious.  If you really, really do there is now an Active Model construct for doing it.

A Scene Graph is a nice generic way to represent 3D geometry for rendering.  I'm not a big fan, as they can be kind of bloated.  I've added one to be compatible with a file format (not in the toolkit) that thinks in those terms, but I'd prefer if people didn't use it.

Onward To The Future!

WhirlyGlobe is about where I want it to be.  The future holds some performance enhancements (legal, I promise) and a lot more client driven features.  And at some point I'll need to tackle OpenGL ES 2.0.

The next big thing should be a flat map toolkit based on WhirlyGlobe.  Stay tuned.

Friday, August 31, 2012

WhirlyGlobe Talks

What marketing I do for WhirlyGlobe works out pretty well.  I just need to do more of it.  To that end, I've started putting together a standard presentation and looking for appropriate venues.

Here's a session I proposed for the upcoming State of The Map conference in Portland.


WhirlyGlobe - 3D Data Presentation on the iPad

Though Apple's app store is gated, there's a robust open source community surrounding it.  Many of those efforts are focused on map related problems.  We'll discuss one of them.

WhirlyGlobe is a native open source toolkit for iPad and iPhone that provides developers with a 3D rotating earth.  With it, you can overlay vector features on image tile sets, such as those from OpenStreetMap.  Data sets can range from the small to very large and WhirlyGlobe has support for swapping features in and out on the fly.

The toolkit itself is in its second major revision and has been out for more than a year.  It has a number of shipping apps to its credit with more in the pipeline.  Most developers build very simple apps, often a base tile set with a few point features.  A select few develop apps of iPad melting complexity with multiple overlays, large tile sets, and paged vector data.

In this talk we'll cover some of the basic functionality in WhirlyGlobe (without resorting to source code).  We'll also discuss some of the challenges users have in obtaining and processing data.  Then we'll conclude with future work, including a planned extension to flat maps.

Is This the Right Venue?

I haven't quite found my niche for WhirlyGlobe.  It's worked out quite well, but it's an odd bird.  There are a number of interesting conferences that might overlap and I'm slowly checking them out.  It's up to the organizers on this one, of course, but I'll be attending in any case.

Wednesday, August 29, 2012

Knight News Challenge - Mobile

If you're not aware of the interesting things the Knight Foundation has done trying to make news more accessible, it's worth a look.

They've funded a bunch of interesting projects in the last few years.  This upcoming challenge is focused on mobile and they've got a penchant for open source.

I'm going to submit something myself for WhirlyGlobe and its upcoming 2D map sibling.  It'll be some deep infrastructure-y thing, probably focused on making large data sets easier to use in visualization.  So that's not why I mention this.


Looking For Partners

If you would like to use WhirlyGlobe in your own proposal (or even its 2D map sibling) let me know.  I'm happy to accept subcontracts related to the contest.  I'll even knock my rate down a bit in the spirit of general whatever.

As for the specifics, keep in mind that WhirlyGlobe is a native iOS toolkit.  It's open source, governed under the Apache 2.0 license.  My toolkit is in it's second major version, can be found in a bunch of shipping apps and just generally already works.

If you're not familiar with WhirlyGlobe, look at this video for the WhirlyGlobe Component release.



What I Can Do For You

Your idea might require additional functionality.  I can add that to WhirlyGlobe.
You might want to do a pretty 2D map that looks a lot like WhirlyGlobe.  I've already got that under development.  I can commit to delivery.
You might need help implementing the tricky 3D bits.  I can do that.

If you've got a great idea brewing on the iPad or iPhone that might win some of that development money, drop me a line and let's see what we can do.

Wednesday, August 1, 2012

WhirlyGlobe Component: Announcement

I'm pleased to announce the WhirlyGlobe Component, an easy to use wrapper on top of WhirlyGlobe.

For users who may not be familiar with WhirlyGlobe, here's the summary.
WhirlyGlobe is a 3D globe rendering toolkit for iPad and iPhone.  It lets you put labels, markers, and vectors on top of a 3D interactive globe with a base layer of pageable image data.





Who It's For & What It Is

The Component is for people who wanted to use WhirlyGlobe, but had trouble compiling it, getting it to run, or dealing with the threading.  You know, most everyone.

WhirlyGlobe Component is most of the interesting functionality without all the stuff that drove people crazy.  It's all Objective C, there are no weird template headers to include, and you can safely ignore threading issues.  Don't get me wrong, all that's still in there, I'm just hiding it.

Where To Get It

I'm putting the WhirlyGlobe Component into beta right now.  You can get the latest version off WhirlyGlobe's github download section.

There are two main pieces in that download:

  • WhirlyGlobeComponent.framework
  • WhirlyGlobeComponentTester

The Tester is my test app.  It's self documenting (Ha!  I kill me).  Just load it up and check out TestViewController.m.  All the important logic is in there.

Using The Framework

It's much easier to include the WhirlyGlobe Component framework in your own project.  That's the whole point.

When setting up a new project, here's all you have to do.
  • Drag WhirlyGlobeComponent.framework into your project view.
  • Add the following standard Apple frameworks that WhirlyGlobe needs.
    • OpenGLES
    • QuartzCore
    • libsqlite3
    • libstdc++
  • Point the Header Search Paths at the WhirlyGlobeComponent.framework/Headers directory.
  • Add -all_load to the Other Linker Flags.  You'll get a missing selector without this.

To actually create a WhirlyGlobeViewController and use it, look at TestViewController.m in the WhirlyGlobeComponentTester app.

Future

At the moment I'm supporting a variety of base image layers, both remote and local, paged and not.  I'm also supporting markers and labels in both 2D and 3D modes.  Selection is working, as is UIView overlay.

The only big feature missing is vector data.  I'm contemplating how best to include that in an intuitive way.  Barring a little testing, that's the last feature before release.  In the mean time, it works great, give it a try.

Live Globe Free on App Store

It's funny, I expected WhirlyGlobe to be picked up by more geography minded app developers;  Live Globe is still one of the few.  Most of my market breaks down into sales offices around the globe and iPad melting high end.  I'm not complaining, as much of my consulting revenue comes from the latter.

Still, I figured there'd be more of these by now.  Go figure.

Screen shots stolen from the app store.
Anyway, they've dropped the price for the basic Live Globe (app store) down to free.  The Pro version's still a dollar.

Friday, July 27, 2012

Network image tile paging

As soon as I had quad tree paging working for local image data sets, like MapBox Tiles, the next question was "What about over the network?"

It's actually a little harder than it seems.  If we're paging data locally and the read is fast enough, we can just fetch one tile at a time.  That's not going to work over the network.  Latency might be fairly severe and loading could be unacceptably slow.

The Demo

But enough of the problems, obviously we can solve them.  So let's see how it works.


The answer is, it works pretty well.  The whole quad display layer infrastructure and assorted data structures and sources is panning out nicely.

Implementation

Here is where things get complicated and then, happily, simpler again.  Let's start with the complicated part.

The data layer that controls all of this is the WhirlyGlobeQuadDisplayLayer.  I discuss it in an earlier blog post, but I'll give it a quick review.  You tell the layer how big the data set you're paging is and provide a whole bunch of delegate methods to fill in the details.  As the user pans and zooms around, the layer is constantly evaluating tiles to load and reevaluating tiles to unload.  But it doesn't actually load anything, that's up to the delegates.


To make one of these things work, you need to provide a couple different delegates to implement the example in the video.  It goes like so.

  • Create a WhirlyGlobeNetworkTileQuadSource, giving it the base URL and image extension.  It'll fetch tiles in the usual base/level/col/row.ext form.  You can also give it a cache directory to check first.
  • Create a WhirlyGlobeQuadTileLoader and give it the data source.  This is the bit that manages the geometry underneath the images.
  • Create a WhirlyGlobeQuadDisplayLayer and add it to the layer thread.  Give this the tile loader and data source and off it goes.
That means setting up image set paging over the network involves three different objects created and initialized in the right order.  That can get complicated.

Implementation: WhirlyGlobe Component

So to make it a bit easier, I've added this functionality to the WhirlyGlobe Component.  All you have to do there is make a call to addQuadEarthLayerWithRemoteSource with the following.
  • The base URL for the image data set.
  • Extension for the image type (e.g. png)
  • An optional cache directory.
  • The min and max zoom levels.  Zero is standard for the min and max can go as deep as the data set provides.
You can tear that thing down just as easily without thinking about threads or ordering or what have you.

Onward to the Future

The WhirlyGlobe 2.0 release is close.  I only have a couple of serious bugs to fix and then a bit of documentation to do.  But first, I'm going to release WhirlyGlobeComponent.

I provide a stripped down, simplified view of WhirlyGlobe with the Component.  It's built on top of the toolkit, of course, but it's entirely an Objective C interface that exposes little of the complexity.  I'd say it has about 60% of the functionality at this point, but 90% of what most people want.  For example, no vectors in the first version, just labels, markers, and base image layers.

The WhirlyGlobe Component's launch is imminent, likely in the next week or two.  I've tested it on client projects and I like how it's working.


Saturday, July 21, 2012

Is WhirlyGlobe dead?

That's the question I always ask when a project's blog has gone dark.  Github and google code are populated with the dried out husks of open source dreams past.  WhirlyGlobe isn't one of them.  Or at least not yet.  I've just been busy.

If you check out the WhirlyGlobe 2.0 repository on github, you'll see a steady stream of updates.  2.0 isn't quite ready to ship, but it's getting close.  My list of things to do is below two digits at this point.  One of them deserves a bit more discussion.

WhirlyGlobe Component

The single biggest problem I have with WhirlyGlobe is that it's, apparently, a complete bitch and a half to understand.  I mean, hey, it's just a combination of Objective C/C++, OpenGL ES, a bunch of dependent open source libraries, and multi-threading.  Like that's hard?  What?

Okay, that's kind of hard.  Now I'm doing something about it.

For the high end user, your iPad melting kind of app that swaps gigabytes of data in and out on the fly... you're stuck.  Suck it up.  But for the low end, I'm making a nice self contained component.

On the compile side, it's one single package that contains all the weird stuff I pull in.  No more compiling Eigen or downloading Boost and Shape and Clipper.  It's all in the library.  The mistakes you can make compiling it are few and easy to fix.

On the development side, the component is... well it's just the one component.  You create a WhirlyGlobeViewController, add its view your view hierarchy and off you go.  It will manage the threading, selection, interaction, and tear down.  All stuff that confused the hell out of people.

Oh, and no more direct C++ exposure.  It's all Objective-C from the outside.

The Future

It's starting simple, of course, with a standard interaction model (think WhirlyGlobeTester) and just the basic markers, vectors, and labels.  For imagery I'll support the old texture groups and the new quad tree data sets (both local and network) so that'll be a bit more exciting.  Then we'll just see where it goes.

Supporting a more general purpose vector data set is going to be tricky.  I'll have to see what's possible and, frankly, who comes in with paying work.  On the plus side, most people are interested in a whole lot of images and just a few vectors.  The Component will work well for that.

Friday, June 8, 2012

WWDC 2012

I'll be there.  I was up early enough to grab a ticket.

If you're there and want to talk maps, 3D, and the real time display there of, drop me a line.

Monday, May 14, 2012

Economist - World in Figures

This one was in development for a long, long time.  I was only involved with the globe portion a few months ago and then more recently to clear up a few details.  So here's what it looks like.

That's a picture taken from space.  The world is actually pastel.
It's ambitious as hell.  I recommend checking it out.  Basically, it's about traversing a data set, the kind of thing Economist subscribers would be interested in.  You've got all sorts of stats about countries, ways to graph and compare and so on.  The globe is just used for selection.

The Globe

Obviously, it's WhirlyGlobe or I wouldn't be mentioning it.  For all the complexity of the rest of the app, the globe is pretty simple.  There's one big image for the countries and their borders, chopped up into the usual chunks.  There's a layer of text on top of that for the country labels.  Lastly, all the selection is handled by an invisible lookup into a typical vector data set.

That last bit is a little different from my old approach.  Since we're not displaying the vector data, it isn't present in memory for selection.  However, you can do selection using the bounding boxes I build on top of the shape files.  That's what makes it reasonably zippy and keeps memory usage low.

Nowadays I almost always do that.  Once the vector data is converted into a raw Drawable form it's not convenient for selection.  Since selection can be (relatively) slow I just hunt around in the appropriately indexed vector data.  I'm doing that in the layer thread so a little delay is fine.

Data Visualization on the iPad

What they were trying to do here was interesting.  I've discussed similar things with other prospective clients.  People can get very excited about comparative statistics mapped on to a globe.  Most people don't have the money to spend or a really firm idea of what the product should be.  These folks obviously did and I think the app was a natural fit for their brand.

I wasn't closely involved with the project (sub-sub-contractor) so I don't know where they're going to take it.  Good use of WhirlyGlobe, though.  Very appropriate.

Friday, May 11, 2012

WhirlyGlobe 2.0 on github

It's not released yet, but I've made it public.  Don't make me regret it.

WhirlyGlobe 2.0 has a lot of neat stuff in it, but it's still very much in development.  I do have clients already using it and the damn thing is open source so it might as well be public.

For now, please use WhirlyGlobe 1.2 unless:

  • You've talked to me and you have some demonstrated need
  • You're paying me money to implement features for you in 2.0.
  • You're willing to use it silently and not bug me.

I'd say 2.0 is now past that tipping point where it's more a "thing" than an "idea" so it might as well be out there.  But again, not for general use.

Mapping Engines

I hint at this in the README and you can see it clearly in the code so I might as well just come out and say it.  I'm branching out from the 3D globe.  Turns out much of what I built is usable as a 2D (ish) map display engine.  Almost as if I planned it that way!

It'll be a 2D(ish) map display toolkit based on a 3D rendering engine.  I'm going for fast and sexy, a small niche for sure, but a much bigger one than WhirlyGlobe.

And no, please don't try to use what's in the WhirlyGlobe 2.0 tree for this.  It's not ready.

Releases

First comes WhirlyGlobe 2.0.  Expect that in early summer when some of the new features settle down.  I'm hoping to slip a couple of big changes in there first, but we'll see.

Then comes the rebranding and the release of the mapping toolkit.  WhirlyGlobe will remain, but under the umbrella of the new library with a new release number and so forth.  Yeah, that's a little confusing.  Expect that late summer.

Thursday, May 10, 2012

Xweather - Extreme Weather

This one's been in development for a while and I'm really happy to see it published.

Xweather displays recent extreme weather events and lets users see where they were, what they were, and read details about that.  Check out the screen shot I just totally stole off their app store page.


It's pretty.  Buy it you cheap bastards.


Development

"Where did they get that handsome globe?" you probably wouldn't bother asking.  Well, it's WhirlyGlobe obviously.  Duh.

For the most part this is just a stock WhirlyGlobe 1.2 globe.  eLoomn, the developers, paid me to add markers and that crazy animated marker functionality.  Looks pretty good actually, but that's all in 1.2 now.  I quite like how the markers turned out.

On a scale from "corporate sales office location display" to "iPad melting dynamic map application", this one would fall somewhere in the middle.  Pretty easy on my end, good use of WhirlyGlobe, not super complex.  They could take it in the iPad melting direction if they wanted to, but I like how they dialed in their ambitions for this first version.


The Future!

As usual I don't make a dime off this sucker, because that's not how I roll.  They have some cool ideas for the next version and, as always, I charge by the hour so I'd love to see this one take off.  Plus it's just pretty nice and they were really easy to work with.

I could see some WhirlyGlobe 2.0 insanity fitting nicely into this app.  [I suspect 2.0 based apps will pretty much all page the multi-res images]. But for now, it does what it does and it does it well.  Very cool.

Thursday, April 12, 2012

MapBox Tiles Paging

The whole point of supporting MapBox Tiles is to load them selectively in to memory as needed.  That is, to page them.  And now we can.  The video explains it best.



That's the Blue Marble January data set and it contains levels 0 through 8.  Level 0 covers almost the entire globe except for the poles.  Children subdivide by 4 each time, so you can do the math.  Or not, but I'm feeling lazy.

New Data Layer

I've added a new data layer to the WhirlyGlobe library, WhirlyGlobeMBTileLayer.  It acts like a regular SphericalEarthLayer with a few differences.

  • It takes a WhirlyGlobeMBTiles object on startup.  It'll check the metadata and then page textures from that data set.
  • maxTiles controls how many individual tiles are loaded in at once.
  • minTileArea controls how deep its willing to page for a zoom level.  This is screen resolution dependent, which is good.
  • viewUpdatePeriod tells the system how often to update based on view changes.
Kick it off and it'll go do its thing within the layer thread.  It serializes tile updates to avoid overwhelming the rendering system and generally tries to keep a low profile.

QuadTree Based Tile Paging

A tile data set organized in a quad tree is great, but if the data is in a different coordinate system from the display, things get interesting.  Here, we're projecting that quad tree, in Spherical Mercator, on to a sphere.  Stuff gets warped.

There's two ways of dealing with that:  You either don't, or you do.  I chose the latter.  It's easier to just show.



WhirlyGlobe Toolkit Changes

In addition to the new data layer and MapBox Tiles objects, I added support for view based updates.

WhirlyGlobeView updates can be overwhelming; there are modes where the matrix is continuously changing, so you might be called at each and every frame.  That's problematic if you're doing any sort of serious calculation for your updates.  To help out, I broke the view update into two pieces.

  • A watcher delegate to capture every view update
  • A layer view watcher that filters the updates based on frequency.
A data layer plugs into this is by registering with the layer view watcher for a maximum update frequency.  The layer is then called no more often than that frequency.  And yes, I take care of the dangling update condition.

This will likely change a bit in WhirlyGlobe 2.0.  Consult me if you want to use this mechanism directly.


How's It Working?

It's working pretty well.  You could slip this in to a few existing WhirlyGlobe apps without much trouble.  There are a few caveats, though.
  • This only works with static local databases.  Paging over the network will come eventually, but it'll be more work.
  • At present the layer really, really wants a full database between the levels you specify.  No missing tiles.
  • Edges aren't correct between neighboring tiles of differing resolutions.  If you pay attention, you can see lines.  It's a classic problem, I know how to fix it.  Just takes time.
  • There's at least one quad tree bug out there.  You might not notice it, but I do.
  • Tiles should really fade in and out rather than pop.
  • Textures need to be downloaded in the background to avoid overwhelming the rendering engine.
Most of these you and your users may never notice.  If you need the paging functionality, grab a copy of the trunk, after I've checked in, and give it a try.  If you notice the problems, let's talk.

Future Work

I'll be doing some minor cleanup and documentation over the next day and then checking this all in.  That will be the last big thing I do for WhirlyGlobe 1.3.  At some later date, hopefully after someone's used it, I'll bundle it all up as the WhirlyGlobe 1.3 distribution in its own framework.

I've got clients (that is, paying customers) who want more complicated things.  Those I'm doing in WhirlyGlobe 2.0.  Some of that is paging related, much of it isn't.  It should all be neat and, yes, I'll be releasing it open source.

If you've got an app coming up in the next few months, use the trunk and/or WhirlyGlobe 1.3 and let me know what you're up to.

Addendum

It's all checked in to the trunk.  Enjoy.

Tuesday, April 10, 2012

WhirlyGlobe & CartoDB

WhereCamp 2012 was pretty small this year, I'm told, but the quality was high.  I ran into a few people doing some very interesting things.  One of those people was Javier de la Torre of Vizzuality.

Vizzuality just launched CartoDB, which is a cloud based GIS database and processing system based on PostGIS.  Sort of a dynamic back end for map data dependent applications.

CartoDB Demo

Displaying vector data is one of WhirlyGlobe's big strengths.  Images are fine, but you just can't beat vectors for most things, particularly in 3D.  Much of the web mapping world is focused on image tiles so it's nice to run into people who get vectors.  Here's a quick demo app we put together.

Protected areas organized by country.
In the picture above, we've fetched UN recognized protected areas, such as parkland, for the selected countries.  The result is colored according to its associated country code.  Apparently Germany is big on parkland.

This sort of thing is more fun if it's interactive, so here's a video.



Anatomy of a Demo

Building the demo itself was pretty easy.  I started with the WhirlyGraph app which is checked in to the Contributed area in WhirlyGlobe.  That app lets you select countries of interest and show various statistics as candy colored polygons floating above the terrain.

I turned off the basic stats display functionality and substituted a query to CartoDB.  Here's an example for Columbia:
http://viz2.cartodb.com/api/v2/sql?q=select name,desig,gis_area,iucn_cat,ST_Simplify(the_geom,0.01) as the_geom from wdpa_2012 WHERE country='COL' AND gis_area > 10.0000&format=geojson

The salient parts of the URL are like so.

  • It's an SQL query, returning the fields: name,  desig,  gis_area, iucn_cat, and the geometry.  Those are all derived from fields in the original table.
  • The data is coming from the dataset wdpa_2012.
  • Rather than return the raw geometry, it simplifies it a bit first.  Very nice for display.
  • We filter by country code (COL) and polygons with a gis_area greater than 10.  This gets rid of the really small data.
  • The return format is GeoJSON.  Human readable if you want to take a look.

Once the query comes back, I process it with the world's dumbest GeoJSON parser and toss the results into a lofted poly layer.  Because that looks pretty.


Conclusions

It took an hour to put together the initial demo.  I spent a couple more hours making it a bit more friendly.  A shippable app would take longer, of course, and I'd want to look at data sizing issues.  Big queries are going to be slow and take a while to display.  A user would probably want more immediate feedback.

CartoDB was nice and easy to use.  The returns were more or less what I was expecting and tweaking the query was quite easy if you have a GIS background.  I could see making some interesting apps with this.

Friday, March 30, 2012

Where Conference 2012

Looks like I'll be at the Where 2012 Conference this year.  If any of my users are going, drop me a line.

Thursday, March 29, 2012

MapBox Tiles - The paging version

MBTiles databases are deceptively simple.  They're just a database with a little metadata, right?

Yes, and that's what makes them tricky.  From an implementation perspective, here are some of the problems:

  • They can be sparse.  Just because there's a level 7 tile at (40,41) doesn't mean there's one at (20,18).
  • They can be empty up top.  A user might neglect to include levels 0-5 because they don't need them.
  • They don't cover the whole earth.  Usually.
There are good reasons for all of those, mostly having to do with 2D map display.  In 3D this gets interesting.  

To do this right I have to map a 2D quad tree onto a sphere for proper data paging.  You have to either hack it or work in screen space.  I'm doing the latter and it means projecting representative pixels to the screen and deciding how important their associated tiles are.  It's a nice general solution and should work well for other data types too.

The point to all of this is that MapBox Tile paging support is underway.  That will open up a host of other interesting areas too.

Tuesday, March 27, 2012

github has won the internet and I'm a joiner

I've got a whole bunch of stuff coming up and rather than announce it all at once, I'll dribble it out bit by bit.  Let's start with github.

Don't Make This Harder Than it Has to Be

Hey, google code.  It's not you, it's me.  Honestly, I just think github will make me more popular.  There. I said it.

Yes, yes.  I know you do git now and I appreciate that.  Really, I do.  But let's face it, we both know you don't really want to.  And you've really let your social features go.  I mean, that's just sad.

So I'm going to leave my old repository there for a while if you don't mind?  Yeah, I know that's a bit rude... but it's more convenient for me.


WhirlyGlobe 2.0

The next major version will go up on github.  In fact, it is already.  You just can't see it.  Trust me, you don't want it yet.  I'm messing with the namespaces and generally causing havoc.  Why put up with that until you have to?

I'm also contemplating a smaller 1.3 release to round out the Mapbox Tiles functionality.  That'll stay on google code.

Thursday, March 1, 2012

Live Globe

I'm pleased to announce the release of Live Globe 1.0 on the app store.  This app really pushes WhirlyGlobe to its limits in some interesting ways.

Live Globe is actually the original WhirlyGlobe app and the publisher, Hyperwords, is my first WhirlyGlobe client.  There's some interesting history there, but first a video.



History

In early 2011 I was contemplating writing a toolkit.  I was thinking of doing either a 3D interactive globe or a 2D interactive map, but I needed a client.  I've learned that I don't get anything done without deadlines or outside observers.  Quantum effects may be at play.

So there I was trolling the job boards, looking for someone who needed one or the other.  Hyperwords turned up first with a list of requirements for a 3D globe.  I sorted those into toolkit vs. app piles, made an initial schedule and off we went.

The WhirlyGlobe toolkit is all mine, distributed under an open source license.  So most of that development was just me doing my thing.  As soon as the toolkit was working, we negotiated for development of Live Globe specific features.  I'm a consultant, that's what I do.

After another interlude, I ended up writing the non-globe features as well.  And here we are.

Features

If you're at all interested in this stuff, you should just go buy the thing and check it out.  No whining about the $3.99 price tag.  Nice things cost a little bit of money.

There are a few unique things in Live Globe.

  • The imagery data set is tweaked a bit and higher resolution than normal.
  • Two data sets are provided for different hardware.
  • Some of the vector data is new and a good bit of the rest is modified.
  • The interaction model is a bit smoother and better integrated.
  • Overall, the app more gracefully handles memory usage.
Those first three are the most interesting.  A lot of app developers don't want to deal with manipulating the data sets.  For good reason too, it's a weird set of skills and it can be time consuming and expensive.

The rest of the development was details, details, details.

Full Disclosure

I'm not an independent app developer.  I only do apps for other people.  I'm not a partner in Live Globe or any other app.  I'm just a consultant with a toolkit.

Live Globe is cool and I wish Hyperwords the best, but I don't have a stake in its financial success.

So Buy it Already

Hyperwords has a long list of features planned for future versions.  But someone has to, you know, buy the thing.  This was the app I used to develop WhirlyGlobe and it was invaluable to me for that.  If you're using WhirlyGlobe or even think it's cool, you should go buy this app.

Thursday, February 2, 2012

MapBox Tiles Support & Other Things

Right now WhirlyGlobe supports a single resolution of imagery for the globe.  You chop it up, feed it to the system and it uses that.  I've always planned on supporting image pyramids.

There are lots of ways to represent an image pyramid.  The one I settled on, for various reasons, is MBTiles.  It's pretty simple and they've got a decent iOS presence.


MapBox Tiles - First Pass

I'm implemented a first pass at MBTiles support.  Here's a pretty picture.

MBTiles layer - Geography Class data set
Lots of things missing here, but let's talk about what's working.  I've added a new data layer called WhirlyGlobeMBTileLayer.  It works in much the same way as the Spherical Earth Layer.  You give it  the name of an MBTiles file and it'll do the rest.

MBTiles are stored in a Spherical Mercator coordinate system (designed to annoy professional cartographers).  That's fine for our purposes, but it does mean we have to do a little reprojection.  The layer handles that part by generating the triangle grid in the local system and projecting out.  As a result the images get warped without having to do anything else.  It's good enough for display.

Just to make that point, here's another pretty picture showing how a vector layer lines up with the underlying image.  It matches perfectly.  A little too perfectly actually, which means we're using exactly the same data set.  Natural Earth 10m admin 0 represent!

MBTiles Layer + 10m vector countries
Okay, so it's completely working, right?  Not so much.  This was just the first pass.  Let's take a look at...

Missing Features

In the above examples we've loaded the 4th level of detail.  It's basically a quad tree so that's means an image set of 16 by 16 tiles.  That looks good here, but if we go closer, it won't.  Go up another few levels and that's too much memory.

The solution is dynamic tile paging.  Load in what's near you, or really what takes up the most screen space.  Load out what isn't important.  It gets messy.

That's the biggest missing feature: dynamic tile paging.  There are some minor features too.  
  • Tile edging.  When textures and chopped images don't get along, you see seams.  I need to figure out why, in this particular case.
  • Sparse MBTiles.  It's possible to make an MBTiles archive with missing pieces.  Useful, but annoying to implement.
  • MBTile selection layers.  The standard supports these grids for doing lookups.  I use vector data for that, but someone might need these instead.
  • PVRTC support.  JPGs and PNGs are a huge waste for the graphics card.  We really need PVRTC images.
Development Plans

I've checked the first pass in to the trunk.  Feel free to kick it around.  If all you want to do is load in a single level of detail, that might be enough.

I don't think this will be truly useful until the dynamic paging is working.  Right now I'm pursuing it at open source speed.  It'll get done eventually in conjunction with an app that the Development Seed guys are working on.

If you need this functionality sooner and have money, let's talk.  This could move up to client speed.  If you don't have money and still need it, I'd be interested in hearing about that as well.

Oh, and here's another pretty picture.

Geography Class + Lofted Polys


Friday, January 6, 2012

WhirlyGlobe 1.2 - Release Announcement

I'm pleased to announce WhirlyGlobe 1.2.  This release has been several months in coming and represents a big step for some of the more interactive functionality in WhirlyGlobe.

I put together a little a short video of the changes.  Check it out below in all its twitchy camera glory.  I'll cover the changes in more detail here.



Marker Layer

In WhirlyGlobe 1.0 we had text labels.  They work great, but sometimes people just want to stick a textured polygon down on the terrain and call it a day.  Or maybe they want to throw down several hundred of them with a sequence of textures.  Either way, we can do it now.



With Markers, you specify a geographic location per marker and one or more textures to use.  If you give it a sequence of textures and a period, it'll switch between them.  We make that all fast on the back end.


Particle System Layer

This feature was just plain fun.  You give WhirlyGlobe a location for the emitter, or 150 of them, a bunch of parameters for the particles and off you go.  The emitters generate new particles in the rendering thread and it all looks smooth and pretty.



For now we're doing simple fountains.  We could change that easily enough.  I'm talking to you, potential clients.


Lofted Polygon Layer

We had lofted polygons in the WhirlyGraph app, but not as a regular feature in the toolkit. These are transparent shapes that sit on top of the terrain, letting you see what's underneath.  They look cool and they're harder to implement than you might think.



Special thanks go to the Clipper library.  I've written that code before and I'm just as happy not to have done so this time.  Plus, theirs is better.



Fading In & Out

It's a minor feature, but I'm already overusing it.  If you specify a fade time on the description dictionary for your object, WhirlyGlobe will fade it in and fade it back out when you delete the object.  Even a fast fade, like half a second, looks good.

Fading out was much harder than fading in, but we did it.  All for you.


Selection Layer


We already had support for geographic selection.  That is, finding the region that contains a given point in latitude/longitude.  Several of my clients needed something better: screen space selection.

Labels are the most obvious problem:  How big is a label in geographic coordinates?  What if I want to select the nearest label instead of whatever falls beneath the tap?  Annoying questions when you're working in lat/lon.



With the selection layer, you just hand over the extents of your object and give it a unique ID.  When you need to run a query, just ask the selection layer to do the work for you.  Much easier.

The label and marker layers in 1.2 use the selection layer if you turn it on.



Caching

Now we're in to the low level features.  Caching lets computationally expensive layers save their work.  The vector and label layers can make use of it, but it's really the Loft Layer that needs it.

What you do is specify a cache name for a given object (or set of objects).  Then, when you ask the layer to add it, it can check the cache first.  If the cache is present, we read from it.  If not, then we do the computation and save to the cache.


Texture Atlas Builder

Keeping the texture count down in OpenGL is pretty key.  If you look at the guts of any modern game you'll see they've merged a whole lot of their textures together into big atlases.  We need to do that too, but our content is more dynamic.

The solution is a texture atlas builder.  Hand your images over to the builder and you'll get a smaller set of bigger textures and a mapping from one group to the other.  You can use these sub textures as regular texture IDs and the layers will do the right thing.

Obviously, this should work with caching, but doesn't yet.


Generators


I'm a big fan of static geometry for rendering. I don't like doing any calculation or data manipulation I can't avoid.  However, some features need real time data manipulation on (or near) the rendering thread.

Generators let us do that without losing too much control.  They're render-side objects that construct the optimized drawables we need in the rendering thread.

In WhirlyGlobe 1.2 we've got a generator for particle systems and one for markers.  For particle systems the generator creates new particles and updates the positions of existing ones.  The marker generator handles switching texture display for multi-texture markers.

I've been pleased with how fast the render side generators are.  I see more animation in WhirlyGlobe's future.


WhirlyGlobeTester


WhirlyGlobe is all about the interaction, so things are constantly getting added and deleted.  We needed a better way to test all that.

The WhirlyGlobeTester app contains code for most of the WhirlyGlobe features.  It also helps test interaction with view controllers and serves as example code.  Look here for best practices.

You can find WhirlyGlobeTester in the source tree or the starter pack.

Where to Get It

You can grab the source tree from the google code page.  The 1.2 release is tagged.

If you just want the framework, check out the downloads page.  There's also a starter pack which contains all the test apps and 3rd party libraries you need to compile.

Wednesday, January 4, 2012

WhirlyGlobe 1.2 - Imminent

I'm just about to release WhirlyGlobe 1.2. This week is pretty likely, early next week at the latest.

Delay, Delay, Delay

I was hoping to wrap this up in November; now it's January. I blame my "clients" with their requests for "work" they're "paying" me for. Bastards. They're still out there, but I've cleared myself a little time to wrap this sucker up.

I've got developers using preliminary versions of 1.2 already. It looks pretty good. In fact, I'd go so far as to call it snazzy.

Looking Past 1.2

I have a 1.3 released planned with one or two big features. I'll talk more about that after 1.2 is out.

WhirlyGlobe 1.3 is likely to have most of the features I consider essential for a 3D interactive globe toolkit. Anything beyond that I'll probably let clients drive.