Thursday, February 27, 2014

WhirlyViz Demo

The other day I was planning to give a short talk on WhirlyViz at the San Francisco GeoMeetup.  Due to equipment problems it never happened.

Rather than let slides go to waste, here's the talk in video form.



You can get WhirlyViz on the app store.

The URLs I use as examples can be found in a previous blog post.

Tuesday, February 25, 2014

WhirlyViz - A Quick Introduction

A few weeks ago we put together an app called WhirlyViz.  And then I got busy with other things.  Android and vectors maps, if you're curious.

Property in New York that you do not own.  Nor I.

What is WhirlyViz?


WhirlyViz is a geospatial display app for iPhone and iPad.  It displays data, like vectors and maps, in relation to each other.  Then it lets users interact with the data.  Oh, and it's free.

It's an outgrowth of client and user projects.  A lot of my users slap a few vectors on top of a base map and then let the user tap on them.  I figured I could automate that case.... as well as some more interesting ones.

Seriously, there's a country that eats a lot of meat.

I'm not ready to roll out the complicated cases yet.  They get complicated.  But the simple cases are ready to go.

GeoJSON Overlay in WhirlyViz


Ever wanted to display a GeoJSON file on your iPad?  Yes, you could use Leaflet and Safari.  Ever wanted it to be fast and not annoying?  Well, I can hook you up.

Dude, I could have totally had a bike, like, two years ago.

That's an incredibly old snapshot of New York bike share availability.  It's just a GeoJSON file slapped on top of a standard MapBox basemap.

And you can make these yourself!  It's actually quite easy.  First, some examples.

WhirlyViz URL Examples


First off, you need to install WhirlyViz on your iPad or iPhone.  Go ahead, I can wait.

Now come back to this page in Safari and click on the links below.

  Chicago zip codes displayed in red on a globe

  Chicago Zip Codes 

  Country-like regions from Natural Earth Data

  Admin 0 boundaries (sort of countries) from NaturalEarthData

  An example with a handful of bars in Washington, DC using icons

  Bars in Washington, DC

  A snapshot of city bike share stats from New York also using icons

  BikeShare in New York, NY

Load up any of these and tap on the vectors.  You'll see the attributes on the GeoJSON data.

Anatomy of a WhirlyViz URL


Did you know you could make custom URLs for iOS apps?  Well you can.  Developers do it all the time.  All WhirlyViz URLs start out like so:

That tells iOS we want to invoke WhirlyViz and it tells WhirlyViz to get ready to display something.  Then we have a bunch of arguments.
  • name=<name>   The display name the user sees up top.
  • basemap=<url>  The json file describing the basemap we'd like to see
  • geojson=<url>    A GeoJSON file to slap on top of the basemap
  • type=<globe/map2d>  Whether we want a 2D map or a 3D globe
  • vecwidth=<width>      Width of any following vectors
  • veccolor=<hex color>  Color of any following vectors
  • vecfilled=<yes/no>      Whether or not vectors are filled
  • clearcolor=<hexcolor> The background color for the globe

The Chicago zip code example is constructed like this.

And here's what it's doing:
  • Puts the name "Chicago Zip Codes" up top.
  • Tosses down an example MapBox basemap.
  • Puts up a zipcode GeoJSON file with vector outlines in red.
  • Puts up the same zipcode file with translucent red filled polygons.

You can make those yourself.  It's really not that hard.  I like to construct them in email and mail them to myself on the device.

Future of WhirlyViz


On the complicated side, there's a lot to do.  WhirlyViz has some crazy features that'll take a while to shake out.  Some actual clients using it might be nice.

On the simpler side, I'm happy to add features to the GeoJSON display.  The styles github supports would be a good start.  Just try it and let me know what you did!

Thursday, February 6, 2014

Dark Sky 4.0

It's been a while since I've posted.  For those of you keeping track (e.g. no one) that means I've been busy implementing stuff.  Here's one of those things.


Hey midwest, your suffering is particularly beautiful.

The new Dark Sky uses WhirlyGlobe.  And boy does it ever use it.  The animated weather is gorgeous and pushes the new layer animation functionality to the breaking point.

Random Update On Stuff


Yeah, there's animation support in the image layer now.  Shader support too.  I should really write that up.  In fact there's a little note on my desk which says "Write up Animation Support".  It also says "Android Update" and "Vector Maps Update" so perhaps I'll write those up as well.

For now, here's the capsule version:
  • Animated image layer support?  Yup.
  • Custom shaders?  Oh yeah.
  • How's the Android port going?  The OSM Vector example is working.
  • Vector maps?  Yup, using TileMill for styling.
  • Are they fast?  Oh yes, they are very fast.
