Monday, July 09, 2012

Where to Get Polygon Shapefiles


MapIt is a new service from MySociety that maps geographical points to administrative areas.

Using the application you can enter a lat,lon of a location and find out what country, region, city, constituency, or state it lies within. When you enter a lat,lon MapIt returns a list of the administrative areas that the location lies within, starting with the country and then drilling down through state, town and neighborhood areas.

MapIt is based on source data from the OpenStreetMap project, so depends on the level of detail that has been added to OpenStreetMap for each location. In my limited testing of MapIt it produces great results for the UK (down to neighborhood level in London) but doesn't produce such fine results for the U.S. (for example a lat,lon in Brooklyn returns New York as the best result).

A really useful function of MapIt for map developers is that it returns the kml for area searches, so MapIt is a great resource if you want shapefiles for administrate areas. To get a shapefile of an area you will need the OpenStreetMap area id for the location. You can then enter a search in the form:

http://global.mapit.mysociety.org/area/[area id].html

For example, here is the result of an area search for Paris. You can view the created KML using Google Maps or grab the polygon data in JSON format.

If you don't know the OpenStreetMap area id number you can just enter a lat,lon for a location and the area id is returned as part of the search results.

No comments: