Saturday, February 18, 2012

New tools for OAM: Import data from OSM to OAM in a batch process.

I've done some work on migrating data from the master OSM database over to our OAM database. The tricky thing here is that when you download something from OSM, it expects any modifications etc. to be uploaded to OSM, not another database. To work around this problem I've written an tool called OsmXmlTool in Haskell. Put simply it does this. Parse an OSM xml file. Create an internal representation of the data in it using haskells Algebraic Datatypes. Then it modifies this representation following several rules; all entities has to get new unique id's etc. Afther that, the datatype is converted back to XML. This data can be loaded into JOSM, fine tuned and uploaded.

To give a idea of how much work this tool saves us. Today i downloaded a bounding box of Norway with all aviation related features. I put it trough my tool, and after that into JOSM. Some minor tweaks to some tags and uploaded. Took me around 10 minutes. In those 10 minutes i had populated the database of 3000 new entities, runways, hangars, helipads, taxiways you name it. Haskell is awesome, OSM too!

To take look at the result, go to OpenAviationMap.

If you wonder how anything is done or have any questions, pop a comment! I'm maybe thinking of making the tool generic, so that it can be used in any project that want to migrate OSM data into their own database, tell me if you're interested.

Thursday, February 16, 2012

Simulation of quantum wave function

Had a lecture in quantum mechanics today, we've been starting to get serious and are now working with arbitrary 1 dimentional potentials. While doing the work I feelt desperatly in need of some visualization. Therefore I packed together a little simulation in haskell this afternoon. Now, Haskell is the right tool for this kind of job. The whole program is just 63 lines of code, and they're ugly too. I bet that it could be crammed down if one wanted. Anyways, Haskell is so great at this stuff for many reasons. For example it lets me define Numerical instances of functions, that mean that i can add two functions together, before I give them the arguments. This is great for building up complex mathematical functions. In the future I'd like to extend this example to generate a wavefunction for an arbitrary potential. This requires solving differential equations though, I don't think Haskell's typesystem is up for that yet. Anyway I'd be interested in ways to express maths, especially differential equations in Haskell, if you have any ideas, tell me!

The code, as always is available at github


The video represent the wave function of a quantum particle in a box. Unlike normal things in day to day life, quantum partilces doesn't have a defined possition, they have a probability of being at given possitions. The y axis of this animation represents the probability of finding the particle at a given point. This specific example is the superpossition of the 4 first exited states of a box particle. As you see, the "possition" that is where you would expect to find the particle changes with time. That mean we have a moving particle. That might not sound strange, but if i say that each of the 4 exited states in themselves are stationary, they don't move at all, then things start to become interesting. The thing is that by superpositioning differnt static states, you can create a new state, that is dynamic, and thus move; exciting!

The video is generated from a series of pictures output by my haskell program. Since I don't know of any good way to create interactive plots in haskell, and this was an 2-hour evening project i decided to go for: Loads of images -> ffmpeg -> video -> profit!

Friday, February 3, 2012

OpenAviationMap technical crash cource

So how does this OpenAviationMap tick? I'll try to explain as condensed as possible.
The main part is a web application written in Ruby called Rails Port. It handles users, and the map API. This is an XML API that lets users send in changes to the map.
To edit the map we have JOSM. It's a Java application written for OpenStreetMap. It lets you draw things on the screen and give it tags. Then you can press upload, enter username and password, and JOSM posts your beautiful drawing to the API.
The Rails Port application then receives this and stores it in a PostGIS enabled PostgreSQL database.
All changes to the map are incremental. That means that you can individually revert changes, much like on Wikipedia or VCS's like GIT or SVN. This gives us the power to let everyone with an account edit the map by default, because no one can do irreplaceable damage.
To view the map I'm using OpenLayers, written in JavaScript. I serve the OpenAviationMap data from the database via some custom code as WFS to OpenLayers which displays it appropriately over (currently) a Google physical base map.

The start of something great; Open Aviation Map

Ever since I took my private pilots license the thought of how old and outdated my goverments aviation data is distributed have been coming back to me once ever now and then. The thought started to grow in me and today I've come far enough to say that I've started to do something with the problem. I've started an open source mapping project. You've might have heard of Open Street Map, the idéa goes like this:

Let's create a website and software infrastructure that makes it really easy for the lay man to create a map. Then, instead of having to bother about drawing all these ways, junktions and houses, we'll just have to create the software that makes it really easy to do.


The thing is that they've come real far on this thought. Just take a look at OpenStreetMap and look at your local area. Chanses are you see a really good map of roads, important houses etc. Now comes the part that makes this map so different from all the other maps around, Google, Bing etc.

  • This map is make by volunteers that just enjoy the feeling of creating something important and complex.

  • The map is completely free, you can do whatever you want with. You always have to share what you do with it under the same license. This makes sure that if someone does a really smart thing; everyone benefits from it which I think is really neat!


What I've done is blatantly copy OpenStreetMaps philosophy and software architecture and used it for aviation data. To take a look at the page go to OpenAviationMap.

It lets hobby aviators around the world stick their heads together and create a world map for flying!
Already before things are stable Germany has a load of data, thanks to Udo Geschonneck who's done a great job adding the navaids and started some aerodromes there.
If one man can create that much data in just a few days, then creating a world map maybe issn't such a crazy idéa afterall.