Submitted My Windows 8 App for their Contest

This afternoon I have finally completed my Metro style Windows 8 application.  I’m still entering data into the database, but the app itself is completed.  When the app is launched it pulls that data and displays it to the users.

Here are a few screen shots of my application:

My application is based on the House of Representatives.  It allows you to quickly discover your congress person and provides you with contact information including Twitter, Facebook and other links they’ve shared on their websites.

The contest started here:

If I win, I will be included in the first round of apps added to the new Microsoft App store… very exciting!

Wish me luck!

Congressional District Polygons

Here I am again working on my House of Congress/Windows 8/Metro app contest when I’m wanting to show the individual districts each Congress person represents.  Using a Bing search I found myself back at the Census website.  This time looking at the congressional boundary files:

I don’t know anything about the e00 or shp files, so I’ll be working with the available ascii files.

Each state’s zip file contains two dat files.  One dat contains the Long/Lat coordinates for various map-polygons which represent districts that are defined in the other dat file.  What I wanted was a way to tie together the dat files with the Districts table I’d already defined at the start of my development.

I need this information to be in the most covenant format for my application, therefore, I’ll be importing the information for each state into my SQL database.  I created a new table defined as follows:image


Like many of my tables, I’ve setup an Id which auto increments and is the primary key for each row.  Next we have the linked DistrictID, the PolygonID identified within the dat file as well as the Latitude and Longitude values.

First thing was to download each individual ascii file, unblock (windows 7 “feature”), extract and rename each file… only took 20min.

Then using my import program, I follow the following sudo code to get into my database:

foreach DAT file
    read in dat and def files
    extract state name //will use this later to get district reference
    open database
    find state
    foreach dat file line
        parse Long/Lat and cur Polygon # if available
        if cur Polygon # found, then
            foreach def file line
                if cur polygon # then
                    district id = line
        if have district id and current polygon
            insert new coordinates into database

In the end we have a database called Boundaries that looks something like this:


If you have any questions or would like to see the source code for my importer mention it in the comments section below.