Store Locators & Nearby Search
Public maps know streets and cities, but your users want to find your locations — the closest retail store, fulfillment warehouse, EV supercharger, clinic, or pickup locker to their home address or current GPS coordinates.
With texspace, you load your own private location list directly alongside the global map. Your sites immediately show up in address search, autocomplete, and reverse lookups (complete with your custom metadata like store hours, dock doors, or available stalls), and you can run plain-English proximity searches like "warehouses within 2km of 4865 Mission St, San Francisco" — without ever uploading proprietary store data to a third-party search service.
What this solves#
- Customer store & branch finders: Let visitors type any street address, neighborhood, or postal code — even with typos — and immediately rank your nearest branches by exact distance and compass direction.
- Logistics & dispatch matching: Given a customer's delivery address, locate the closest fulfillment warehouse or service depot carrying the right capability (
properties.cold_storage,properties.dock_doors). - Private site search in your existing search box: Type
"Acme Palo Alto Superhub"or"WH-01"into the same geocoder that resolves public addresses, and get unified ranked results. - Public transit & landmark proximity: Works out of the box without any custom data too — ask for
"stations within 2km of 10 Downing Street, London"or"parks near Golden Gate Bridge".
Quick Example: Mount Private Locations & Search Nearby#
import { Texspace } from "texspace";
const geo = await Texspace.open("https://shards.texspace.dev/txg/v2");
// 1. Load your private locations right in browser memory (no build step needed)
geo.mountGeoJSON("acme", {
type: "FeatureCollection",
features: [
{
type: "Feature",
id: "WH-SF-01",
properties: {
name: "Acme Excelsior Fulfillment Center",
category: "warehouse",
address: "4850 Mission St, San Francisco, CA",
dock_doors: 12,
cold_storage: true,
},
geometry: { type: "Point", coordinates: [-122.4371, 37.7209] },
},
{
type: "Feature",
id: "EV-PA-02",
properties: {
name: "Acme Palo Alto Superhub",
category: "charger",
address: "2750 Middlefield Rd, Palo Alto, CA",
stalls: 16,
max_kw: 350,
},
geometry: { type: "Point", coordinates: [-122.1325, 37.4342] },
},
],
});
// 2. Search your private locations by name or ID right alongside public addresses
const hit = await geo.search("Acme Excelsior Fulfillment Center");
console.log(hit.results[0].properties?.dock_doors); // 12
// 3. Find the closest warehouses to any customer address in plain English
const near = await geo.nearby(
"warehouses within 2km of 4865 Mission St, San Francisco, CA 94112",
{ limit: 5 }
);
console.log(near.results[0]);
// {
// name: "Acme Excelsior Fulfillment Center",
// distance_m: 68.1,
// bearing_deg: 45.4,
// shard_id: "overlay:acme",
// properties: { dock_doors: 12, cold_storage: true }
// }Three demo Acme locations (a San Francisco warehouse, a Palo Alto EV superhub, and a London flagship store) are mounted in browser memory alongside 450M global public places.
// Output appears here (includes exact distance_m, bearing_deg, and custom properties)
Two Ways to Load Your Locations#
Option 1: Load Directly in Memory (Best for up to ~50,000 sites)#
If your app already fetches a GeoJSON file or JSON array of stores, pass it directly to geo.mountGeoJSON(name, featureCollection) or geo.mountOverlay(name, sites). Non-point shapes (Polygon / MultiPolygon) automatically index at their centroid, and calling mountGeoJSON again with the same name cleanly replaces the dataset.
// Plain array alternative to GeoJSON
geo.mountOverlay("depots", [
{
id: "DEP-01",
name: "North Bay Depot",
category: "depot",
address: "100 Harbor Way, San Rafael, CA",
lat: 37.9735,
lon: -122.5311,
properties: { fleet_size: 42 },
},
]);
// Remove when switching tenants or clearing filters
geo.unmountOverlay("depots");Option 2: Package a Large Catalog as a Static File (10k–1M+ sites)#
When your store or charger directory is too large to send upfront as JSON, convert your CSV, TSV, or GeoJSON once using the CLI and host the output file on S3, Cloudflare R2, or any static CDN:
id,name,category,address,lat,lon,hours,stalls
WH-01,Acme Mission Warehouse,warehouse,"4850 Mission St, San Francisco, CA",37.7209,-122.4371,24/7,0
EV-02,Acme Palo Alto Superhub,charger,"2750 Middlefield Rd, Palo Alto, CA",37.4342,-122.1325,06:00-23:00,16texspace pack-overlay \
--input stores.csv \
--name acme_stores \
--out acme_stores.txgThen connect that hosted file when opening texspace:
const geo = await Texspace.open("https://shards.texspace.dev/txg/v2", {
overlays: ["https://cdn.example.com/overlays/acme_stores.txg"],
});Every column besides lat/lon is automatically preserved inside result.properties.
Searching Around Known GPS Coordinates#
When you already have the user's latitude and longitude (for example from navigator.geolocation), pass them directly to skip address resolution. Set includePlanet: false to search strictly across your private locations with zero public map reads:
const chargers = await geo.nearby({
lat: 37.4342,
lon: -122.1325,
radius_m: 10_000,
category: "charger",
includePlanet: false,
includeOverlays: true,
limit: 10,
});Supported Nearby Phrases & Categories#
geo.nearby() understands natural distance phrasing including within 2km of, within 5 miles of, 500m from, near, around, and close to. Common category keywords automatically expand to sensible synonyms on word boundaries (so "train" never falsely matches "training"):
| Category / Keyword | Also Matches |
|---|---|
warehouse, depot, hub | warehouse, depot, fulfillment, distribution, hub, logistics |
charger, ev, supercharger | charger, charging, supercharger, ev |
store, shop, branch | store, shop, market, flagship, branch, retail |
station, transit, metro, tube | station, underground, metro, subway, rail, train, bart, caltrain, gare, bahnhof, terminal |
hospital, clinic, medical | hospital, medical, clinic, health, infirmary |
park, garden | park, garden, gardens, plaza, square, reserve |
school, university, college | school, academy, college, university, campus, institute |
coffee, cafe | coffee, cafe, espresso, roasters |
Any other custom word (such as "pharmacy", "museum", or "locker") matches directly against your site names, categories, addresses, and IDs.
Go Deeper#
- JavaScript & TypeScript SDK Reference — Exact
nearby(),mountGeoJSON(), andaddOverlay()options and return types. - Hosting & Deployment — Bucket CORS rules for hosting your own private static overlay files.
- How It Works Under the Hood — Spatial indexing & overlay binary specification.