Database error using geolocation functions

I'm using the built-in geolocation functions in /engine/lib/location.php to search for entities within a radius.  I think I've formatted the function call correctly, but I get a database error when it runs.

I do have the geolocation module installed and enabled with a Google Maps API key.  Here's what I'm doing in my module:

$geocode = elgg_geocode_location($location);

$nearby = get_entities_in_area($geocode['lat'], $geocode['long'], 20 * MILE, 'object', 'checkpoint');

elgg_geocode_location() does return a valid coordinate pair for its input, but the second instruction results in a database exception.  If I comment out the second instruction, the error doesn't occur.

Has anyone seen anything like this before, or can someone testify that they have successfully used this function so I can be sure it's my error and not a bug in Elgg?

This is the database exception information that comes up when I load the page:


Unknown column 'n.calendar_start' in 'order clause'

QUERY: SELECT e.* from elgg_entities e
JOIN elgg_metadata loc_start on e.guid=loc_start.entity_guid
JOIN elgg_metastrings loc_start_name on
JOIN elgg_metastrings loc_start_value on

JOIN elgg_metadata loc_end on e.guid=loc_end.entity_guid
JOIN elgg_metastrings loc_end_name on
JOIN elgg_metastrings loc_end_value on
where e.type='object' and e.subtype=5 and e.site_guid = 1 and loc_start_name.string='geo:lat' and loc_start_value.string>=40.3080589 and loc_start_value.string<=40.9140589 and loc_end_name.string='geo:long' and loc_end_value.string >= -112.2029353 and loc_end_value.string <= -111.5969353 and ( (1 = 1) and e.enabled='yes') order by n.calendar_start limit 0, 10