Java Geography for the Smart Mob, Part 1: OpenMap

by Owen Densmore

Introduction: Why Java GIS?



The other day I had a treat: a senior researcher at Los Alamos dropped by for a chat.  He showed me the latest work on project he's working on, Terrorism Modeling.  This is done via Agent Modeling systems like Ascape, Swarm, and RePast.  These agent modeling systems build "worlds" populated by mobile entities (agents) having their own rule sets for establishing their behavior.  The also live in "spaces", environments that they move around in and interact with.




Typically the spaces the agents occupy are simple grids, or graphs with edges and nodes.  So imagine my surprise when he showed me the latest model where the agents were moving around on a globe of the earth!  He could zoom in on a country where the cities were marked and the agents were visible, occupying a "layer" within the cartographic model.




I was hooked!  I looked at the various Java based systems (there are several) and decided to focus initially on two of them: OpenMap  and GeoTools.  This reports on OpenMap ..  we'll do GeoTools (and possibly others) in following reports.



OpenMap: Beans Based Map Hacking



The OpenMap Project is an open source, JavaBeans based programmers toolkit by BBN Technologies.  It is freely available, downloadable from their website.  They have an active mail list with very fast and friendly responses to difficulties you may run into.  Due to its being Beans based, it has a very clean "plug-in" model.




Programmers use OpenMap in one of two ways: by augmenting the OpenMap Viewer application or by incorporating the OpenMap components directly into their own applications. You can see how people are using OpenMap.  



A Tour: Planning a trip to Italy



Here I'll show just a few snapshots of using the OpenMap viewer to look at a trip to Italy from Santa Fe.  Note that I downloaded the viewer .. but you can also access it as an applet  or using Java Web Start via the OpenMap Demo page.








OpenMap Viewer Gallery .. click on images for full size image


















OpenMap Viewer Initial View






Zoomed into Santa Fe






Orthographic View






Distance Mode: Santa Fe to Italy






Day/Night Layer






Day/Night Mercator View





The first image above is the OpenMap viewer just after startup.  In order to check the flight to Italy from Santa Fe, I first zoom into Santa Fe. Note the state boundaries are not present but I can add them by downloading the state boundaries from the Census database.  We'll see a bit of this sort of map data later.  In the third image I've used the Navigation->Projection menu to select Orthographic view.  I rotated the map in the 5th image by clicking the mouse right around the tip of Greenland in order to get both the US and Europe in the same view.  I then chose MouseMode->Distance to measure the flight from Santa Fe to Rome.  This is done by clicking once on Santa Fe, dragging, and double-clicking on Rome.  The double-click ends the transaction, you can create several "hops" by clicking once, dragging again, and so on, creating a polygon.  Finally in the last two images I use the Layers->Day/Night item to see the time separation between Santa Fe and Rome, both with the Orthographic view and the "flat" Mercator view.



Modifying OpenMap: Adding Your Layers and Diagrams



You can do a great deal more with the viewer without actually programming.  For example, you can add new layers.  This is done by downloading the new layer's data and JavaBean into the system and then modifying the openmap.properties file to include the new layer.  One example layer is the ETopo layer, adding depth imaging to the map's oceans. I've also added the New Mexico counties to OpenMap using the free map data from the US Census Office. (Its a bit tricky: you need to run an OpenMap utility to create an index to the map data) You can also draw geographic figures on the map which remain after saving your map view.  In the drawing example I've also turned on the Cities layer.  Click the images for full size images.















ETopo Layer







New Mexico Layer







Drawing Tool



Programming with OpenMap



Our examples above use the Viewer, both as it comes "out of the box", and with minor configuration.  The OpenMap API is also very useable, either for writing beans/layers that integrate into the Viewer, or for including the OpenMap package into your own application directly.




The OpenMap download is quite complete, with full JavaDoc for the API.  In terms of support, I've been impressed both with the sophistication of the user community and the promptness of the response to help requests on the OpenMap mail list.




The Viewer itself is considered a sample application, com.bbn.openmap.app.OpenMap, consisting of only 79 lines of code.  The source for this and a similar layer sample, bbn.openmap.layer.test.TestLayer, is in the downloaded bundle. Both are well documented in the JavaDocs.  OpenMap also comes with a HelloWorld application in the examples directory.



Summary



What a nifty system!  OpenMap and other open source GIS systems show the maturity of GIS, and that it is becoming so universally available that it can be used in wildly different applications than originally envisioned.  We're looking at a distributed PeerPhoto system, for example, that would allow a view of your pictures by where they were taken, or possibly where they are on the peer network.  Think of the Mac Finder having a "sort by place" as well as "sort by time", or your Windows OutLook addressbook sorted spatially.  Google could add a "place" search criterion that you specified by dragging out a circle on the globe.   EBay could let you limit your searches to places you can drive to.  AOL could add a map to show where your buddies actually are.  Jon Udell shows a nice example with Marc Eisenstadt's BuddySpace.




Download OpenMap, and let me know what you think, both about it, and GIS applications you can think of.  I'll press on into other systems and let you know what I find out.




Your homework: Help us think of new and interesting uses of GIS and tell us about it!


5 Comments

anonymous2
2003-03-23 18:50:29
Community Map Builder
Here is what I want to do with Open Source Mapping:


I'm a bike rider in a city without any decent bike maps, however there are good bike routes that some experienced bike riders know about.
I want to show these experienced cyclists a web based map of my city, then ask then to trace out their favourite bike route,
"Along this road, through this car park, along this footpath, click, click, click, ... submit".
When finished, the bike route is submitted to a master database of bike paths.


By my estimates, after six months of bike riders entering and then editing this data we will have a comprehensive bike map of our city.


I discuss this idea a bit more at http://mapbuilder.sourceforge.net


Cameron Shorter,
cameron at shorter dot net

Owen
2003-03-24 09:42:52
Community Map Builder
Hi Cameron. What a GREAT idea! Very much a Smart Mob (Howard Rheingold's book) approach and absolutely spot-on in terms of the applications I think may arise out of GIS becomming more available and approachable as it matures.
anonymous2
2003-04-01 10:16:37
Community Map Builder
I've been thinking about doing the same thing for kayaking for years. You may have just inspired me to work on the project!


-raj singh (web.mit.edu/rajsingh/www/)

cbyrne2
2005-06-17 20:26:13
Repast
The repast project does some pretty interesting stuff with agent modelling and GIS.


Craig

TylerMitchell
2006-01-27 17:01:28
Community Map Builder
Wow, what an old post...So what are you using for the bike/kayak solution 3 years later? :)


Tyler