Mapping Weather Stations
James R. Bracy
Tiles were an obvious option to reduce the load time and allow the map to be really responsive. I started out by surveying the open source solutions on the internet. Many exists, but I really couldn't get many of them to work. If given more time, I'm sure I could generate the tiles using these tools, and in retrospect it may have been worth it. Now I needed to create the tile images by myself. The Quartz framework for the Mac is wonderful, and since I have had experience with Objective-C before, it was an obvious solution (granted it limited my ability to generate tiles to Mac systems).
Generating the tiles required knowing how to create a map projection. I went with the Mercator Projection since most online tools use this and I could easily see if the tiles I was generating actually were correct.
One weekend later I generated my first tiles!
It took some playing around and understanding of coordinate systems (the WGS 84) in this case to get everything right. The end result was dead on!
One catch. I couldn't generate tiles for zoom levels greater than 5. It was
taking forever just to do this. The reason is that for each zoom level the
number of tiles grows by a huge number. Zoom level 1 requires 4 tiles, 2 requires
16 tiles, 3 requires 64 and so forth. The number of tiles for any zoom level is
given my the equation
2 ^ (2 * z) where
z is the zoom level.
Eventually I made it to zoom level 11. I was able to do this by not drawing tiles that had nothing in them. The maximum tiles that I would need to generate would be the same as the number of stations. This is great, now it only takes a few minutes to generate these tiles. With more tuning I could get down to zoom level 18 without a problem, but for now I'm happy with 11.
At some point I hope to do more with the weather data provide and do some visualizations with it. But for a weekend project, this is hard to beat.