About Wyatt

System Architect and Lead Developer for byCycle.org. Also, employeed by TriMet as a software developer on their GIS team.

Trevor in Austin

As you may have noticed from a previous post, Trevor is in Austin working with various people to try and get Austin integrated into the bicycle route finder. We met him some time last year (at Vita Cafe on NE Alberta) after he contacted us about the idea of bringing the trip planner with him when he moved back to Austin. He is going to be blogging about the proceedings here, so “stay tuned.”

Personal Sites

In case anyone’s interested (if anyone’s actually reading this), Lauren and I have been working quite a bit on our personal Web sites/blogs, which cover some of our other interests and pursuits outside of byCycle:

In case no one is interested (or reading), uh, well, too bad or whatever. I mean, I just put these links here to boost our page rank anyway. What I really mean is, I put them here in case anyone is interested in more detail about the people who are behind these shenanigans.

Problems with the Trip Planner in the Last Day or So

Our hosting provider moved all our files to a new server–without letting us know before hand that they were going to do so. Most things kept working. A few did not, as you may have noticed.

The reason some things stopped working is, the new server is running a newer version of the operating system and some of the software the trip planner depends on[1] had to be recompiled [reinstalled from source code].

Though I think the upgrade is a good thing overall, I hope they let us know about it before they do it next time!

[1] The MySQL bindings for Python, in case you really wanted to know. I also updated Python from 2.4.3 to 2.4.4, but I don’t know if that was strictly necessary.

Revenue Report: Google Ads

I’m planning to write a longer post about our financial status, but that might take a while, so I thought I’d go ahead and post our Google Ads revenue, in case anyone’s curious. We first added Google Ads to the site on July 1st, 2006. Here are the figures:

  • July: $41.86
  • August: $53.38
  • September: $64.34
  • October: $82.79

It’s not a lot, but it almost covers our monthly server costs. One is $9.95 per month (for our Web site) and the other is $49.00 per month (for hosting the trip planner application). In the future, assuming more and more people are using the trip planner, that second figure could go up into the hundreds and possibly thousands.

Update

We are working on a partnership with Metro that would eliminate our server costs by hosting the trip planner on their servers. This would be tremendously helpful to the project. In addition to reducing costs, it would also make certain technical issues easier to deal with.

Python Cartographic Library (PCL) — Installing Just the Spatial Package

So let’s say you need a spatial geometry library for Python. You could write your own; you could also use the PCL. The PCL includes some packages we don’t need, like one for MapServer rendering. I only installed the minimum needed to get the spatial package working (which I’ll talk about below).

[Note: "geometry" refers to points, lines, polygons and other geometric forms used to represent real-world objects. Examples: intersection (point), street (line), zip code boundary (polygon).]

I wrote a rudimentary geometry library for the trip planner that’s been working fine, but now I need to do some more “advanced” stuff related to using PostGIS and SQLAlchemy. In particular, I want to convert database values to Python objects and vice versa.

The first part (database to Python) is fairly easy and our current library already does that, but it’s convoluted in that it gets the database value as well-known text (WKT), parses that, and creates a Python object. From what I can tell, the PCL can go straight from well-known binary (WKB) geometry to Python objects.

The second part (Python to database) is harder because it involves converting a Python object to a binary geometry value. I don’t know anything about the binary geometry format and I don’t want to know, and it looks like with the PCL I don’t need to know.

I’m assuming PostGIS and PCL will get along together because they both rely on the same libraries, proj4 and geos. We’ll see.

The installation was fairly straightforward. The PCL includes five sub-packages. We had to install two of them, PCL-Referencing and PCL-Spatial. PCL-Referencing requires proj4. PCL-Spatial requires PCL-Referencing and geos >= 2.2.2. Something in there also requires the OGR library, which is included with GDAL.

