@proximap/core 1.0.0 → 1.0.1
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/dist/index.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -968,6 +968,6 @@ declare class DatasetPlacesProvider implements PlacesProvider {
|
|
|
968
968
|
* stage is pluggable via the provider interfaces in {@link ./types}.
|
|
969
969
|
*/
|
|
970
970
|
/** Library version, kept in sync with package.json. */
|
|
971
|
-
declare const VERSION = "1.0.
|
|
971
|
+
declare const VERSION = "1.0.1";
|
|
972
972
|
|
|
973
973
|
export { CATEGORIES, CATEGORY_LABELS, type Categorization, type Category, type CategoryGap, type CategoryScore, type CategorySelector, type CategoryWeight, type CompareOptions, type ComparisonReport, DEFAULT_DAILY_NEEDS, DEFAULT_USER_AGENT, DEFAULT_WALK_CATEGORIES, DatasetPlacesProvider, type DimensionWinner, type DisambiguateOptions, type Disambiguation, type ErrandOptions, type ErrandPlan, type ErrandStop, type FacetFilters, type FacetPredicate, type FindNearbyOptions, type GapOptions, type GapReport, type GeoJsonFeature, type GeoJsonFeatureCollection, type GeocodeOptions, type GeocodingProvider, HaversineRoutingProvider, HttpError, InMemoryCache, type LatLng, type LocationScore, MODE_SPEED_MPS, type NearbyOptions, type NearbyResult, type NearestMatch, NominatimGeocoder, type NominatimOptions, ODBL_ATTRIBUTION, type OpenState, type OpeningEvaluation, type OsrmOptions, OsrmRoutingProvider, type OverpassOptions, OverpassPlacesProvider, type Place, type PlacesProvider, type Poi, type PolygonRing, type RankOptions, type RankedLocation, type RankedPoi, RateLimiter, type ReachableOptions, type ReachableResult, type RequestCache, type RequestOptions, type ResolveOriginOptions, type ResolvedCategories, type RouteMetric, type RoutingProvider, type RoutingRequestOptions, type ScoreInput, type SnapshotDataset, type SnapshotOptions, type TravelMode, VERSION, type ValhallaOptions, ValhallaRoutingProvider, type WalkabilityDecay, type WalkabilityOptions, type WalkabilityReport, accessibleScorer, buildOverpassQuery, buildTargetedOverpassQuery, categorize, categoryVocabulary, circlePolygon, compareLocations, compileFacets, completenessOf, dedupePois, detectGaps, disambiguateLocation, findNearbyAmenities, formatDistance, formatDuration, haversineMeters, isCategory, isKnownTerm, isOpenAt, lastVerifiedOf, matchesFacets, nearestMatchingPoi, parseCoordinates, planErrands, pointInPolygon, rankByProximity, reachableAmenities, requestJson, resolveCategories, resolveOrigin, selectorToOverpassFilter, snapshotArea, suggestCategories, tagsMatchAnySelector, tagsMatchSelector, toCSV, toGeoJSON, walkSubScore, walkabilityScore };
|
package/dist/index.d.ts
CHANGED
|
@@ -968,6 +968,6 @@ declare class DatasetPlacesProvider implements PlacesProvider {
|
|
|
968
968
|
* stage is pluggable via the provider interfaces in {@link ./types}.
|
|
969
969
|
*/
|
|
970
970
|
/** Library version, kept in sync with package.json. */
|
|
971
|
-
declare const VERSION = "1.0.
|
|
971
|
+
declare const VERSION = "1.0.1";
|
|
972
972
|
|
|
973
973
|
export { CATEGORIES, CATEGORY_LABELS, type Categorization, type Category, type CategoryGap, type CategoryScore, type CategorySelector, type CategoryWeight, type CompareOptions, type ComparisonReport, DEFAULT_DAILY_NEEDS, DEFAULT_USER_AGENT, DEFAULT_WALK_CATEGORIES, DatasetPlacesProvider, type DimensionWinner, type DisambiguateOptions, type Disambiguation, type ErrandOptions, type ErrandPlan, type ErrandStop, type FacetFilters, type FacetPredicate, type FindNearbyOptions, type GapOptions, type GapReport, type GeoJsonFeature, type GeoJsonFeatureCollection, type GeocodeOptions, type GeocodingProvider, HaversineRoutingProvider, HttpError, InMemoryCache, type LatLng, type LocationScore, MODE_SPEED_MPS, type NearbyOptions, type NearbyResult, type NearestMatch, NominatimGeocoder, type NominatimOptions, ODBL_ATTRIBUTION, type OpenState, type OpeningEvaluation, type OsrmOptions, OsrmRoutingProvider, type OverpassOptions, OverpassPlacesProvider, type Place, type PlacesProvider, type Poi, type PolygonRing, type RankOptions, type RankedLocation, type RankedPoi, RateLimiter, type ReachableOptions, type ReachableResult, type RequestCache, type RequestOptions, type ResolveOriginOptions, type ResolvedCategories, type RouteMetric, type RoutingProvider, type RoutingRequestOptions, type ScoreInput, type SnapshotDataset, type SnapshotOptions, type TravelMode, VERSION, type ValhallaOptions, ValhallaRoutingProvider, type WalkabilityDecay, type WalkabilityOptions, type WalkabilityReport, accessibleScorer, buildOverpassQuery, buildTargetedOverpassQuery, categorize, categoryVocabulary, circlePolygon, compareLocations, compileFacets, completenessOf, dedupePois, detectGaps, disambiguateLocation, findNearbyAmenities, formatDistance, formatDuration, haversineMeters, isCategory, isKnownTerm, isOpenAt, lastVerifiedOf, matchesFacets, nearestMatchingPoi, parseCoordinates, planErrands, pointInPolygon, rankByProximity, reachableAmenities, requestJson, resolveCategories, resolveOrigin, selectorToOverpassFilter, snapshotArea, suggestCategories, tagsMatchAnySelector, tagsMatchSelector, toCSV, toGeoJSON, walkSubScore, walkabilityScore };
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ function haversineMeters(a2, b) {
|
|
|
33
33
|
}
|
|
34
34
|
function formatDistance(meters) {
|
|
35
35
|
if (!Number.isFinite(meters) || meters < 0) return "\u2014";
|
|
36
|
-
if (meters < 1e3) return `${Math.round(meters)} m`;
|
|
36
|
+
if (Math.round(meters) < 1e3) return `${Math.round(meters)} m`;
|
|
37
37
|
const km = meters / 1e3;
|
|
38
38
|
return `${km < 10 ? km.toFixed(1) : Math.round(km)} km`;
|
|
39
39
|
}
|
|
@@ -639,6 +639,7 @@ function hasUnsupported(s) {
|
|
|
639
639
|
}
|
|
640
640
|
function buildSegments(input) {
|
|
641
641
|
const own = new Array(7).fill(void 0);
|
|
642
|
+
let applied = false;
|
|
642
643
|
for (const rulePart of input.split(";")) {
|
|
643
644
|
const rule = rulePart.trim();
|
|
644
645
|
if (!rule) continue;
|
|
@@ -646,7 +647,9 @@ function buildSegments(input) {
|
|
|
646
647
|
if (parsed === "unknown") return null;
|
|
647
648
|
if (parsed === null) continue;
|
|
648
649
|
for (const day of parsed.days) own[day] = parsed.intervals;
|
|
650
|
+
applied = true;
|
|
649
651
|
}
|
|
652
|
+
if (!applied) return null;
|
|
650
653
|
const segments = Array.from({ length: 7 }, () => []);
|
|
651
654
|
for (let day = 0; day < 7; day++) {
|
|
652
655
|
const intervals = own[day];
|
|
@@ -1170,7 +1173,7 @@ var OsrmRoutingProvider = class {
|
|
|
1170
1173
|
var clamp01 = (n) => Math.min(1, Math.max(0, n));
|
|
1171
1174
|
function defaultScorer(weights) {
|
|
1172
1175
|
return ({ poi, distanceMeters, radiusMeters }) => {
|
|
1173
|
-
const proximity = 1 - clamp01(distanceMeters / radiusMeters);
|
|
1176
|
+
const proximity = 1 - clamp01(distanceMeters / Math.max(radiusMeters, 1));
|
|
1174
1177
|
const completeness = poi.name ? 0.05 : 0;
|
|
1175
1178
|
const weight = weights?.[poi.category] ?? 1;
|
|
1176
1179
|
return (proximity + completeness) * weight;
|
|
@@ -1285,10 +1288,10 @@ function matchesFacets(tags, predicates) {
|
|
|
1285
1288
|
var clamp012 = (n) => Math.min(1, Math.max(0, n));
|
|
1286
1289
|
function accessibleScorer() {
|
|
1287
1290
|
return ({ poi, distanceMeters, radiusMeters }) => {
|
|
1288
|
-
const proximity = 1 - clamp012(distanceMeters / radiusMeters);
|
|
1291
|
+
const proximity = 1 - clamp012(distanceMeters / Math.max(radiusMeters, 1));
|
|
1289
1292
|
const wheelchair = (poi.tags.wheelchair ?? "").toLowerCase();
|
|
1290
1293
|
const tierBase = wheelchair === "yes" ? 0.66 : wheelchair === "limited" ? 0.33 : 0;
|
|
1291
|
-
return tierBase + proximity * 0.
|
|
1294
|
+
return tierBase + proximity * 0.32;
|
|
1292
1295
|
};
|
|
1293
1296
|
}
|
|
1294
1297
|
|
|
@@ -1551,7 +1554,9 @@ async function reachableAmenities(query, options) {
|
|
|
1551
1554
|
const ranked = {
|
|
1552
1555
|
...entry.poi,
|
|
1553
1556
|
distanceMeters: haversineMeters(origin.location, entry.poi.location),
|
|
1554
|
-
|
|
1557
|
+
// Clamp to [0, 1]: an isochrone can enclose a POI whose matrix travel
|
|
1558
|
+
// time still exceeds the budget, which would otherwise score negative.
|
|
1559
|
+
score: entry.metric ? Math.max(0, Math.round((1 - entry.metric.seconds / budgetSeconds) * 100) / 100) : 0,
|
|
1555
1560
|
rank: index + 1
|
|
1556
1561
|
};
|
|
1557
1562
|
if (entry.metric) {
|
|
@@ -2077,7 +2082,7 @@ var DatasetPlacesProvider = class {
|
|
|
2077
2082
|
};
|
|
2078
2083
|
|
|
2079
2084
|
// src/index.ts
|
|
2080
|
-
var VERSION = "1.0.
|
|
2085
|
+
var VERSION = "1.0.1";
|
|
2081
2086
|
export {
|
|
2082
2087
|
CATEGORIES,
|
|
2083
2088
|
CATEGORY_LABELS,
|