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.