The Source for Java Technology Collaboration
User: Password:



Joshua Marinacci

Joshua Marinacci's Blog

A Mapping Christmas Present

Posted by joshy on December 22, 2006 at 10:32 AM | Comments (16)

You may get several Christmas presents this year so I'd like to give you all mine first. Best to be early than late and forgotten. :) You can scroll down to the screenshot and link if you want, but if you prefer some delightful Christmas suspense begin reading here. You might want to grab some egg nog first. In fact, adding a splash of rum might help too. We've got a lot to go through.

As you may know from reading my previous blogs we have been working to move the mapping component from our Aerith demo into the new SwingX-WS project. Our goal has been to make mapping easy; so easy that you can drag and drop a component into your Swing app and have something that works with no extra configuration. Sadly.. reality often diverges from our wishes.

Our Christmas Wishes

The JXMapViewer, our new mapping component, is still to hard to use. You still have to build too much of your own code and configuration to get it to run. For many applications you just need a map of the world. Right now, when you create a new map component, you get nothing at all. Nada. Zip. Zilch. Nil! Surely we can do something useful by default!

We need a stable data source. The WMS server from my previous examples has been up and down a lot, so we could never guarantee that it would be there when you need it. I've had some trouble finding a reliable server that would give us good performance. Something stable enough that we would feel comfortable setting that server as the default. That's asking a lot.

It would also be nice to have a prefab application or applet with no Java coding required. One of the great strengths of Google's AJAX offerings is that you merely need to paste a snippet of HTML and Javascript into your webpage to get started. We really need to be that easy!

Three Christmas Presents

So for Christmas we wanted to solve all three of these problems. They aren't perfect yet but you can see where we are going and maybe even help out.

JXMapKit. We've recently added the JXMapKit class. It's a composite component that bundles up a JXMapViewer class with common things you are likely to want such as zoom buttons, a zoom slider, and a mini map. It also pre-configures the map component to use a known stable map server. Which brings us to..

maps.swinglabs.org. We need a stable map server. Nothing I've found so far fits the bill, so we thought: why not make our own! For serving up satellite data it's actually quite easy. We took one of NASA's large Blue Marble images and chopped it up into little 256 pixel square tiles. Currently the server is set to maps.joshy.net, but it will be renamed to swinglabs.org soon. We are using a relatively low resolution bitmap right now (a mere 5600x2700 pixels) but we will upgrade to higher rez soon.

Of course our own server can only deliver so much bandwidth and we don't have the disk space for a full set of ground level satellite photographs. That's why we've been talking to some engineers at NASA. They are very interested in working with us and sometime soon we hope to have direct access to the same map servers that power NASA's super-awesome 3D WorldWind client.

JXMapViewerApplet: The only thing better than writing no Java code is not having to compile it either. We have put together an applet that embeds the JXMapViewer right into your webpage without needing to write anything at all. You will be able to drop an APPLET tag into your webpage, hit reload, and have maps immediately available.

So here it is. Our first mapping applet from Swing Labs.

Merry Christmas!

Run the JXMapViewerApplet
requires Java 1.5
Screenshot of the JXMapViewerApplet

