- src/lib/search.ts: dependency-free fuzzy search engine that matches POIs and zones by name/address with text normalization (st->street, compass words), substring + Levenshtein fuzzy matching, and field-aware ranking - MapView.svelte: builds a searchable index from loaded layers, adds a search box that shows ranked results, pans/zooms + opens popup on select, and renders dedicated popup rows for address, Facing (compass), and Field of view - custom-layers.mjs: documents optional address / bearing / fov POI fields with examples; osm-data.mjs normalizes bearing (compass point or degrees) into degrees and carries the new properties through to GeoJSON - README: documents POI data fields and the search feature
128 lines
4.1 KiB
JavaScript
128 lines
4.1 KiB
JavaScript
/**
|
|
* Custom Layers Configuration
|
|
* ===========================
|
|
* Define your own map layers here — **zones** (polygons/areas) and
|
|
* **points of interest** (POIs). These are bundled into the static build
|
|
* alongside the Overpass OSM data.
|
|
*
|
|
* This file is meant to be edited by hand. To add features, just append
|
|
* to the `features` array of an existing layer, or add a whole new layer.
|
|
*
|
|
* Each layer needs:
|
|
* - id unique slug (used for the output filename)
|
|
* - name human-readable name shown in the UI
|
|
* - layerType 'zone' or 'poi'
|
|
* - color hex color used for the marker/fill
|
|
* - features array of feature objects (see below)
|
|
*
|
|
* Feature format (by layerType):
|
|
* POI (point):
|
|
* { name, desc?, address?, bearing?, fov?, lon, lat }
|
|
*
|
|
* Zone (polygon — list the corner points; it is closed automatically):
|
|
* { name, desc?, polygon: [[lon,lat], [lon,lat], ...] }
|
|
*
|
|
* Coordinates are [longitude, latitude] (lon first, like GeoJSON).
|
|
* All fields except POI `lon`/`lat` (or zone `polygon`) and `name` are optional.
|
|
*
|
|
* Optional POI fields:
|
|
* - address street address / place description
|
|
* - bearing compass direction the POI faces. Accepts a compass point
|
|
* ('N','NNE','NE',...) OR a numeric bearing in degrees (0-360,
|
|
* 0 = north, 90 = east) OR a 16-point rose ('NE-by-N', etc).
|
|
* - fov field of view in degrees (how wide the view / coverage is).
|
|
*/
|
|
|
|
export const CUSTOM_LAYERS = [
|
|
// -------------------------------------------------------------------------
|
|
// EXAMPLE — Points of Interest
|
|
// A few spots around downtown Tulsa. Replace / extend as you like.
|
|
// -------------------------------------------------------------------------
|
|
{
|
|
id: 'my-places',
|
|
name: 'My Places',
|
|
layerType: 'poi',
|
|
color: '#e11d48',
|
|
features: [
|
|
{
|
|
name: 'BOK Center',
|
|
desc: 'Arena & events',
|
|
address: '100 W 5th St, Tulsa, OK 74103',
|
|
lon: -95.9966,
|
|
lat: 36.1498
|
|
},
|
|
{
|
|
name: 'Philbrook Museum',
|
|
desc: 'Art museum & gardens',
|
|
address: '2727 S Rockford Rd, Tulsa, OK 74114',
|
|
lon: -95.9747,
|
|
lat: 36.1258
|
|
},
|
|
{
|
|
name: 'Gathering Place',
|
|
desc: 'Riverside park',
|
|
address: '2650 S John Williams Way E, Tulsa, OK 74114',
|
|
bearing: 'SE', // bearing + fov optional
|
|
fov: 140,
|
|
lon: -95.9791,
|
|
lat: 36.1098
|
|
},
|
|
{
|
|
name: 'Woodward Park',
|
|
desc: 'Rose garden',
|
|
address: '2435 S Peoria Ave, Tulsa, OK 74114',
|
|
bearing: 10, // numeric bearing also accepted (degrees)
|
|
lon: -95.9792,
|
|
lat: 36.1334
|
|
}
|
|
]
|
|
},
|
|
|
|
// -------------------------------------------------------------------------
|
|
// EXAMPLE — Zones
|
|
// A few neighborhood / district boundaries. Add your own as polygons.
|
|
// -------------------------------------------------------------------------
|
|
{
|
|
id: 'districts',
|
|
name: 'Districts',
|
|
layerType: 'zone',
|
|
color: '#0ea5e9',
|
|
features: [
|
|
{
|
|
name: 'Downtown Tulsa',
|
|
desc: 'Rough downtown core',
|
|
polygon: [
|
|
[-96.0000, 36.1300],
|
|
[-95.9900, 36.1300],
|
|
[-95.9900, 36.1600],
|
|
[-96.0000, 36.1600]
|
|
]
|
|
},
|
|
{
|
|
name: 'Cherry Street',
|
|
desc: 'Shopping & dining district',
|
|
polygon: [
|
|
[-95.9850, 36.1200],
|
|
[-95.9750, 36.1200],
|
|
[-95.9750, 36.1280],
|
|
[-95.9850, 36.1280]
|
|
]
|
|
}
|
|
]
|
|
},
|
|
|
|
// -------------------------------------------------------------------------
|
|
// TEMPLATE — copy this block to add a new layer
|
|
// -------------------------------------------------------------------------
|
|
// {
|
|
// id: 'your-layer',
|
|
// name: 'Your Layer',
|
|
// layerType: 'poi', // or 'zone'
|
|
// color: '#22c55e',
|
|
// features: [
|
|
// { name: 'Example point', desc: '...', address: '1 Main St',
|
|
// bearing: 'N', fov: 90, lon: -95.7, lat: 36.1 },
|
|
// { name: 'Example zone', desc: '...', polygon: [[-95.7, 36.1], [-95.6, 36.1], [-95.6, 36.2], [-95.7, 36.2]] }
|
|
// ]
|
|
// }
|
|
]; |