The basic steps are, install proj, geos, and gdal, then install PCL-Referencing, and lastly install PCL-Spatial. On Ubuntu 6.06 (Dapper), here’s what I actually did:

  • Installed proj4 using apt-get
  • Installed libgdal using apt-get
  • Installed geos 2.2.3 from source into /usr/lib. I installed this over a slightly older version of geos installed using apt-get; hopefully that won’t cause any issues.
  • Checked out the PCL trunk:
    svn co http://svn.gispython.org/gispy/PCL/trunk PCL
  • Installed PCL-Referencing with the usual python setup.py install
  • Installed PCL-Spatial with the usual…

Test Driven Development, PostgreSQL, SQLAlchemy

I just tried out some o’ that new-fangle “Test Driven Development” (TDD) I’ve been hearing about. Yeah, it’s good stuff.

At the moment, I’m in the process of migrating GIS data from MySQL to PostgreSQL so we can take advantage of the PostGIS spatial extensions. I’ve also been making a bunch of related changes (AKA refactoring) in the “model”, separating things that never belonged together, and so forth.

I started out by rewriting the MySQL data import script. [Note: basically, the script pulls data out of a flat ESRI shapefile and normalizes it.] This wasn’t a complete, from-scratch rewrite–a lot of stuff I just copied over and tweaked a little bit. The biggest changes here were due to using SQLAlchemy instead of typing out SQL queries. I’ll just note that SQLAlchemy is “da bomb” and makes many things easier (once you get the hang of it).

That part was pretty straightforward, and low-level–I didn’t get into the ORM aspects of SQLAlchemy at all.

The next step was to modify the routine that creates adjacency matrices for routing. In the end, this was straightforward too. I ended up reusing some stuff from the new import script, which was cool. I refactored a lot during this process, adding some new modules and classes.

[Here's where we get to the TDD aspect.]

So, I was sitting there (here really) thinking, “Hmmm… what now?” I drew some diagrams with the new classes and associations…. OK, that’s fun…. “Wait, I know. Run the unit tests!” Doy!

I started with the address normalization service, since the other services both depend on it. The test suite for this service isn’t as comprehensive as it probably should be (there are 19 tests), but it proved to very useful for shaking out a bunch of bugs in all that refactoring. The tests also helped keep me focused, and that aspect might be more important than the bug-squashing aspect (maybe).

Today, address normalization. Tomorrow, geocoding.

FreekBox

Today we went to Free Geek and picked up a Grant Box. It’s a pretty sweet computer, especially for the price ($0). We received the box through their hardware grant program. Here’s a little about Free Geek from their mission page:

“FREE GEEK is a 501(c)(3) not for profit community organization that recycles used technology to provide computers, education, internet access and job skills training to those in need in exchange for community service.”

The box came with Ubuntu GNU/Linux pre-installed, which is excellent because that’s what I’m running on my development box and on our new virtual private server (which now hosts our project tracker and soon will host a new version of the trip planner).

Our plan for the box is to use it for testing purposes (e.g., browser compatibility) and/or as a staging server before pushing new versions out to production.

Thanks, Free Geek!

PAGIS Presentation Yesterday

The presentation yesterday went great. At least, we thought so. Giving presentations is now fun. I used to be really nervous talking in front of even a few people. Not so much any more (although this hasn’t been extensively tested on a wide variety of audiences).

In school I would just not do oral presentations. I think some of my teachers must have been sympathetic, but I kind of wish they hadn’t been.

I mentioned that I thought someone from the Oregonian would be there yesterday, but as far as I know, there wasn’t. That’s just as well, because we don’t want quite that much publicity just yet.

The presentation can be viewed online here.

Older presentations can be accessed here.

You may need to adjust the text size in your browser to see everything.

Portland Data Update

A couple days ago we updated the Portland region data. This was like a bug-fix release for software–no major changes were made, but a lot of little things here and there were improved and/or fixed.

Related to this (but still quite separate), we improved (hopefully!) the way routes are found. In particular, we made big changes for when the safer option is selected.

Please let us know what you think.