Created: 2012-03-20 14:57
Updated: 2016-06-24 18:52
License: bsd-2-clause


This is the source code for the building=yes (b=y) website.

The code is available as-is under a BSD license on first principles and in the hopes that it can serve as an example or learning tool for other projects. Or maybe you just want to run a private copy of b=y. That's your business. Patches and suggestions are not only welcome but encouraged (particularly for the documentation).

As of this writing this isn't actually the source code running the b=y site itself. There are a few remaining gotchas to work out but that's just a question of time at this point. This is the new new. (20120410/straup)

How does it work

The site and the code is divided in to roughly four pieces:

  • The raw data and the import process (a series of bespoke scripts)

  • The datastore (Solr)

  • The website / application itself (Apache + PHP)

  • The map tiles (TileStache)

So, by the time you're done you'll be running three separate services:

  • Apache + PHP, presumably on port 80

  • Solr on some internal high number port, presumably on the same machine (as Apache)

  • TileStache also on some other high number port and proxied on port 80 (using Apache or something like nginx)

Technically, you'll also be running a fourth web application for doing reverse geocoding during the import process but that's a special case. Consult the bin/ document for details.

The data itself

As of this writing the data is imported by grabbing a complete copy of the OpenStreetMap (OSM) "planet" XML file, extracting all the buildings and then further post-processing the remaining data to reverse-geocode buildings and store them in a Solr document index.

See the bin/ document for details.

There is a short-term goal/plan of creating an self-updating version of the site that would pull daily (hourly?) changes from the OSM servers but that work has not been started yet.

The website (Apache + PHP + MySQL)

The website is built on top of Flamework. That means the core is nothing more than a vanilla Apache + PHP (+ MySQL) application that can be run out of a user's home directory or a top-level domain.

As of this writing the MySQL piece is entirely optional since it is only used for account management and editing buildings via OpenStreetMap neither of which are enabled (or stable yet).

See the document for details.

The datastore and the search-y bits (Solr)

buildingequalsyes uses the Solr document index as its primary data store. That means the PHP code (above) needs to be able to connect to the designated Solr port, typically on localhost (read: the same machine).

See the solr/ document for details.

The map tiles (TileStache)

Map tiles are generated and served using TileStache. I run TileStache under the gunicorn server framework-thing-y because I like it and its stable but there are others.

See the tilestache/ document for details.

Other stuff

As you see there are quite a lot of moving pieces and software. There is not a magic-pony tool for setting up everything but there is an example installation script that can be consulted: It is called suprisingly enough ubuntu/

Although it is specific to Ubuntu-flavoured Linux distributions (and the apt-* package management tools) it does contain a list of all the various software packages that you'll need to have installed on any machines running b=y.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more