This weekend i continued to play with Flash Player 8.5 alpha, and did something kinda crazy (at least i thought so when i started).. I tried to render high resolution GIS data purely clientside with Flash.
In the beginning, i was just searching for detailed, free, redistributable map data of the world, with political country boundaries, and maybe state boundaries too, to write a simple world map component. I was scanning through a lot of link lists, and almost all material i found was either incomplete, not detailed enough or expensive. Except the “Vector Smart Map Level 0 Library”, a huge (1.8GB), free and redistributable collection of all sorts of high detailed geographic data, published by the National Imagery and Mapping Agency (NIMA).
“Published by the National Imagery and Mapping Agency (NIMA) on CD-ROM, the VMap0 database is designed to provide vector-based geospatial data at low resolution. The content of the database is similar to the previously published Digital Chart of the World, augmented with low resolution bathymetry for global coverage. A reference library with general information to orient the user and an index of geographic names to aid in locating areas of interest are provided. Data are separated into thematic layers: boundaries, elevation, hydrography, industry, physiography, population, transportation, utilities, and vegetation.
VMap0â€™s world coverage is divided into four libraries based on geographic areas. The geographic areas and library names, by disc, are:
The primary source for the database is the 1:1,000,000-scale Operation Navigation Chart (ONC) series co-produced by the military mapping authorities of Australia, Canada, United Kingdom, and the United States. Data gaps may exist where source information is not available.”
But how to get this data into the Flash Player? The format they use is VPF (Vector Product Format, [PDF]), a heavily cross linked, binary format. I started reading through the spec, and thought that with the capabilities of the new Flash Player 8.5 alpha (highly increased VM performance), it could actually work to just load the data as is and render it. Said and done.
Here’s a proof of concept application i threw together over the weekend, that loads the “Library Reference” coverage (3MB, binary, as is, using the new URLStream class), deserializes the data into Arrays, and renders the data on screen while loading. What we get is a quite detailed map of the world with country-level political boundaries.
For those of you who don’t have the alpha player installed, here is a screenshot:
And here’s another, fully zoomed in to Japan:
The Flash Player renders the whole map in around 5 seconds (delayed with enterframe events) on my machine, drawing 250.000 lines in more than 2.000 shapes.
The only drawback: it takes a while until the data is loaded (depends on your connectivity of course).