A word of warning: This applet is not optimized in the slightest and the JXMapKit itself still has many bugs. This means it takes longer to download than it should (much longer because I haven't stripped the jars yet) and there are several problems with repainting and keeping the map views in sync.

New features coming next year:

We've got more plans for the JXMapViewer in 2007 and we need your help. Here are just a couple of the things we want to work on in the new year

Applet features. While it's not currently working, we plan to let you add waypoints and configure the applet using PARAM tags or Javascript. No Java coding or compilation required. We'd like to hear from you what kinds of things you'd like to do and what sort of API would help.

Get rid of the jar signing. If at all possible we will make the applet load from the same host as the tile server so the applet won't need to be signed. You won't need to host the jars any more. Just link to our jars and go

Performance, performance, jingle bells, and performance: Stripping the jars will help with loading time but the real improvements will come from completely rewriting the image loading / threading / caching routines.

New data sets NASA has a variety of map sets we could use. What would be most useful to you?

New features that you want!. Ultimately we write code that you want to use. What cool things would you like to do with maps?

Happy Holidays

That's it for me for 2006. I'm having my entire family in town for Christmas and then three days later getting married. It's going to be a busy and fun week. Have a Merry Christmas and a Happy New Year everyone. See you soon!

Josh and Jen in front of their Christmas Tree


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Well, I would like to try to rewrite my search-by-location view of my Gallery (eg see http://gallery.hd.org/_site/AlohaEarth/coords/348/-228/1 ) to use this stuff, but at the moment your applet seems to run slower than my back-and-forth Plain-Old-HTTP implementation! (Of course, I'm running a spiffy JDK6 backend on a spiffy T1000, which helps...)

    Rgds

    Damon

    Posted by: damonhd on December 22, 2006 at 11:33 AM

  • I guess I got a lump of coal... :( My applet wasn't a pretty map, but a grey rectangle(maybe its my browser?). Anyway, what's up with the US map? Its Christmas, it should be a map of the North Pole!

    leouser

    Posted by: leouser on December 22, 2006 at 11:56 AM

  • Just one little note: my mental map expected the upper button to give it more zoom, not the opposite. I guess that is the convention most map software uses, but maybe it is just me. It is cool, however.

    Posted by: mister__m on December 22, 2006 at 12:20 PM

  • This is very cool. Is there a plan to make the API flexible enough so that I can plug in a local storage mechanism? So I don't need to depend on a particular server.

    Again very cool.

    Posted by: aberrant on December 22, 2006 at 01:42 PM

  • damonhd: The limiting factor on the speed is probably the speed of my webserver. I'm looking into some optimizations, though, that I hope will improve the percieved speed. Things like better pre-caching and maybe some HTTP pipelining.

    Posted by: joshy on December 23, 2006 at 09:05 AM

  • leouser: What browser are you using? Be sure to move the map around to make it refresh. I actually did want to do something with the North Pole, but unfortunately a cylindrical projection doesn't make for a terribly nice view of the poles.

    Posted by: joshy on December 23, 2006 at 09:06 AM

  • mister__m: yeah, i need to clean up the UI some. Moving the zoom buttons around is the first priority. I put them in this position to match the zoom slider. If I can figure out how to reverse that then I could reverse the buttons too.

    Posted by: joshy on December 23, 2006 at 09:08 AM

  • aberrant. The API already has a class called TileFactory. This lets you load tiles from wherever you want, including a jar or local directory. The JXMapViewer itself doesn't know anything about HTTP or mapservers, so you could plug in whatever provider you want.

    Posted by: joshy on December 23, 2006 at 09:09 AM

  • how and where do I get the source for this one. I checked the swinglabs-demos and even tried the new_tile_provider branch. I got your older weather station viewer working though.

    Posted by: sashiono on January 01, 2007 at 10:45 PM

  • ok think I found it in JXMapViewerApplet.java :) lets see If I can get it running.

    Posted by: sashiono on January 01, 2007 at 10:47 PM

  • I've put up a new version of the applet and committed some changes to CVS. The biggest improvement is a new, bigger dataset; now including the oceans!

    Posted by: joshy on January 02, 2007 at 08:45 PM

  • I am eager to see this one: the real improvements will come from completely rewriting the image loading / threading / caching routines.

    And, the image loading / threading / caching routines are a bit complex.

    Posted by: ylzhao on January 06, 2007 at 05:16 PM

  • ylzhao: quite true. there's a lot of work to do. Fortunately most of that is hidden so we can improve it in the future without changing the API.

    Posted by: joshy on January 07, 2007 at 03:05 AM

  • Has JXMapKit been in SwingX-WS CVS?

    Posted by: ylzhao on January 08, 2007 at 04:26 PM

  • The JXMapKit is in CVS, but you need to check the new_tile_provider branch. We will be merging to head soon.

    Posted by: joshy on January 08, 2007 at 04:32 PM

  • This is really cool. I wish I had seen this when it came out so I could have spent this year playing with it.

    Posted by: szermierz on January 15, 2008 at 01:35 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds