« The Dishes (and Thesis) are Done | Main | Time for MTA Bus Time »

OpenStreetBlock

Please put your hands together for... OpenStreetBlock -- a web service for turning a given lat/lon coordinate (e.g. 40.737813,-73.997887) into a textual description of the actual city block to which the coordinate points (e.g. "West 14th Street bet. 6th Ave. & 7th Ave") using OpenStreetMap data.

There are likely many applications for such a service. It should be quite useful any time one might need to succinctly describe a given location (or set of locations) without using a map. I imagine it would be particularly helpful for field testing a real-time bus tracking and customer information system using a smartphone or other small mobile browser.

The basic concept of how it works is the following.

  1. Start with a given lat/lon coordinate (40.737813,-73.997887, for example).
  2. Find the street segment ("way" in OpenStreetMap terminology) physically closest to the given coordinate. Assume this is the street we are on: in this case, "14th St."
  3. Find the two intersections ("nodes" in OpenStreetMap terminology) closest to the given coordinate on the selected street. Assume these are the intersections we are between.
  4. For each of those intersections, find the streets passing through those intersections. Exclude any intersecting streets with the same name as the selected street (the one we are "on"). Use the remaining streets to name the given intersection (the ones we are "between"): in this case, 6th Avenue and 7th Avenue.
  5. OpenStreetBlock also uses a configurable threshold parameter to determine whether we are "at" a given intersecting street rather than "between" two intersections (this is the so-called "Corner Threshold"). If we are within this threshold of the nearest intersection, drop the other intersection: in this case, we are not.

I've been hacking OpenStreetBlock on and off for several months now, and I finally found the time to clean it up a bit for release as a free-standing open source project. To learn more, read about the web service itself or try some example searches (this instance is only populated with OpenStreetMap data for NYC less Staten Island).

This project wouldn't be nearly as easy as it was without: PostgreSQL, PostGIS, osm2pgsql, Osmosis, Apache, PHP (yes, I know), and OpenStreetMap.

About

This page contains a single entry from the blog posted on April 3, 2011 8:41 PM.

The previous post in this blog was The Dishes (and Thesis) are Done.

The next post in this blog is Time for MTA Bus Time.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.