@proximap/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ameya Borkar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @proximap/core
2
+
3
+ Geospatial engine for [proximap](https://github.com/AmeyaBorkar/proximap):
4
+ geocoding, nearby search, travel-time ranking, walkability, gap detection,
5
+ reachability, location comparison, and errand planning. OpenStreetMap by default
6
+ (no API keys), with pluggable geocoding / places / routing providers. Zero runtime
7
+ dependencies.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @proximap/core
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { findNearbyAmenities } from '@proximap/core';
19
+
20
+ const { origin, results } = await findNearbyAmenities('Brandenburg Gate, Berlin', {
21
+ radiusMeters: 800,
22
+ categories: ['food', 'transport'],
23
+ limit: 15,
24
+ });
25
+
26
+ console.log(origin.displayName);
27
+ for (const r of results) {
28
+ console.log(`#${r.rank} ${r.name ?? r.category} — ${r.distanceMeters} m`);
29
+ }
30
+ ```
31
+
32
+ ### Bring your own provider
33
+
34
+ ```ts
35
+ import { findNearbyAmenities, type PlacesProvider } from '@proximap/core';
36
+
37
+ const myProvider: PlacesProvider = {
38
+ name: 'my-source',
39
+ async findNearby(center, options) {
40
+ /* return Poi[] */
41
+ },
42
+ };
43
+
44
+ await findNearbyAmenities('Tokyo Station', { places: myProvider });
45
+ ```
46
+
47
+ `findNearbyAmenities` also takes `filters` (diet/payment/wifi/wheelchair…),
48
+ `accessible` (step-free-first ranking), `open` (`'now'` or `{ at }`, keeping
49
+ unknown-hours places labelled rather than dropped), `rankBy: 'travelTime'` with a
50
+ `routing` engine, and `explain` (a short `rankingReason` per result).
51
+
52
+ ### Beyond "what's nearby"
53
+
54
+ ```ts
55
+ import {
56
+ detectGaps,
57
+ walkabilityScore,
58
+ reachableAmenities,
59
+ compareLocations,
60
+ planErrands,
61
+ disambiguateLocation,
62
+ } from '@proximap/core';
63
+
64
+ // What everyday amenities are missing? (absence framed as "not found in OSM")
65
+ const gaps = await detectGaps('Brandenburg Gate, Berlin', { thresholdMeters: 1000 });
66
+
67
+ // How walkable is it? 0-100 with a transparent, tunable breakdown + confidence.
68
+ const walk = await walkabilityScore('Brandenburg Gate, Berlin');
69
+
70
+ // What's within a 15-minute walk? (real isochrone where available)
71
+ const reach = await reachableAmenities('Brandenburg Gate, Berlin', { within: 15, mode: 'walk' });
72
+
73
+ // Compare neighbourhoods; plan the shortest one-per-category errand trip.
74
+ const cmp = await compareLocations(['Prenzlauer Berg, Berlin', 'Marzahn, Berlin']);
75
+ const trip = await planErrands('Alexanderplatz, Berlin', { categories: ['pharmacy', 'atm', 'grocery'] });
76
+
77
+ // Don't guess a wrong location — surface candidates when a name is ambiguous.
78
+ const geo = await disambiguateLocation('Springfield'); // → { ambiguous, best, candidates }
79
+ ```
80
+
81
+ ### Offline & export
82
+
83
+ ```ts
84
+ import { snapshotArea, DatasetPlacesProvider, toGeoJSON } from '@proximap/core';
85
+
86
+ const dataset = await snapshotArea('Montmartre, Paris', { radiusMeters: 1500 });
87
+ const offline = new DatasetPlacesProvider(dataset); // findNearby with no network
88
+ const fc = toGeoJSON(await findNearbyAmenities('48.8867,2.3431', { places: offline }));
89
+ ```
90
+
91
+ ### Bring your own provider
92
+
93
+ ```ts
94
+ import { findNearbyAmenities, type PlacesProvider, type RoutingProvider } from '@proximap/core';
95
+ // Implement PlacesProvider / GeocodingProvider / RoutingProvider and pass via
96
+ // findNearbyAmenities(query, { places, geocoder, routing }).
97
+ ```
98
+
99
+ Also exported: providers (`NominatimGeocoder`, `OverpassPlacesProvider`,
100
+ `ValhallaRoutingProvider`, `OsrmRoutingProvider`, `HaversineRoutingProvider`),
101
+ `rankByProximity`, `nearestMatchingPoi`, `isOpenAt`, `toGeoJSON`/`toCSV`,
102
+ `pointInPolygon`, `categorize`, `haversineMeters`, `formatDistance`,
103
+ `formatDuration`, `CATEGORIES`, and the domain types. See the
104
+ [main README](https://github.com/AmeyaBorkar/proximap#readme).
105
+
106
+ ## License
107
+
108
+ MIT