That'll have to do for now.  If you have specific questions, feel free to hit me up.

Monday, December 9, 2013

WhirlyGlobe-Maply For Android

For those of you with a short attention span.  The Android port is on.  Now for the details.

Yes, it will look exactly like this.

WhirlyGlobe-Maply is in great shape on iOS.  With the recent release of 2.2, I'm pretty happy with the architecture and functionality.

The toolkit has matured from a lightweight interactive globe to a serious geospatial display toolkit.  It's suitable for large globe based applications and interactive flat maps.  I have some pretty reliable clients in aviation, geography, and map display.

That's great and I can see this going on indefinitely, but there's one obvious thing that must happen fairly soon.  I need to port to Android

Why Android?


We can debate the pros and cons of Android vs. iOS endlessly.  It doesn't really matter and I don't really care.  I need to port to Android because big clients want me to port to Android.  No one wants to get stuck on iOS.

Most of my clients aren't selling their apps anyway, they're selling services.  To them, it's a matter of cost.  The iOS version is a given, but then how many customers are on Android and how much will it cost to get there?

There are other reasons.  Once the Android port works it opens the door for other ports.  What about the Mac?  PC?  Windows Phone?  How about some weird custom in-car navigation system?  I'm focused on mobile, but I'll take money for any of those ports.

Clients


Once I started asking around for Android money it became clear how this was going down.  I needed one big client to pay for the biggest chunk of it.  I'd toss in some of my own overhead money and then get the rest from a diverse set of clients.

Now I have that big client on board.  Negotiating deals for functionality that doesn't exist yet is always tricky, at least for a small project like mine.  But we did it, WhirlyGlobe-Maply is growing up!

I'm focusing on what that first customer needs so there will be plenty of gaps after the initial port.  Everything depends on the core rendering engine, naturally, so porting the rest of it will be much easier.

The initial version will be ready in late winter.  "So..." you may be thinking, "can I get it?"

Open Source + Private Beta


I'm very happy to announce that WhirlyGlobe-Maply 3.0 for iOS and Android will (still) be open source, distributed under the Apache 2.0 license.

That's nice, but I need money to finish porting everything else.  So here's how that's going down.  It's open source, but the toolkit will be in a private beta for a few months.  How long?  I'm not sure yet.  You want access to it right now?  Pay for some functionality.

Make no mistake, this thing is going to be usable in 2-3 months, depending on what you need.  Porting the rest of what you need will be easy.  So cough up some dough and off you go.

After I've reached a certain threshold of working functionality, I'll release the toolkit to everyone and we'll go back to normal.

Thursday, December 5, 2013

Maply 2.2

I'm pleased to announce the release of Maply 2.2.

Maply is a 2D and 3D map rendering toolkit for iPad and iPhone based on OpenGL ES 2.0.  It lets you put labels, markers, vectors, and shapes on top of an interactive map with one or more base layers of pageable image data.

Check out the video for a quick tour.


Maply is actually part of the WhirlyGlobe-Maply component.  The library handles both a 3D globe and a 2D/3D map with different entry points.

Go check out this page for details on how to get the library and use it.

WhirlyGlobe 2.2

I'm pleased to announce the release of WhirlyGlobe 2.2.

WhirlyGlobe is a 3D globe rendering toolkit for iPad and iPhone based on OpenGL ES 2.0.  It lets you put labels, markers, vectors, and shapes on top of a 3D interactive globe with one or more base layers of pageable image data.

Check out the video for a quick tour.



WhirlyGlobe presents a nice, simple Objective-C interface and uses standard MVC constructs such as view controllers and delegates.  It's very easy to integrate into your own app.

Where To Get It

The github repository is the best place.  The master branch is on 2.2.  You'll want to check out the readme, but basically it goes like this.

  • git clone https://github.com/mousebird/WhirlyGlobe.git WhirlyGlobe-Maply
  • cd WhirlyGlobe-Maply
  • git submodule init
  • git submodule update
  • Open the WhirlyGlobeComponentTester in Xcode
All the example data is in one of the submodules, so it takes a while.

There's also a binary distribution.  Download it and open the WhirlyGlobeComponentTester example.


Using The Framework - GitHub

It's pretty easy to use WhirlyGlobe in your own project.  If you're using WhirlyGlobe as a submodule, it's like so:

  • Set up a brand new project for your app with git enabled.
  • cd to the root directory of the project
  • mkdir libs
  • git submodule add https://github.com/mousebird/WhirlyGlobe.git libs/WhirlyGlobe-Maply
  • git submodule init
  • git submodule update
  • cd libs/WhirlyGlobe-Maply
  • git submodule init
  • git submodule update
One of WhirlyGlobe's submodules contains all the source data, so that'll take a while.  You only have to do it once.

