The pitch for the feature was simple: let users drag a map, draw a rough search area, and see listings inside it. The complication showed up the moment we priced it out. At the traffic volumes a growing proptech product actually sees, Google Maps' per-load pricing stopped being a rounding error and started being a real line item — and in several of the neighborhoods we cared about most, the map data itself was thin: missing roads, unnamed streets, buildings that didn't exist on the map at all. Paying more for coverage that wasn't there wasn't a trade we were willing to make twice.
| Google Maps Platform | OpenStreetMap stack | |
|---|---|---|
| Cost model | Pay per request | Hosting and engineering time |
| Map data | Closed | Open, and you can correct it |
| Setup | Fast | Slower |
| Upkeep | Handled for you | Yours: tiles, data updates, geocoder |
| Best for | Low traffic, or places with strong coverage | High traffic, or places with thin coverage |
The Google Maps alternative we built with OpenStreetMap
We rebuilt the mapping layer on open data instead of a metered API:
- Tiles and rendering: MapLibre GL for the client, serving vector tiles generated from OpenStreetMap extracts instead of a hosted, per-load provider. Self-hosting tiles turned an unpredictable per-request cost into a flat infrastructure cost.
- Geocoding: Nominatim, self-hosted against a regional OSM extract, for turning addresses into coordinates. Coverage still had gaps, but they were gaps we could see and patch, not a black box.
- Spatial search: PostGIS on top of Postgres, indexed with GiST, for "find listings inside this polygon" queries — the actual query behind drag-to-search.
- Area indexing: H3 hexagonal indexing for aggregating listings into search regions, so "how many listings in this area" didn't mean scanning every row on every map pan.
-- listings inside a user-drawn search polygon
SELECT id, title, price
FROM listings
WHERE ST_Within(
location,
ST_GeomFromGeoJSON(:search_polygon)
);Geocoding without reliable addresses
The map rendering and the spatial query were the easy half. The hard half was that a meaningful share of listings didn't have an address that any geocoder — ours or Google's — could resolve cleanly. Many properties are described relative to a landmark ("second gate past the blue church") rather than a street address, because that's how the neighborhood actually navigates, address plates or not.
Forcing agents to type a formal address produced garbage coordinates, because they'd guess. What worked instead was flipping the input around: let the agent drop a pin directly on the map at the property's real location, and treat that pin as the source of truth. Geocoding ran in the background only to generate a human-readable label for display — never to determine where the listing actually showed up in a search. The map became the primary key for location; the address became decoration.
Handling sparse OpenStreetMap road data
Where OSM road coverage was thin, straight-line "as the crow flies" distance was a more honest default than routing through a road network that might not be mapped yet. We showed straight-line distance with a visual indicator that it was approximate, rather than presenting a driving-distance number computed against incomplete road data that would look precise and be wrong. An honest approximation beat a confident, broken calculation.
What this bought us
Dropping a metered map API removed a cost that scaled with usage in a business where usage growth is the entire point. More importantly, treating OSM data as something we could inspect and patch — instead of a paid black box — meant that coverage gaps became a backlog item instead of a permanent limitation. We still contribute fixes back to OSM in areas we operate, because every correction we make is a correction every other OSM-based product in the region also gets for free.
The lesson that generalized past this one project: in markets that mapping providers treat as an afterthought, the "convenient" managed API is often the one with the worst underlying data. Open, self-hosted, and inspectable can be the more reliable choice, not just the cheaper one.
Making the PostGIS area search fast
The query above is only quick with a spatial index. Without one, every map drag checks every listing:
CREATE INDEX listings_location_idx
ON listings
USING GIST (location);PostGIS uses the index to discard listings outside the polygon's bounding box, then runs the exact ST_Within test on what is left. It is the same principle as a vector index: look at a small part of the data first, then be precise.
What you take on when you leave Google Maps
Open data is not free of work. Plan for these before you switch:
- Map updates. Tiles come from an extract that ages. Decide how often to rebuild it.
- Geocoding limits. The public Nominatim server allows at most one request per second and forbids autocomplete. A product needs its own.
- Attribution. OpenStreetMap data must be credited on the map.
- Missing extras. Street-level photos, live traffic and business listings do not come with it.
If your traffic is low and the coverage is good where you operate, a paid API is the cheaper choice. The switch makes sense when usage grows, or when the paid map is wrong where your customers are.