Costa Rica does not run on street addresses. A car is "in Sabalito, past the school", a seller lives in Jabillo, and a buyer wants to know which listings are close enough to drive to. CarShopper, a used-car finder we are building on RapScalYon for Facebook Marketplace listings in Costa Rica, ranked cars by price, make and model, but it had no idea where anything was. We fixed that in about an hour (one hour and ten minutes, to be exact, including a pause for a human go-ahead). The useful part came out as a reusable pack.
The ask
The owner wanted the search form to use the real Costa Rican hierarchy (Provincia, Cantón, Distrito), plus a "Use my current location" button on the phone version, and results ranked by distance. The question that started the work was whether we already had real geocoding of the place names, and whether RapScalYon should have a pack for it:
Ok, do we have anything like real geocoding of these place names? Should we have a geocoder pack in RapScalYon?
Before answering, the owner reordered the work in one line, which turned out to be the best decision of the session:
Your questions are slightly out of order. Pull the Coto Brus place list from OSM first so we can see what coordinates it has, before we decide :)
One hour and ten minutes from question to production, which is about an hour in marketing and exactly 70 minutes in the session log. Times are Costa Rica time:
- 07:16 — The question: do we have real geocoding, and should there be a pack?
- 07:21 — The reorder: pull the Coto Brus list from OpenStreetMap first.
- 07:39 — Places pack and location feature built, tested and committed (23 minutes after the question).
- 07:53 — Go-ahead given for the production database, after a 12-minute pause.
- 08:26 — Both packs installed, pushed, deployed and live (1 hour 10 minutes after the question).
The steps below are in order, not individually timed.
The clock, honestly
- Pull the Coto Brus place list from OpenStreetMap first, to see what coordinates it really has. 541 points came back, including the 102 towns and villages we needed.
- Decide, with that data in hand, that this is a pack and not CarShopper code: a place directory with fuzzy name search, nearest-place from a GPS point, the place named inside free text, and distance in kilometres.
- Build the places pack: tables, search, row-level security, rollback and tests. At this scale plain SQL haversine is enough; no PostGIS, no map API, no per-lookup cost.
- Extend the used-car pack (items-matching-ranking 0.12.0): the searcher's home point, each car's location, a distance part in the fit score, and a "travel" must-have that hides only a car known to be too far.
- Teach the worker to locate each car, from the Facebook pin when there is one and otherwise from the town named in the listing text.
- Add the Provincia / Cantón / Distrito lists and the current-location button to the guided search and the Scoreboard, with a km and town label on every car.
- Run the full test suite, install both packs on the hosted database, push and deploy. 132 of the 245 cars we already held now have coordinates.
The new pack: places
places is a small, AGPL-licensed RapScalYon pack. It stores Provincia, Cantón, Distrito and town records, tolerates typos and missing accents in names, and offers four SQL functions: search, resolve a place from free text, nearest place to a point, and distance. It is read-only reference data behind row-level security and the sign-in gate, and place data is credited to OpenStreetMap contributors (ODbL). A tool loads any canton with one command, so the next canton is minutes of work rather than a new project. Anything else you build on RapScalYon that needs "near me" can require it.
What is not perfect
We would rather you hear it from us.
- Only Coto Brus is loaded. A car in any other canton has no location until that canton is loaded, and it is never hidden by a travel limit while it has none.
- Distance is a straight line, not road distance. In the mountains those differ a lot.
- Jabillo is a real village in Cantón Coto Brus, but we do not know its Distrito, so it is filed under a neighbouring district for now. Province and canton points are rough centres used only as labels.
- Matching a town in free text can hit a common word. It prefers the longest whole-word match and the one nearest the buyer, but it is a heuristic.
- 113 of our 245 cars still have no location because their listings never name a town. The 100 demo cars in the system are labelled as samples.
- We have not yet tested the location button on a range of real phones.
Why it matters
The pack pattern did its job. A new need arrived mid-conversation, and instead of a one-off patch in one product it became a tested, documented, removable piece with a rollback that any RapScalYon app can install. That is the point of the framework: the second product that wants "near me" starts from a working pack, not a blank page.