Then in your Xcode project, do the following:
  • Go to Build Phases and open "Link Binary With Libraries".
  • Hit +
  • Select "Add Other"
  • Navigate to libs/WhirlyGlobeSrc/WhirlyGlobe-MaplyComponent/
  • Select WhirlyGlobe-MaplyComponent.xcodeproj
  • Hit + again
  • Select libWhirlyGlobe-MaplyComponent.a
  • Add a few other libraries you'll need
    • libc++
    • CoreLocation
    • libz
    • libxml2
    • libsqlite3
  • In Build Settings find "Header Search Paths"
  • Add the path "$(SRCROOT)/libs/WhirlyGlobe-Maply/WhirlyGlobeSrc/WhirlyGlobe-MaplyComponent/include/"
You should now be able to pull in WhirlyGlobeComponent.h and compile.

Using The Framework - Binary Distribution


If you're using the binary distribution instead of github, there are even fewer steps.
  • Set up a brand new project for your app.
  • Go to Build Phases and open "Link Binary With Libraries".
  • Hit +
  • Select Add Other
  • Navigate to WhirlyGlobeMaplyComponent.framework in the binary distribution and select it.
  • Hit + again
  • Select libWhirlyGlobe-MaplyComponent.a
  • Add a few other libraries you'll need
    • libc++
    • CoreLocation
    • libz
    • libxml2
    • libsqlite3
  • In Build Settings find "Header Search Paths"
  • Add the path to "$(binary dist path)/WhirlyGlobeMaplyComponent.framework/Headers".  You fill in the binary dist path.
You should now be able to pull in WhirlyGlobeComponent.h and compile.

Documentation

The full set of reference documentation is now available.  That's documentation for each of the Objective-C classes.  The crazy C++ internals are not documented there, so think twice before using them.

To see what's possible, consult the WhirlyGlobeComponentTester app which is included both in git and the binary distribution.  TestViewController.m is the best place to start.  Getting a simple globe up and running is surprisingly easy.

Wednesday, November 13, 2013

WhirlyGlobe-Maply 2.2 Beta4

Busy, busy, busy.  So here's the next WhirlyGlobe-Maply 2.2 beta.

That's animating, trust me.

I probably should have shipped the last one and moved on to version 2.3.  But I didn't.  I was busy integrating with a few client projects and that shook out a lot of bugs.  The user community was pretty active as well, finding bugs and minor gaps in functionality.  The result is beta4, which I quite like.

Updates to Beta4


There were many, many bug fixes.  We shook out a lot of problems and I added a whole bunch of new functionality.

  • 2D Maps
    • These work more smoothly in general.
    • When displaying a tile source that's in the same coordinate system as the viewer, we skip all the complicated screen space calculation logic.  This makes the loading look better.
    • For that case (simple flat map, basically) you can now ask "what zoom level are we at?"  That question only makes sense for a flat map.
    • The display supports coordinate systems other than spherical mercator.  Only one other is available, but in the future... more.
    • Rotation is now working thanks to a pull request.
  • Quad Image Paging Layer
    • Image paging now lives in its own thread and synchronizes with the frame draw boundaries.  This is very fast.
    • More knobs for controlling animation.
    • Many bug fixes to animation.  This deserves its own blog post.
    • Handles empty tiles better.  Now you can have a tile source that only provides levels 10-12, say, and it'll work.
    • Better error reporting including feedback at the tile source for failed loads.
    • Support for asynchronous loading if that's how you swing.
  • WhirlyGlobeViewController / MaplyViewController
    • You can now ask the control how high you should be to see a given bounding box.  This is nice for centering on data.
    • There are delegate methods for didStartMoving and didStopMoving.  These are useful for reacting to where the user is looking.  Be careful, they're on the main thread.
    • I support images on various high level objects, like stickers or markers.  The toolkit reference counted those when converting to OpenGL ES textures.  Now you can nail those down in the format you want with the settings you want and avoid creation/deletion thrashing.
    • Stickers support multiple images which they will happily pass to custom shaders.
    • Filled vectors now support textures.  [You should be saying "Oooooo" right now.]
    • Shader support has been there for a while, but now it tracks updates and forces redraws more consistently.
    • You can pass an image to a shader where it'll use it to do... whatever you write your shader to do.
    • Billboards are... hard to explain.  Useful if you know what they're for.


Distribution


You've got a couple different options for getting WhirlyGlobe-Maply 2.2 (beta4):
Don't forget about the documentation.  It took long enough to write, so read it.

The Future


This is more or less it for 2.2, I think.  Maybe a few bug fixes if anything heinous turns up.

I've absorbed 2.3 into the last beta, so next up is probably 3.0.  That'll be a while.