After buiding our Storm Stories and Help Your Neighbors maps, I’ve heard from a few people wondering about how they might build a mapping app for their own sites. I’m by no means an expert on this — but that’s one of the reasons why I enjoyed this project so much. I learned a ton while doing it. So I’m more than happy to share what I do know.
Our approach at the Spokesman was to use our own database and do everything ourselves, but not everyone has the server access and/or development time to tackle a mapping project that way. The nice thing is, there are definitely other ways to get the job done. Here are three:
You could use Google’s MyMaps feature
I’ve played around with this myself for use on a couple simple projects, and it’s a pretty slick way to allow non-technical people to get data onto a Google Map, which you can then embed on your own site. You need to have a Google account, and then when you go to maps.google.com, you’ll see a “My Maps” selection in the menu at left. This lets you create a custom map, clicking or entering addresses to add points, and typing in the description text for each. Once you save the map, you can grab the link to the KML file (which is XML describing the points you’ve created), and call that data into a simple map template on your own site. There’s a really good writeup on doing this type of project at PostNeo.
The downside is that this really isn’t open to the public to add their own points to the map. But it’s pretty darn easy if you’re just looking to map some information that you already have. The nice thing is, once you’ve embedded the map on a page on your own site, the KML information you’re calling in is dynamic. So if you log into Google Maps and add new points to the MyMap you’re working from, they’re automatically pulled into the map on your site.
You could use a combination of Google Spreadsheets and Google Maps
I don’t know how much you’ve played with Google docs, but within the past week or so, they added submit-by-form functionality to Google Spreadsheets. So you could go in, create a new spreadsheet with the fields for a mapping app (i.e. Name, Description, Street Address, City, State, ZIP, lat, lng), and then use the share via form functionality to create a web form to collect data from your reporters, users or whomever. Once the data is in, you need to 1) geocode the addresses in each record, and 2) get the data from the spreadsheet into the map. Basically if you walk through the 3-4 steps described here, you’ll see how that could work:
The advantage here over MyMaps is that you get the opportunity to collect data from your users. You’re adding some time and complexity to the project, definitely, and you’re signing up for some maintenance on the data (you’d end up needing to run the geocoder regularly to catch new input, for example). But depending on the product you’re shooting for, it might be worth it.
You could build your own database-driven map
Although we’re in the process of moving to a new framework, our current site runs on ASP and SQL Server, so that’s what our Storm Stories mapping app was built on. Getting it up and running required:
– building the data model and database table in SQL Server
– creating the forms for internal admin of the submissions
– creating the forms for people to submit posts to the map
– incorporating geocoding on the fly via javascript
– building map pages that pull records out of the database and plot them via the Google Maps API
There are plenty of scripting languages you could use to do something like this, if you have access to a server that will run a database and can write some PHP, Django, etc. Personally, I like the control you get with doing a project from beginning to end, without having to rely on external services.
And I’m also aware that there are a ton of people out there who are better at this mapping thing than I am, so I looked at this particular project as a good excuse to build a few skills. And I learned a TON about mapping over those couple of days. Describing the forms/admin/database work is probably beyond the scope of this writeup, but at its most basic, you need an admin page to list published/unpublished records, an admin form that displays the detail information on any given record, and a set of SQL statements to pass the form data through to handle the traditional Create-Read-Update-Delete functions. And you need a form for users to Create a new record.
As for the mapping, here are a couple tabs I kept open pretty much all the time:
Google Maps API documentation
Google Maps API tutorial
Between those two resources, you’ve got all you need to get the mapping working. But when you get stuck, the classic “view source” on a similar implementation (like this Detroit driving map for example) is also a lot of help.