Free data: Zip codes with GPS positions

The last few weeks I have focused on learning Windows Phone 8 Development. GPS location for the phone and services provides nearby it is essential for many apps today. Therefore, I decided to start with GPS tracking and Bing Maps integration.

Address data with zip codes and GPS location is pretty statics in most cases, and it might be a smart to maintain a local database for this information and use Google and Bing services for verifying and updating missing or inaccurate information.

As a result, I found some old data files with Norwegian zip codes. I could not remember the source for the zip codes and GPS positions, so I had to google to find it again. Erik Bolstad has a page where he publish Norwegian zip code data that is pretty accurate.

In addition, I need some international zip code, and found an old reference I have used earlier: This site has loads of zip code data available as CSV format.

I have created a SQL 2012 database with all the tables needed to store the information, and for the time being I just store the Latitude and Longitude for the zip codes, but in future versions of the database I will take advantage of the geography datatype and corresponding T-SQL functions for spatial data.


WP8 – GPS Alarm – Part 2 – Calculate Point Distance

In my previous post, I had a short description on an idea of how to create an alarm application based on phone’s and destination GPS position rather than time.

My next piece of code was to calculate the distance between my current location and the destination location. After I put my daughter to bed tonight, I powered up my laptop and googled for 30 minutes and came accross a great post by Dragos Manolescu using the Haversine formula. I haven’t tested this method properly, but it seems to fit into a first version of the application.

My next step will be to create an user Interface for the Application to make the users able to store their target destination GPS positions efficiently.

Source code: ContinuousLocation.rar

I used the example found in previous post for this test.


Happy coding….

WP8: GPS Alarm – Part 1 – track GPS position

Some years ago, I commuted to work by train from Fredrikstad to Oslo every day. Normally, I used to sleep to either work or home. However, as we all know, public transportation is not always as reliable as we want, and I was interrupted in my beauty sleep 🙂

As a result, I started thinking about a mobile application “GPS Alarm”. This Application would work as any alarm functionallity based on GPS position instead of time. This means that I can sleep as long as the train is not near my hometown or Oslo.

This Application need some basic technology. First, we need to track current GPS position for the phone with regularly time intervals. I had a Google moment this week and found a great post by Adam Benoit on how to tracking your Windows Phone 8 GPS position. His example is enough to be able to track the phone position. Thanks Adam!

Secondly, I want to be able to define areas (such as towns, train stops and further) and services they provide to me as a consumer. When I am inside this area, I will use Windows Azure Notification Services to send push notifications to my phone.

Happy coding…