@chrtco/sdk 0.10.4 → 0.10.5
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 +59 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +178 -1
- package/dist/index.d.ts +178 -1
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1040,6 +1040,158 @@ interface MarineForecastResponse {
|
|
|
1040
1040
|
attribution: string;
|
|
1041
1041
|
disclaimer: string;
|
|
1042
1042
|
}
|
|
1043
|
+
/**
|
|
1044
|
+
* One gazetteer hit.
|
|
1045
|
+
*
|
|
1046
|
+
* A hit is a PLACE, not a feature: a point, an extent, and the identity you
|
|
1047
|
+
* need to go and fetch the feature itself. If you want geometry, follow `lnam`
|
|
1048
|
+
* and `cell_id` into `features()` or CHRTinteract.
|
|
1049
|
+
*/
|
|
1050
|
+
interface SearchHit {
|
|
1051
|
+
/** The `OBJNAM` verbatim, exactly as the hydrographic office charted it. */
|
|
1052
|
+
name: string;
|
|
1053
|
+
/**
|
|
1054
|
+
* A point GUARANTEED to lie inside real charted geometry carrying this name.
|
|
1055
|
+
*
|
|
1056
|
+
* Not a bbox centroid, and not a polygon centroid either — a centroid can
|
|
1057
|
+
* fall outside a concave area entirely, or inside a different, smaller
|
|
1058
|
+
* feature. Safe to fly a camera to.
|
|
1059
|
+
*/
|
|
1060
|
+
lon: number;
|
|
1061
|
+
lat: number;
|
|
1062
|
+
/**
|
|
1063
|
+
* `[west, south, east, north]`, unioned across every charted instance of this
|
|
1064
|
+
* place — so fitting a camera to it covers the whole thing rather than one
|
|
1065
|
+
* chart cell's slice of it.
|
|
1066
|
+
*
|
|
1067
|
+
* DEGENERATE for a point feature (`west === east`, `south === north`). Never
|
|
1068
|
+
* null, so `fitBounds` never has to be guarded.
|
|
1069
|
+
*/
|
|
1070
|
+
bbox: [number, number, number, number];
|
|
1071
|
+
/** S-57 layer acronym, e.g. `"SEAARE"`. */
|
|
1072
|
+
layer: string;
|
|
1073
|
+
/**
|
|
1074
|
+
* `place` — the name describes water or ground you can **be in**.
|
|
1075
|
+
* `object` — the name describes a **thing at** a position.
|
|
1076
|
+
*
|
|
1077
|
+
* Branch on this before writing a name into a sentence about position. It is
|
|
1078
|
+
* the difference between "you are in Nantasket Roads" and the nonsense
|
|
1079
|
+
* "you are in Boston South Channel Buoy 11".
|
|
1080
|
+
*/
|
|
1081
|
+
kind: "place" | "object";
|
|
1082
|
+
/** Short human label to render beside the name, e.g. `"Bay"`, `"Lateral buoy"`. */
|
|
1083
|
+
class: string;
|
|
1084
|
+
/**
|
|
1085
|
+
* `secondary` marks survey and utility descriptors — dredged-area names,
|
|
1086
|
+
* pipelines, cables, recommended tracks. Fully searchable, but never sorted
|
|
1087
|
+
* above a `primary` hit in the same match tier, so a typeahead shows
|
|
1088
|
+
* "Quincy Bay" rather than "51-Foot Outer Harbor Confluence RIQ".
|
|
1089
|
+
*/
|
|
1090
|
+
rank: "primary" | "secondary";
|
|
1091
|
+
/**
|
|
1092
|
+
* Colloquial names a skipper actually says, composed for buoys and beacons:
|
|
1093
|
+
* `"South River Buoy 16"` carries `["red 16", "r16", "red nun 16"]`. Empty
|
|
1094
|
+
* for everything else. `q` matches these at the same tiers as the name.
|
|
1095
|
+
*/
|
|
1096
|
+
aliases: string[];
|
|
1097
|
+
/**
|
|
1098
|
+
* S-57 long name of the largest-scale instance — the stable handle for
|
|
1099
|
+
* re-resolving this hit later.
|
|
1100
|
+
*
|
|
1101
|
+
* **Not a de-duplication key.** The same place carries a different `LNAM` in
|
|
1102
|
+
* every cell that charts it (measured: 25 instances of "Vineyard Sound", 25
|
|
1103
|
+
* distinct LNAMs), and occasionally one `LNAM` spans several cells. CHRT has
|
|
1104
|
+
* already de-duplicated; you do not need to.
|
|
1105
|
+
*/
|
|
1106
|
+
lnam: string;
|
|
1107
|
+
/** Source cell, and its data currency — inline, so a row renders without a second call. */
|
|
1108
|
+
cell_id: string;
|
|
1109
|
+
chart_source: string;
|
|
1110
|
+
edition: number | null;
|
|
1111
|
+
update_number: number | null;
|
|
1112
|
+
issue_date: string | null;
|
|
1113
|
+
/** Compilation scale denominator of the source cell. */
|
|
1114
|
+
scale: number | null;
|
|
1115
|
+
/** S-57 minimum display scale, where the feature carries one. */
|
|
1116
|
+
scamin: number | null;
|
|
1117
|
+
/** Metres from `near`. Absent when `near` was not supplied. */
|
|
1118
|
+
distance_m?: number;
|
|
1119
|
+
/** True bearing from `near` in degrees, geodesic. Absent when `near` was not supplied. */
|
|
1120
|
+
bearing_deg?: number;
|
|
1121
|
+
/**
|
|
1122
|
+
* Which tier matched. The ranking order is
|
|
1123
|
+
* `exact` → `prefix` → `all_words` → `substring` → `fuzzy`, then primary
|
|
1124
|
+
* before secondary, then distance, then largest scale.
|
|
1125
|
+
*
|
|
1126
|
+
* `fuzzy` appears only when nothing matched at the four stricter tiers.
|
|
1127
|
+
*/
|
|
1128
|
+
match: "exact" | "prefix" | "all_words" | "substring" | "fuzzy";
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Present whenever the `near`/`bbox` you supplied falls outside CHRT's
|
|
1132
|
+
* coverage — **with or without results**.
|
|
1133
|
+
*
|
|
1134
|
+
* The notice is about the POSITION, not about the result set being empty. A
|
|
1135
|
+
* query can match places by name thousands of kilometres away while CHRT holds
|
|
1136
|
+
* no charts where you actually are; returning that list silently is the most
|
|
1137
|
+
* misleading answer available. When `results` accompany this block they matched
|
|
1138
|
+
* by NAME only, and their `distance_m` is measured from a position CHRT cannot
|
|
1139
|
+
* chart — do not present them as nearby.
|
|
1140
|
+
*
|
|
1141
|
+
* Its absence means the position is inside coverage, or you gave no position.
|
|
1142
|
+
* So an empty `results` with no `coverage` block is a genuine in-coverage miss:
|
|
1143
|
+
* "we have charts here and nothing is called that", as distinct from "we have
|
|
1144
|
+
* no charts here". Neither is ever a statement that the water is clear.
|
|
1145
|
+
*/
|
|
1146
|
+
interface SearchCoverageNotice {
|
|
1147
|
+
covered: false;
|
|
1148
|
+
code: "outside_coverage";
|
|
1149
|
+
message: string;
|
|
1150
|
+
chart_sources: string[] | null;
|
|
1151
|
+
}
|
|
1152
|
+
interface SearchResponse {
|
|
1153
|
+
results: SearchHit[];
|
|
1154
|
+
/** Exact count of all matches — not an estimate, and not the page length. */
|
|
1155
|
+
total_count: number;
|
|
1156
|
+
limit: number;
|
|
1157
|
+
offset: number;
|
|
1158
|
+
coverage?: SearchCoverageNotice;
|
|
1159
|
+
attribution: string;
|
|
1160
|
+
disclaimer: string;
|
|
1161
|
+
}
|
|
1162
|
+
interface SearchOptions {
|
|
1163
|
+
/**
|
|
1164
|
+
* Free text. Multi-word in ANY order — `"cutty harbor"` finds
|
|
1165
|
+
* "Cuttyhunk Harbor Channel". 2–120 characters.
|
|
1166
|
+
*/
|
|
1167
|
+
q: string;
|
|
1168
|
+
/**
|
|
1169
|
+
* `[longitude, latitude]` — a RANKING BIAS, never a filter.
|
|
1170
|
+
*
|
|
1171
|
+
* Supply it. "Newport" is Rhode Island, Oregon *and* California; without
|
|
1172
|
+
* `near` the first row is the wrong Newport most of the time, and a skipper
|
|
1173
|
+
* off Block Island is offered a place 2,500 miles away.
|
|
1174
|
+
*/
|
|
1175
|
+
near?: [number, number];
|
|
1176
|
+
/** `[west, south, east, north]` — a HARD filter, for "search only this chart". */
|
|
1177
|
+
bbox?: [number, number, number, number];
|
|
1178
|
+
/** Restrict to places or to objects. Omit for both. */
|
|
1179
|
+
kind?: "place" | "object" | "all";
|
|
1180
|
+
/**
|
|
1181
|
+
* S-57 layer acronym, or several.
|
|
1182
|
+
*
|
|
1183
|
+
* Note that named lights are on `LNDMRK`, not `LIGHTS` — only 50 of the
|
|
1184
|
+
* 48,814 `LIGHTS` features in the corpus carry a name, so filtering to
|
|
1185
|
+
* `LIGHTS` to find "Deer Island Light" returns nothing.
|
|
1186
|
+
*/
|
|
1187
|
+
layer?: string | string[];
|
|
1188
|
+
/** Page size, default 20, clamped to 100. */
|
|
1189
|
+
limit?: number;
|
|
1190
|
+
/** Pagination offset. */
|
|
1191
|
+
offset?: number;
|
|
1192
|
+
/** AbortSignal to cancel the request — pass one per keystroke in a typeahead. */
|
|
1193
|
+
signal?: AbortSignal;
|
|
1194
|
+
}
|
|
1043
1195
|
|
|
1044
1196
|
declare class ChrtError extends Error {
|
|
1045
1197
|
status: number;
|
|
@@ -3774,6 +3926,7 @@ declare class Chrt {
|
|
|
3774
3926
|
*/
|
|
3775
3927
|
readonly interact: InteractClient;
|
|
3776
3928
|
private featuresEp;
|
|
3929
|
+
private searchEp;
|
|
3777
3930
|
private queryEp;
|
|
3778
3931
|
private http;
|
|
3779
3932
|
private tileAuth;
|
|
@@ -3784,6 +3937,30 @@ declare class Chrt {
|
|
|
3784
3937
|
constructor(apiKeyOrConfig: string | ChrtConfig);
|
|
3785
3938
|
/** Query GeoJSON features by bounding box */
|
|
3786
3939
|
features(options: FeaturesOptions): Promise<FeatureCollection>;
|
|
3940
|
+
/**
|
|
3941
|
+
* CHRTsearch — find charted places by name.
|
|
3942
|
+
*
|
|
3943
|
+
* The only CHRT surface addressed by NAME rather than by space or identifier.
|
|
3944
|
+
* Text in, a small ranked list of named charted places out.
|
|
3945
|
+
*
|
|
3946
|
+
* ```ts
|
|
3947
|
+
* const { results } = await chrt.search({ q: "cutty harbor", near: [-70.93, 41.42] });
|
|
3948
|
+
* // -> [{ name: "Cuttyhunk Harbor Channel", class: "Fairway", kind: "place", ... }]
|
|
3949
|
+
* ```
|
|
3950
|
+
*
|
|
3951
|
+
* Three things worth knowing before wiring it to a text field:
|
|
3952
|
+
*
|
|
3953
|
+
* 1. **Pass `near`.** It biases ranking and never filters. "Newport" is
|
|
3954
|
+
* Rhode Island, Oregon *and* California; without `near` the first row is
|
|
3955
|
+
* the wrong Newport most of the time.
|
|
3956
|
+
* 2. **It is metered separately** from `features()` — exhausting one does not
|
|
3957
|
+
* affect the other. Sized for a typeahead, and not gated by tier.
|
|
3958
|
+
* 3. **An empty `results` array is not proof a place does not exist.** If the
|
|
3959
|
+
* response carries a `coverage` block, CHRT holds no charts at that
|
|
3960
|
+
* position and the search could not run there. That is a different answer
|
|
3961
|
+
* from "nothing matched", and neither means the water is clear.
|
|
3962
|
+
*/
|
|
3963
|
+
search(options: SearchOptions): Promise<SearchResponse>;
|
|
3787
3964
|
/** Spatial proximity query around a point */
|
|
3788
3965
|
query(options: QueryOptions): Promise<QueryResponse>;
|
|
3789
3966
|
/**
|
|
@@ -3976,4 +4153,4 @@ declare class Chrt {
|
|
|
3976
4153
|
warmTiles(region?: string): Promise<void>;
|
|
3977
4154
|
}
|
|
3978
4155
|
|
|
3979
|
-
export { ALL_NAV_AID_LAYERS, ALL_WATER_BODY_LAYERS, AREA_QUERY_LAYERS, ATON_EXPRESSION_CLASSES, type AheadCoverageCell, type AheadFeatureProperties, type AheadOptions, type AheadResponse, type AlongRouteFeatureProperties, type AlongRouteOptions, type AlongRouteResponse, type AreaInspectResult, type AtlasStyle, type AttachOptions, BAND_DRAW_ORDER, BAND_PRIORITY_RANGES, type BBox, BRIDGE_QUERY_LAYERS, BUILD_MAXZOOM, BUILD_MINZOOM, type BandCode, type BandPriorityRange, type BridgeInspectResult, type BuildOfflineStyleOptions, type BuildSourcesOptions, CHART_BAND_CODES, CHART_CASCADE_CODES, CHART_SECTIONS, CHRTRASTER_REF_CROPS, CHRTRASTER_SVGS, CHRT_ATON_COLORS, CHRT_GLYPH_NAMES, CHRT_GLYPH_SVGS, CHRT_ICON_EXPRESSIONS, CHRT_ICON_PREFIX, CHRT_SDF_GLYPHS, CHRT_STYLE_MODES, type CandidateQueryOptions, type CandidatesEventContext, type CellDeletedEvent, type CellDetail, type CellEventData, type CellNewEvent, type CellUpdatedData, type CellUpdatedEvent, type CellsOptions, type CellsResponse, type ChartSection, Chrt, type ChrtConfig, ChrtError, type ChrtStyleMode, type ChrtStyleOptions, type ChrtStyleTheme, type ChrtSymbolSet, type ClickAnchor, ColorTableName, type CoverageOptions, type CoverageResponse, type CoverageRouteCell, type CoverageRouteOptions, type CoverageRouteResponse, type CoverageSource, type CustomStyleConfig, DEFAULT_CLICK_TOLERANCE, DEFAULT_CUSTOM_STYLE_CONFIG, DEFAULT_INSPECT_CLASS_RANK, DEFAULT_LABEL_SETTINGS, DEFAULT_NAV_AID_SETTINGS, DEFAULT_REGION, DEFAULT_SAFETY_CONTOUR_M, DEFAULT_SOUNDING_SETTINGS, DEFAULT_TILE_BASE_URL, DEFAULT_TILE_REGION, DEFAULT_WATER_BODY_SETTINGS, type DecodedAreaFeature, type DecodedBridge, type DecodedNavAid, type DecodedProperty, type DisplayCategory, type DisplayMode, type FeatureCollection, type FeaturesOptions, type FetchStyleOptions, FileSystemAdapter, type FlashPattern, type FlashPhase, type GenerateCustomStyleOptions, type GeneratedCustomStyle, type GeoJsonFeature, type GeoJsonGeometry, type GeomType, INSPECT_CLASS_RANK, INSPECT_RANK_DEVIATIONS, type InspectCandidate, type InspectCandidateSet, type InspectEnrichment, type InspectEventContext, type InspectNotice, type InspectOptions, type InspectResult, type InspectTargetClass, type InspectableFeature, InteractClient, type InteractEntitlement, InteractError, type InteractErrorCode, type InteractHandle, type InteractMapLike, type InteractMapMouseEvent, LABELED_LAYERS, LABEL_BEHAVIOR, LABEL_LAYER_GROUPS, LABEL_PRIORITY, type LabelBehavior, type LabelConfigOptions, type LabelLayerConfig, type LabelSettings, type LookupEntry, type MapLibreStyle, type MapboxStyle, type MapboxVectorSource, type MarineAlert, type MarineAlertsOptions, type MarineAlertsResponse, type MarineConditionsOptions, type MarineConditionsResponse, type MarineForecastOptions, type MarineForecastPeriod, type MarineForecastResponse, type MarineSeas, type MarineStation, type MarineSwellTrain, type MarineWind, type MarineZoneRef, NAUTICAL_SYMBOLS, NAV_AID_LAYER_GROUPS, NAV_AID_QUERY_LAYERS, NON_SOLAS_DISCLAIMER, NON_SOLAS_DISCLAIMER_SHORT, type NauticalCategory, type NauticalSymbol, type NavAidInspectResult, type NavAidSettings, type NearbyMarineStation, type OfflineBundleResponse, type OfflineDownloadOptions, type OfflineDownloadProgress, type OfflineDownloadResult, OfflineError, type OfflineErrorCode, type OfflineFetchStyleOptions, type OfflineHeartbeatOptions, type OfflineRegionSummary, type OfflineRemoveOptions, OfflineStyleError, type OfflineStylePlatform, type OfflineStyleResponse, type PmtilesVectorSource, type QueryFeatureProperties, type QueryOptions, type QueryResponse, RASTER_ATON_CLASSES, RASTER_GLYPH_NAMES, RASTER_ICON_PREFIX, type ResolvedStyle, type ResolvedTheme, type S101Feature, S101_CHART_SECTIONS, S101_FEATURES, S101_ICON_PREFIX, S101_NEW_SYMBOLS, S101_SOURCE_COMMIT, S101_SYMBOL_GROUPS, S101_SYMBOL_NAMES, S52_ATON_LOOKUPS, S52_ATON_LOOKUPS_PAPER, S52_DRAW_ORDER, S52_LOOKUP, S52_PATTERN_SPRITE_PREFIX, SOUNDING_LAYERS, SYMBOL_FAMILIES, SYMBOL_FAMILY_META, SYMBOL_GROUPS, SYMBOL_MAP, type ScaleBand, type SectorArcFeature, type SectorArcFeatureCollection, type SectorInfo, type SoundingSettings, type SourceMode, type StyleGeneratorOptions, type StyleLayer, type StyleUrlOptions, type SymbolFamily, type SymbolFamilyMeta, type SymbolGroup, TileAuth, type TileGroup, type TileGroupsResponse, TileTokenError, type TileTokenErrorCode, type TileTokenResponse, type TransformRequest, type TransformedRequest, type VectorSourceSpec, type VesselProfile, WATER_BODY_LAYER_GROUPS, type WaterBodySettings, WeatherEndpoint, type WeatherReading, type WebhookEvent, type WebhookEventType, type WebhookPayload, applyChrtSymbolSet, applyColorTheme, applyCustomStyleSettings, applyRasterSymbolSet, applyS101SymbolSet, atonIconExpression, bandFilterExpression, buildFlashPattern, buildLabelLayer, buildLayersForClass, buildOfflineStyle, buildSectorArcGeoJSON, buildSectorArcsFC, buildSectorsFromFeatures, buildSources, candidateRank, chrtAtonTintExpression, chrtLightTintExpression, collectCandidates, collectClickCandidates, combineWithBandFilter, daymarkColor, decimateFeatures, decodeAreaFeatureProps, decodeBridgeProps, decodeCandidate, decodeNavAidProps, depareColor, depareFillExpression, deriveMarinerName, extractNavAidDesignation, featureIdentity, generateCustomStyle, generateSpriteManifest, generateSpriteSheet, generateStyle, generateStyleJSON, getAvailableLineSymbols, getAvailablePatterns, getAvailablePointSymbols, getCollisionSettings, getDrawPriority, getGridSizeForZoom, getIconExpression, getLabelBehavior, getLabelConfig, getLabelPriority, getLookupEntry, getMaxCellsForZoom, getOrderedClasses, getRasterSvg, getS52SvgString, getS52SymbolStats, getStyleStats, getSymbolSvgString, getThemedS101Svg, getThemedS52Svg, getTopmarkMeaning, hazardColor, hazardFillExpression, iconExpressionForFamily, isLabelLayerVisible, isNavAidLayer, isNavAidLayerVisible, isSoundingLayerVisible, isVisibleInMode, isWaterBodyLayerVisible, labelSortKey, lateralColor, lateralFillExpression, lightColor, lightFillExpression, lightsIconExpression, normalizeStyleMode, normalizeTheme, paginate, parseListCodes, parseSymbolFamily, parseWebhook, patternSpriteId, preprocessLights, preprocessNavAids, preprocessSoundings, preprocessWaterBodies, rasterAtonIconExpression, resolveCustomTheme, resolveRasterImage, resolveS101Color, resolveStyle, resolveTargetClass, sanitizeCustomStyleConfig, scaleSizeValue, scaminToMinZoom, styleModeBand, withinBboxFilter, worldMinusBboxPolygon };
|
|
4156
|
+
export { ALL_NAV_AID_LAYERS, ALL_WATER_BODY_LAYERS, AREA_QUERY_LAYERS, ATON_EXPRESSION_CLASSES, type AheadCoverageCell, type AheadFeatureProperties, type AheadOptions, type AheadResponse, type AlongRouteFeatureProperties, type AlongRouteOptions, type AlongRouteResponse, type AreaInspectResult, type AtlasStyle, type AttachOptions, BAND_DRAW_ORDER, BAND_PRIORITY_RANGES, type BBox, BRIDGE_QUERY_LAYERS, BUILD_MAXZOOM, BUILD_MINZOOM, type BandCode, type BandPriorityRange, type BridgeInspectResult, type BuildOfflineStyleOptions, type BuildSourcesOptions, CHART_BAND_CODES, CHART_CASCADE_CODES, CHART_SECTIONS, CHRTRASTER_REF_CROPS, CHRTRASTER_SVGS, CHRT_ATON_COLORS, CHRT_GLYPH_NAMES, CHRT_GLYPH_SVGS, CHRT_ICON_EXPRESSIONS, CHRT_ICON_PREFIX, CHRT_SDF_GLYPHS, CHRT_STYLE_MODES, type CandidateQueryOptions, type CandidatesEventContext, type CellDeletedEvent, type CellDetail, type CellEventData, type CellNewEvent, type CellUpdatedData, type CellUpdatedEvent, type CellsOptions, type CellsResponse, type ChartSection, Chrt, type ChrtConfig, ChrtError, type ChrtStyleMode, type ChrtStyleOptions, type ChrtStyleTheme, type ChrtSymbolSet, type ClickAnchor, ColorTableName, type CoverageOptions, type CoverageResponse, type CoverageRouteCell, type CoverageRouteOptions, type CoverageRouteResponse, type CoverageSource, type CustomStyleConfig, DEFAULT_CLICK_TOLERANCE, DEFAULT_CUSTOM_STYLE_CONFIG, DEFAULT_INSPECT_CLASS_RANK, DEFAULT_LABEL_SETTINGS, DEFAULT_NAV_AID_SETTINGS, DEFAULT_REGION, DEFAULT_SAFETY_CONTOUR_M, DEFAULT_SOUNDING_SETTINGS, DEFAULT_TILE_BASE_URL, DEFAULT_TILE_REGION, DEFAULT_WATER_BODY_SETTINGS, type DecodedAreaFeature, type DecodedBridge, type DecodedNavAid, type DecodedProperty, type DisplayCategory, type DisplayMode, type FeatureCollection, type FeaturesOptions, type FetchStyleOptions, FileSystemAdapter, type FlashPattern, type FlashPhase, type GenerateCustomStyleOptions, type GeneratedCustomStyle, type GeoJsonFeature, type GeoJsonGeometry, type GeomType, INSPECT_CLASS_RANK, INSPECT_RANK_DEVIATIONS, type InspectCandidate, type InspectCandidateSet, type InspectEnrichment, type InspectEventContext, type InspectNotice, type InspectOptions, type InspectResult, type InspectTargetClass, type InspectableFeature, InteractClient, type InteractEntitlement, InteractError, type InteractErrorCode, type InteractHandle, type InteractMapLike, type InteractMapMouseEvent, LABELED_LAYERS, LABEL_BEHAVIOR, LABEL_LAYER_GROUPS, LABEL_PRIORITY, type LabelBehavior, type LabelConfigOptions, type LabelLayerConfig, type LabelSettings, type LookupEntry, type MapLibreStyle, type MapboxStyle, type MapboxVectorSource, type MarineAlert, type MarineAlertsOptions, type MarineAlertsResponse, type MarineConditionsOptions, type MarineConditionsResponse, type MarineForecastOptions, type MarineForecastPeriod, type MarineForecastResponse, type MarineSeas, type MarineStation, type MarineSwellTrain, type MarineWind, type MarineZoneRef, NAUTICAL_SYMBOLS, NAV_AID_LAYER_GROUPS, NAV_AID_QUERY_LAYERS, NON_SOLAS_DISCLAIMER, NON_SOLAS_DISCLAIMER_SHORT, type NauticalCategory, type NauticalSymbol, type NavAidInspectResult, type NavAidSettings, type NearbyMarineStation, type OfflineBundleResponse, type OfflineDownloadOptions, type OfflineDownloadProgress, type OfflineDownloadResult, OfflineError, type OfflineErrorCode, type OfflineFetchStyleOptions, type OfflineHeartbeatOptions, type OfflineRegionSummary, type OfflineRemoveOptions, OfflineStyleError, type OfflineStylePlatform, type OfflineStyleResponse, type PmtilesVectorSource, type QueryFeatureProperties, type QueryOptions, type QueryResponse, RASTER_ATON_CLASSES, RASTER_GLYPH_NAMES, RASTER_ICON_PREFIX, type ResolvedStyle, type ResolvedTheme, type S101Feature, S101_CHART_SECTIONS, S101_FEATURES, S101_ICON_PREFIX, S101_NEW_SYMBOLS, S101_SOURCE_COMMIT, S101_SYMBOL_GROUPS, S101_SYMBOL_NAMES, S52_ATON_LOOKUPS, S52_ATON_LOOKUPS_PAPER, S52_DRAW_ORDER, S52_LOOKUP, S52_PATTERN_SPRITE_PREFIX, SOUNDING_LAYERS, SYMBOL_FAMILIES, SYMBOL_FAMILY_META, SYMBOL_GROUPS, SYMBOL_MAP, type ScaleBand, type SearchCoverageNotice, type SearchHit, type SearchOptions, type SearchResponse, type SectorArcFeature, type SectorArcFeatureCollection, type SectorInfo, type SoundingSettings, type SourceMode, type StyleGeneratorOptions, type StyleLayer, type StyleUrlOptions, type SymbolFamily, type SymbolFamilyMeta, type SymbolGroup, TileAuth, type TileGroup, type TileGroupsResponse, TileTokenError, type TileTokenErrorCode, type TileTokenResponse, type TransformRequest, type TransformedRequest, type VectorSourceSpec, type VesselProfile, WATER_BODY_LAYER_GROUPS, type WaterBodySettings, WeatherEndpoint, type WeatherReading, type WebhookEvent, type WebhookEventType, type WebhookPayload, applyChrtSymbolSet, applyColorTheme, applyCustomStyleSettings, applyRasterSymbolSet, applyS101SymbolSet, atonIconExpression, bandFilterExpression, buildFlashPattern, buildLabelLayer, buildLayersForClass, buildOfflineStyle, buildSectorArcGeoJSON, buildSectorArcsFC, buildSectorsFromFeatures, buildSources, candidateRank, chrtAtonTintExpression, chrtLightTintExpression, collectCandidates, collectClickCandidates, combineWithBandFilter, daymarkColor, decimateFeatures, decodeAreaFeatureProps, decodeBridgeProps, decodeCandidate, decodeNavAidProps, depareColor, depareFillExpression, deriveMarinerName, extractNavAidDesignation, featureIdentity, generateCustomStyle, generateSpriteManifest, generateSpriteSheet, generateStyle, generateStyleJSON, getAvailableLineSymbols, getAvailablePatterns, getAvailablePointSymbols, getCollisionSettings, getDrawPriority, getGridSizeForZoom, getIconExpression, getLabelBehavior, getLabelConfig, getLabelPriority, getLookupEntry, getMaxCellsForZoom, getOrderedClasses, getRasterSvg, getS52SvgString, getS52SymbolStats, getStyleStats, getSymbolSvgString, getThemedS101Svg, getThemedS52Svg, getTopmarkMeaning, hazardColor, hazardFillExpression, iconExpressionForFamily, isLabelLayerVisible, isNavAidLayer, isNavAidLayerVisible, isSoundingLayerVisible, isVisibleInMode, isWaterBodyLayerVisible, labelSortKey, lateralColor, lateralFillExpression, lightColor, lightFillExpression, lightsIconExpression, normalizeStyleMode, normalizeTheme, paginate, parseListCodes, parseSymbolFamily, parseWebhook, patternSpriteId, preprocessLights, preprocessNavAids, preprocessSoundings, preprocessWaterBodies, rasterAtonIconExpression, resolveCustomTheme, resolveRasterImage, resolveS101Color, resolveStyle, resolveTargetClass, sanitizeCustomStyleConfig, scaleSizeValue, scaminToMinZoom, styleModeBand, withinBboxFilter, worldMinusBboxPolygon };
|
package/dist/index.d.ts
CHANGED
|
@@ -1040,6 +1040,158 @@ interface MarineForecastResponse {
|
|
|
1040
1040
|
attribution: string;
|
|
1041
1041
|
disclaimer: string;
|
|
1042
1042
|
}
|
|
1043
|
+
/**
|
|
1044
|
+
* One gazetteer hit.
|
|
1045
|
+
*
|
|
1046
|
+
* A hit is a PLACE, not a feature: a point, an extent, and the identity you
|
|
1047
|
+
* need to go and fetch the feature itself. If you want geometry, follow `lnam`
|
|
1048
|
+
* and `cell_id` into `features()` or CHRTinteract.
|
|
1049
|
+
*/
|
|
1050
|
+
interface SearchHit {
|
|
1051
|
+
/** The `OBJNAM` verbatim, exactly as the hydrographic office charted it. */
|
|
1052
|
+
name: string;
|
|
1053
|
+
/**
|
|
1054
|
+
* A point GUARANTEED to lie inside real charted geometry carrying this name.
|
|
1055
|
+
*
|
|
1056
|
+
* Not a bbox centroid, and not a polygon centroid either — a centroid can
|
|
1057
|
+
* fall outside a concave area entirely, or inside a different, smaller
|
|
1058
|
+
* feature. Safe to fly a camera to.
|
|
1059
|
+
*/
|
|
1060
|
+
lon: number;
|
|
1061
|
+
lat: number;
|
|
1062
|
+
/**
|
|
1063
|
+
* `[west, south, east, north]`, unioned across every charted instance of this
|
|
1064
|
+
* place — so fitting a camera to it covers the whole thing rather than one
|
|
1065
|
+
* chart cell's slice of it.
|
|
1066
|
+
*
|
|
1067
|
+
* DEGENERATE for a point feature (`west === east`, `south === north`). Never
|
|
1068
|
+
* null, so `fitBounds` never has to be guarded.
|
|
1069
|
+
*/
|
|
1070
|
+
bbox: [number, number, number, number];
|
|
1071
|
+
/** S-57 layer acronym, e.g. `"SEAARE"`. */
|
|
1072
|
+
layer: string;
|
|
1073
|
+
/**
|
|
1074
|
+
* `place` — the name describes water or ground you can **be in**.
|
|
1075
|
+
* `object` — the name describes a **thing at** a position.
|
|
1076
|
+
*
|
|
1077
|
+
* Branch on this before writing a name into a sentence about position. It is
|
|
1078
|
+
* the difference between "you are in Nantasket Roads" and the nonsense
|
|
1079
|
+
* "you are in Boston South Channel Buoy 11".
|
|
1080
|
+
*/
|
|
1081
|
+
kind: "place" | "object";
|
|
1082
|
+
/** Short human label to render beside the name, e.g. `"Bay"`, `"Lateral buoy"`. */
|
|
1083
|
+
class: string;
|
|
1084
|
+
/**
|
|
1085
|
+
* `secondary` marks survey and utility descriptors — dredged-area names,
|
|
1086
|
+
* pipelines, cables, recommended tracks. Fully searchable, but never sorted
|
|
1087
|
+
* above a `primary` hit in the same match tier, so a typeahead shows
|
|
1088
|
+
* "Quincy Bay" rather than "51-Foot Outer Harbor Confluence RIQ".
|
|
1089
|
+
*/
|
|
1090
|
+
rank: "primary" | "secondary";
|
|
1091
|
+
/**
|
|
1092
|
+
* Colloquial names a skipper actually says, composed for buoys and beacons:
|
|
1093
|
+
* `"South River Buoy 16"` carries `["red 16", "r16", "red nun 16"]`. Empty
|
|
1094
|
+
* for everything else. `q` matches these at the same tiers as the name.
|
|
1095
|
+
*/
|
|
1096
|
+
aliases: string[];
|
|
1097
|
+
/**
|
|
1098
|
+
* S-57 long name of the largest-scale instance — the stable handle for
|
|
1099
|
+
* re-resolving this hit later.
|
|
1100
|
+
*
|
|
1101
|
+
* **Not a de-duplication key.** The same place carries a different `LNAM` in
|
|
1102
|
+
* every cell that charts it (measured: 25 instances of "Vineyard Sound", 25
|
|
1103
|
+
* distinct LNAMs), and occasionally one `LNAM` spans several cells. CHRT has
|
|
1104
|
+
* already de-duplicated; you do not need to.
|
|
1105
|
+
*/
|
|
1106
|
+
lnam: string;
|
|
1107
|
+
/** Source cell, and its data currency — inline, so a row renders without a second call. */
|
|
1108
|
+
cell_id: string;
|
|
1109
|
+
chart_source: string;
|
|
1110
|
+
edition: number | null;
|
|
1111
|
+
update_number: number | null;
|
|
1112
|
+
issue_date: string | null;
|
|
1113
|
+
/** Compilation scale denominator of the source cell. */
|
|
1114
|
+
scale: number | null;
|
|
1115
|
+
/** S-57 minimum display scale, where the feature carries one. */
|
|
1116
|
+
scamin: number | null;
|
|
1117
|
+
/** Metres from `near`. Absent when `near` was not supplied. */
|
|
1118
|
+
distance_m?: number;
|
|
1119
|
+
/** True bearing from `near` in degrees, geodesic. Absent when `near` was not supplied. */
|
|
1120
|
+
bearing_deg?: number;
|
|
1121
|
+
/**
|
|
1122
|
+
* Which tier matched. The ranking order is
|
|
1123
|
+
* `exact` → `prefix` → `all_words` → `substring` → `fuzzy`, then primary
|
|
1124
|
+
* before secondary, then distance, then largest scale.
|
|
1125
|
+
*
|
|
1126
|
+
* `fuzzy` appears only when nothing matched at the four stricter tiers.
|
|
1127
|
+
*/
|
|
1128
|
+
match: "exact" | "prefix" | "all_words" | "substring" | "fuzzy";
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Present whenever the `near`/`bbox` you supplied falls outside CHRT's
|
|
1132
|
+
* coverage — **with or without results**.
|
|
1133
|
+
*
|
|
1134
|
+
* The notice is about the POSITION, not about the result set being empty. A
|
|
1135
|
+
* query can match places by name thousands of kilometres away while CHRT holds
|
|
1136
|
+
* no charts where you actually are; returning that list silently is the most
|
|
1137
|
+
* misleading answer available. When `results` accompany this block they matched
|
|
1138
|
+
* by NAME only, and their `distance_m` is measured from a position CHRT cannot
|
|
1139
|
+
* chart — do not present them as nearby.
|
|
1140
|
+
*
|
|
1141
|
+
* Its absence means the position is inside coverage, or you gave no position.
|
|
1142
|
+
* So an empty `results` with no `coverage` block is a genuine in-coverage miss:
|
|
1143
|
+
* "we have charts here and nothing is called that", as distinct from "we have
|
|
1144
|
+
* no charts here". Neither is ever a statement that the water is clear.
|
|
1145
|
+
*/
|
|
1146
|
+
interface SearchCoverageNotice {
|
|
1147
|
+
covered: false;
|
|
1148
|
+
code: "outside_coverage";
|
|
1149
|
+
message: string;
|
|
1150
|
+
chart_sources: string[] | null;
|
|
1151
|
+
}
|
|
1152
|
+
interface SearchResponse {
|
|
1153
|
+
results: SearchHit[];
|
|
1154
|
+
/** Exact count of all matches — not an estimate, and not the page length. */
|
|
1155
|
+
total_count: number;
|
|
1156
|
+
limit: number;
|
|
1157
|
+
offset: number;
|
|
1158
|
+
coverage?: SearchCoverageNotice;
|
|
1159
|
+
attribution: string;
|
|
1160
|
+
disclaimer: string;
|
|
1161
|
+
}
|
|
1162
|
+
interface SearchOptions {
|
|
1163
|
+
/**
|
|
1164
|
+
* Free text. Multi-word in ANY order — `"cutty harbor"` finds
|
|
1165
|
+
* "Cuttyhunk Harbor Channel". 2–120 characters.
|
|
1166
|
+
*/
|
|
1167
|
+
q: string;
|
|
1168
|
+
/**
|
|
1169
|
+
* `[longitude, latitude]` — a RANKING BIAS, never a filter.
|
|
1170
|
+
*
|
|
1171
|
+
* Supply it. "Newport" is Rhode Island, Oregon *and* California; without
|
|
1172
|
+
* `near` the first row is the wrong Newport most of the time, and a skipper
|
|
1173
|
+
* off Block Island is offered a place 2,500 miles away.
|
|
1174
|
+
*/
|
|
1175
|
+
near?: [number, number];
|
|
1176
|
+
/** `[west, south, east, north]` — a HARD filter, for "search only this chart". */
|
|
1177
|
+
bbox?: [number, number, number, number];
|
|
1178
|
+
/** Restrict to places or to objects. Omit for both. */
|
|
1179
|
+
kind?: "place" | "object" | "all";
|
|
1180
|
+
/**
|
|
1181
|
+
* S-57 layer acronym, or several.
|
|
1182
|
+
*
|
|
1183
|
+
* Note that named lights are on `LNDMRK`, not `LIGHTS` — only 50 of the
|
|
1184
|
+
* 48,814 `LIGHTS` features in the corpus carry a name, so filtering to
|
|
1185
|
+
* `LIGHTS` to find "Deer Island Light" returns nothing.
|
|
1186
|
+
*/
|
|
1187
|
+
layer?: string | string[];
|
|
1188
|
+
/** Page size, default 20, clamped to 100. */
|
|
1189
|
+
limit?: number;
|
|
1190
|
+
/** Pagination offset. */
|
|
1191
|
+
offset?: number;
|
|
1192
|
+
/** AbortSignal to cancel the request — pass one per keystroke in a typeahead. */
|
|
1193
|
+
signal?: AbortSignal;
|
|
1194
|
+
}
|
|
1043
1195
|
|
|
1044
1196
|
declare class ChrtError extends Error {
|
|
1045
1197
|
status: number;
|
|
@@ -3774,6 +3926,7 @@ declare class Chrt {
|
|
|
3774
3926
|
*/
|
|
3775
3927
|
readonly interact: InteractClient;
|
|
3776
3928
|
private featuresEp;
|
|
3929
|
+
private searchEp;
|
|
3777
3930
|
private queryEp;
|
|
3778
3931
|
private http;
|
|
3779
3932
|
private tileAuth;
|
|
@@ -3784,6 +3937,30 @@ declare class Chrt {
|
|
|
3784
3937
|
constructor(apiKeyOrConfig: string | ChrtConfig);
|
|
3785
3938
|
/** Query GeoJSON features by bounding box */
|
|
3786
3939
|
features(options: FeaturesOptions): Promise<FeatureCollection>;
|
|
3940
|
+
/**
|
|
3941
|
+
* CHRTsearch — find charted places by name.
|
|
3942
|
+
*
|
|
3943
|
+
* The only CHRT surface addressed by NAME rather than by space or identifier.
|
|
3944
|
+
* Text in, a small ranked list of named charted places out.
|
|
3945
|
+
*
|
|
3946
|
+
* ```ts
|
|
3947
|
+
* const { results } = await chrt.search({ q: "cutty harbor", near: [-70.93, 41.42] });
|
|
3948
|
+
* // -> [{ name: "Cuttyhunk Harbor Channel", class: "Fairway", kind: "place", ... }]
|
|
3949
|
+
* ```
|
|
3950
|
+
*
|
|
3951
|
+
* Three things worth knowing before wiring it to a text field:
|
|
3952
|
+
*
|
|
3953
|
+
* 1. **Pass `near`.** It biases ranking and never filters. "Newport" is
|
|
3954
|
+
* Rhode Island, Oregon *and* California; without `near` the first row is
|
|
3955
|
+
* the wrong Newport most of the time.
|
|
3956
|
+
* 2. **It is metered separately** from `features()` — exhausting one does not
|
|
3957
|
+
* affect the other. Sized for a typeahead, and not gated by tier.
|
|
3958
|
+
* 3. **An empty `results` array is not proof a place does not exist.** If the
|
|
3959
|
+
* response carries a `coverage` block, CHRT holds no charts at that
|
|
3960
|
+
* position and the search could not run there. That is a different answer
|
|
3961
|
+
* from "nothing matched", and neither means the water is clear.
|
|
3962
|
+
*/
|
|
3963
|
+
search(options: SearchOptions): Promise<SearchResponse>;
|
|
3787
3964
|
/** Spatial proximity query around a point */
|
|
3788
3965
|
query(options: QueryOptions): Promise<QueryResponse>;
|
|
3789
3966
|
/**
|
|
@@ -3976,4 +4153,4 @@ declare class Chrt {
|
|
|
3976
4153
|
warmTiles(region?: string): Promise<void>;
|
|
3977
4154
|
}
|
|
3978
4155
|
|
|
3979
|
-
export { ALL_NAV_AID_LAYERS, ALL_WATER_BODY_LAYERS, AREA_QUERY_LAYERS, ATON_EXPRESSION_CLASSES, type AheadCoverageCell, type AheadFeatureProperties, type AheadOptions, type AheadResponse, type AlongRouteFeatureProperties, type AlongRouteOptions, type AlongRouteResponse, type AreaInspectResult, type AtlasStyle, type AttachOptions, BAND_DRAW_ORDER, BAND_PRIORITY_RANGES, type BBox, BRIDGE_QUERY_LAYERS, BUILD_MAXZOOM, BUILD_MINZOOM, type BandCode, type BandPriorityRange, type BridgeInspectResult, type BuildOfflineStyleOptions, type BuildSourcesOptions, CHART_BAND_CODES, CHART_CASCADE_CODES, CHART_SECTIONS, CHRTRASTER_REF_CROPS, CHRTRASTER_SVGS, CHRT_ATON_COLORS, CHRT_GLYPH_NAMES, CHRT_GLYPH_SVGS, CHRT_ICON_EXPRESSIONS, CHRT_ICON_PREFIX, CHRT_SDF_GLYPHS, CHRT_STYLE_MODES, type CandidateQueryOptions, type CandidatesEventContext, type CellDeletedEvent, type CellDetail, type CellEventData, type CellNewEvent, type CellUpdatedData, type CellUpdatedEvent, type CellsOptions, type CellsResponse, type ChartSection, Chrt, type ChrtConfig, ChrtError, type ChrtStyleMode, type ChrtStyleOptions, type ChrtStyleTheme, type ChrtSymbolSet, type ClickAnchor, ColorTableName, type CoverageOptions, type CoverageResponse, type CoverageRouteCell, type CoverageRouteOptions, type CoverageRouteResponse, type CoverageSource, type CustomStyleConfig, DEFAULT_CLICK_TOLERANCE, DEFAULT_CUSTOM_STYLE_CONFIG, DEFAULT_INSPECT_CLASS_RANK, DEFAULT_LABEL_SETTINGS, DEFAULT_NAV_AID_SETTINGS, DEFAULT_REGION, DEFAULT_SAFETY_CONTOUR_M, DEFAULT_SOUNDING_SETTINGS, DEFAULT_TILE_BASE_URL, DEFAULT_TILE_REGION, DEFAULT_WATER_BODY_SETTINGS, type DecodedAreaFeature, type DecodedBridge, type DecodedNavAid, type DecodedProperty, type DisplayCategory, type DisplayMode, type FeatureCollection, type FeaturesOptions, type FetchStyleOptions, FileSystemAdapter, type FlashPattern, type FlashPhase, type GenerateCustomStyleOptions, type GeneratedCustomStyle, type GeoJsonFeature, type GeoJsonGeometry, type GeomType, INSPECT_CLASS_RANK, INSPECT_RANK_DEVIATIONS, type InspectCandidate, type InspectCandidateSet, type InspectEnrichment, type InspectEventContext, type InspectNotice, type InspectOptions, type InspectResult, type InspectTargetClass, type InspectableFeature, InteractClient, type InteractEntitlement, InteractError, type InteractErrorCode, type InteractHandle, type InteractMapLike, type InteractMapMouseEvent, LABELED_LAYERS, LABEL_BEHAVIOR, LABEL_LAYER_GROUPS, LABEL_PRIORITY, type LabelBehavior, type LabelConfigOptions, type LabelLayerConfig, type LabelSettings, type LookupEntry, type MapLibreStyle, type MapboxStyle, type MapboxVectorSource, type MarineAlert, type MarineAlertsOptions, type MarineAlertsResponse, type MarineConditionsOptions, type MarineConditionsResponse, type MarineForecastOptions, type MarineForecastPeriod, type MarineForecastResponse, type MarineSeas, type MarineStation, type MarineSwellTrain, type MarineWind, type MarineZoneRef, NAUTICAL_SYMBOLS, NAV_AID_LAYER_GROUPS, NAV_AID_QUERY_LAYERS, NON_SOLAS_DISCLAIMER, NON_SOLAS_DISCLAIMER_SHORT, type NauticalCategory, type NauticalSymbol, type NavAidInspectResult, type NavAidSettings, type NearbyMarineStation, type OfflineBundleResponse, type OfflineDownloadOptions, type OfflineDownloadProgress, type OfflineDownloadResult, OfflineError, type OfflineErrorCode, type OfflineFetchStyleOptions, type OfflineHeartbeatOptions, type OfflineRegionSummary, type OfflineRemoveOptions, OfflineStyleError, type OfflineStylePlatform, type OfflineStyleResponse, type PmtilesVectorSource, type QueryFeatureProperties, type QueryOptions, type QueryResponse, RASTER_ATON_CLASSES, RASTER_GLYPH_NAMES, RASTER_ICON_PREFIX, type ResolvedStyle, type ResolvedTheme, type S101Feature, S101_CHART_SECTIONS, S101_FEATURES, S101_ICON_PREFIX, S101_NEW_SYMBOLS, S101_SOURCE_COMMIT, S101_SYMBOL_GROUPS, S101_SYMBOL_NAMES, S52_ATON_LOOKUPS, S52_ATON_LOOKUPS_PAPER, S52_DRAW_ORDER, S52_LOOKUP, S52_PATTERN_SPRITE_PREFIX, SOUNDING_LAYERS, SYMBOL_FAMILIES, SYMBOL_FAMILY_META, SYMBOL_GROUPS, SYMBOL_MAP, type ScaleBand, type SectorArcFeature, type SectorArcFeatureCollection, type SectorInfo, type SoundingSettings, type SourceMode, type StyleGeneratorOptions, type StyleLayer, type StyleUrlOptions, type SymbolFamily, type SymbolFamilyMeta, type SymbolGroup, TileAuth, type TileGroup, type TileGroupsResponse, TileTokenError, type TileTokenErrorCode, type TileTokenResponse, type TransformRequest, type TransformedRequest, type VectorSourceSpec, type VesselProfile, WATER_BODY_LAYER_GROUPS, type WaterBodySettings, WeatherEndpoint, type WeatherReading, type WebhookEvent, type WebhookEventType, type WebhookPayload, applyChrtSymbolSet, applyColorTheme, applyCustomStyleSettings, applyRasterSymbolSet, applyS101SymbolSet, atonIconExpression, bandFilterExpression, buildFlashPattern, buildLabelLayer, buildLayersForClass, buildOfflineStyle, buildSectorArcGeoJSON, buildSectorArcsFC, buildSectorsFromFeatures, buildSources, candidateRank, chrtAtonTintExpression, chrtLightTintExpression, collectCandidates, collectClickCandidates, combineWithBandFilter, daymarkColor, decimateFeatures, decodeAreaFeatureProps, decodeBridgeProps, decodeCandidate, decodeNavAidProps, depareColor, depareFillExpression, deriveMarinerName, extractNavAidDesignation, featureIdentity, generateCustomStyle, generateSpriteManifest, generateSpriteSheet, generateStyle, generateStyleJSON, getAvailableLineSymbols, getAvailablePatterns, getAvailablePointSymbols, getCollisionSettings, getDrawPriority, getGridSizeForZoom, getIconExpression, getLabelBehavior, getLabelConfig, getLabelPriority, getLookupEntry, getMaxCellsForZoom, getOrderedClasses, getRasterSvg, getS52SvgString, getS52SymbolStats, getStyleStats, getSymbolSvgString, getThemedS101Svg, getThemedS52Svg, getTopmarkMeaning, hazardColor, hazardFillExpression, iconExpressionForFamily, isLabelLayerVisible, isNavAidLayer, isNavAidLayerVisible, isSoundingLayerVisible, isVisibleInMode, isWaterBodyLayerVisible, labelSortKey, lateralColor, lateralFillExpression, lightColor, lightFillExpression, lightsIconExpression, normalizeStyleMode, normalizeTheme, paginate, parseListCodes, parseSymbolFamily, parseWebhook, patternSpriteId, preprocessLights, preprocessNavAids, preprocessSoundings, preprocessWaterBodies, rasterAtonIconExpression, resolveCustomTheme, resolveRasterImage, resolveS101Color, resolveStyle, resolveTargetClass, sanitizeCustomStyleConfig, scaleSizeValue, scaminToMinZoom, styleModeBand, withinBboxFilter, worldMinusBboxPolygon };
|
|
4156
|
+
export { ALL_NAV_AID_LAYERS, ALL_WATER_BODY_LAYERS, AREA_QUERY_LAYERS, ATON_EXPRESSION_CLASSES, type AheadCoverageCell, type AheadFeatureProperties, type AheadOptions, type AheadResponse, type AlongRouteFeatureProperties, type AlongRouteOptions, type AlongRouteResponse, type AreaInspectResult, type AtlasStyle, type AttachOptions, BAND_DRAW_ORDER, BAND_PRIORITY_RANGES, type BBox, BRIDGE_QUERY_LAYERS, BUILD_MAXZOOM, BUILD_MINZOOM, type BandCode, type BandPriorityRange, type BridgeInspectResult, type BuildOfflineStyleOptions, type BuildSourcesOptions, CHART_BAND_CODES, CHART_CASCADE_CODES, CHART_SECTIONS, CHRTRASTER_REF_CROPS, CHRTRASTER_SVGS, CHRT_ATON_COLORS, CHRT_GLYPH_NAMES, CHRT_GLYPH_SVGS, CHRT_ICON_EXPRESSIONS, CHRT_ICON_PREFIX, CHRT_SDF_GLYPHS, CHRT_STYLE_MODES, type CandidateQueryOptions, type CandidatesEventContext, type CellDeletedEvent, type CellDetail, type CellEventData, type CellNewEvent, type CellUpdatedData, type CellUpdatedEvent, type CellsOptions, type CellsResponse, type ChartSection, Chrt, type ChrtConfig, ChrtError, type ChrtStyleMode, type ChrtStyleOptions, type ChrtStyleTheme, type ChrtSymbolSet, type ClickAnchor, ColorTableName, type CoverageOptions, type CoverageResponse, type CoverageRouteCell, type CoverageRouteOptions, type CoverageRouteResponse, type CoverageSource, type CustomStyleConfig, DEFAULT_CLICK_TOLERANCE, DEFAULT_CUSTOM_STYLE_CONFIG, DEFAULT_INSPECT_CLASS_RANK, DEFAULT_LABEL_SETTINGS, DEFAULT_NAV_AID_SETTINGS, DEFAULT_REGION, DEFAULT_SAFETY_CONTOUR_M, DEFAULT_SOUNDING_SETTINGS, DEFAULT_TILE_BASE_URL, DEFAULT_TILE_REGION, DEFAULT_WATER_BODY_SETTINGS, type DecodedAreaFeature, type DecodedBridge, type DecodedNavAid, type DecodedProperty, type DisplayCategory, type DisplayMode, type FeatureCollection, type FeaturesOptions, type FetchStyleOptions, FileSystemAdapter, type FlashPattern, type FlashPhase, type GenerateCustomStyleOptions, type GeneratedCustomStyle, type GeoJsonFeature, type GeoJsonGeometry, type GeomType, INSPECT_CLASS_RANK, INSPECT_RANK_DEVIATIONS, type InspectCandidate, type InspectCandidateSet, type InspectEnrichment, type InspectEventContext, type InspectNotice, type InspectOptions, type InspectResult, type InspectTargetClass, type InspectableFeature, InteractClient, type InteractEntitlement, InteractError, type InteractErrorCode, type InteractHandle, type InteractMapLike, type InteractMapMouseEvent, LABELED_LAYERS, LABEL_BEHAVIOR, LABEL_LAYER_GROUPS, LABEL_PRIORITY, type LabelBehavior, type LabelConfigOptions, type LabelLayerConfig, type LabelSettings, type LookupEntry, type MapLibreStyle, type MapboxStyle, type MapboxVectorSource, type MarineAlert, type MarineAlertsOptions, type MarineAlertsResponse, type MarineConditionsOptions, type MarineConditionsResponse, type MarineForecastOptions, type MarineForecastPeriod, type MarineForecastResponse, type MarineSeas, type MarineStation, type MarineSwellTrain, type MarineWind, type MarineZoneRef, NAUTICAL_SYMBOLS, NAV_AID_LAYER_GROUPS, NAV_AID_QUERY_LAYERS, NON_SOLAS_DISCLAIMER, NON_SOLAS_DISCLAIMER_SHORT, type NauticalCategory, type NauticalSymbol, type NavAidInspectResult, type NavAidSettings, type NearbyMarineStation, type OfflineBundleResponse, type OfflineDownloadOptions, type OfflineDownloadProgress, type OfflineDownloadResult, OfflineError, type OfflineErrorCode, type OfflineFetchStyleOptions, type OfflineHeartbeatOptions, type OfflineRegionSummary, type OfflineRemoveOptions, OfflineStyleError, type OfflineStylePlatform, type OfflineStyleResponse, type PmtilesVectorSource, type QueryFeatureProperties, type QueryOptions, type QueryResponse, RASTER_ATON_CLASSES, RASTER_GLYPH_NAMES, RASTER_ICON_PREFIX, type ResolvedStyle, type ResolvedTheme, type S101Feature, S101_CHART_SECTIONS, S101_FEATURES, S101_ICON_PREFIX, S101_NEW_SYMBOLS, S101_SOURCE_COMMIT, S101_SYMBOL_GROUPS, S101_SYMBOL_NAMES, S52_ATON_LOOKUPS, S52_ATON_LOOKUPS_PAPER, S52_DRAW_ORDER, S52_LOOKUP, S52_PATTERN_SPRITE_PREFIX, SOUNDING_LAYERS, SYMBOL_FAMILIES, SYMBOL_FAMILY_META, SYMBOL_GROUPS, SYMBOL_MAP, type ScaleBand, type SearchCoverageNotice, type SearchHit, type SearchOptions, type SearchResponse, type SectorArcFeature, type SectorArcFeatureCollection, type SectorInfo, type SoundingSettings, type SourceMode, type StyleGeneratorOptions, type StyleLayer, type StyleUrlOptions, type SymbolFamily, type SymbolFamilyMeta, type SymbolGroup, TileAuth, type TileGroup, type TileGroupsResponse, TileTokenError, type TileTokenErrorCode, type TileTokenResponse, type TransformRequest, type TransformedRequest, type VectorSourceSpec, type VesselProfile, WATER_BODY_LAYER_GROUPS, type WaterBodySettings, WeatherEndpoint, type WeatherReading, type WebhookEvent, type WebhookEventType, type WebhookPayload, applyChrtSymbolSet, applyColorTheme, applyCustomStyleSettings, applyRasterSymbolSet, applyS101SymbolSet, atonIconExpression, bandFilterExpression, buildFlashPattern, buildLabelLayer, buildLayersForClass, buildOfflineStyle, buildSectorArcGeoJSON, buildSectorArcsFC, buildSectorsFromFeatures, buildSources, candidateRank, chrtAtonTintExpression, chrtLightTintExpression, collectCandidates, collectClickCandidates, combineWithBandFilter, daymarkColor, decimateFeatures, decodeAreaFeatureProps, decodeBridgeProps, decodeCandidate, decodeNavAidProps, depareColor, depareFillExpression, deriveMarinerName, extractNavAidDesignation, featureIdentity, generateCustomStyle, generateSpriteManifest, generateSpriteSheet, generateStyle, generateStyleJSON, getAvailableLineSymbols, getAvailablePatterns, getAvailablePointSymbols, getCollisionSettings, getDrawPriority, getGridSizeForZoom, getIconExpression, getLabelBehavior, getLabelConfig, getLabelPriority, getLookupEntry, getMaxCellsForZoom, getOrderedClasses, getRasterSvg, getS52SvgString, getS52SymbolStats, getStyleStats, getSymbolSvgString, getThemedS101Svg, getThemedS52Svg, getTopmarkMeaning, hazardColor, hazardFillExpression, iconExpressionForFamily, isLabelLayerVisible, isNavAidLayer, isNavAidLayerVisible, isSoundingLayerVisible, isVisibleInMode, isWaterBodyLayerVisible, labelSortKey, lateralColor, lateralFillExpression, lightColor, lightFillExpression, lightsIconExpression, normalizeStyleMode, normalizeTheme, paginate, parseListCodes, parseSymbolFamily, parseWebhook, patternSpriteId, preprocessLights, preprocessNavAids, preprocessSoundings, preprocessWaterBodies, rasterAtonIconExpression, resolveCustomTheme, resolveRasterImage, resolveS101Color, resolveStyle, resolveTargetClass, sanitizeCustomStyleConfig, scaleSizeValue, scaminToMinZoom, styleModeBand, withinBboxFilter, worldMinusBboxPolygon };
|
package/dist/index.js
CHANGED
|
@@ -600,6 +600,37 @@ var FeaturesEndpoint = class {
|
|
|
600
600
|
}
|
|
601
601
|
};
|
|
602
602
|
|
|
603
|
+
// src/endpoints/search.ts
|
|
604
|
+
var SearchEndpoint = class {
|
|
605
|
+
constructor(http) {
|
|
606
|
+
this.http = http;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Search the gazetteer.
|
|
610
|
+
*
|
|
611
|
+
* `near` biases ranking and never filters — "Newport" is Rhode Island, Oregon
|
|
612
|
+
* *and* California, and all three come back with the nearest first. `bbox`
|
|
613
|
+
* does filter.
|
|
614
|
+
*/
|
|
615
|
+
async find(options) {
|
|
616
|
+
return this.http.request(
|
|
617
|
+
"/search",
|
|
618
|
+
{
|
|
619
|
+
q: options.q,
|
|
620
|
+
near: options.near ? `${options.near[0]},${options.near[1]}` : void 0,
|
|
621
|
+
bbox: options.bbox ? options.bbox.join(",") : void 0,
|
|
622
|
+
kind: options.kind,
|
|
623
|
+
// Both spellings are accepted server-side; the SDK sends the
|
|
624
|
+
// comma-joined form so one array maps to one query parameter.
|
|
625
|
+
layer: Array.isArray(options.layer) ? options.layer.join(",") : options.layer,
|
|
626
|
+
limit: options.limit,
|
|
627
|
+
offset: options.offset
|
|
628
|
+
},
|
|
629
|
+
options.signal
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
603
634
|
// src/endpoints/query.ts
|
|
604
635
|
var METRES_PER_NAUTICAL_MILE2 = 1852;
|
|
605
636
|
var QueryEndpoint = class {
|
|
@@ -28477,6 +28508,7 @@ var Chrt = class {
|
|
|
28477
28508
|
*/
|
|
28478
28509
|
interact;
|
|
28479
28510
|
featuresEp;
|
|
28511
|
+
searchEp;
|
|
28480
28512
|
queryEp;
|
|
28481
28513
|
http;
|
|
28482
28514
|
tileAuth;
|
|
@@ -28497,6 +28529,7 @@ var Chrt = class {
|
|
|
28497
28529
|
this.coverage = new CoverageEndpoint(this.http);
|
|
28498
28530
|
this.weather = new WeatherEndpoint(this.http);
|
|
28499
28531
|
this.featuresEp = new FeaturesEndpoint(this.http);
|
|
28532
|
+
this.searchEp = new SearchEndpoint(this.http);
|
|
28500
28533
|
this.queryEp = new QueryEndpoint(this.http);
|
|
28501
28534
|
this.offline = new OfflineEndpoint(this.http, config.deviceId, config.manifestPath);
|
|
28502
28535
|
this.interact = new InteractClient(this.http);
|
|
@@ -28506,6 +28539,32 @@ var Chrt = class {
|
|
|
28506
28539
|
async features(options) {
|
|
28507
28540
|
return this.featuresEp.list(options);
|
|
28508
28541
|
}
|
|
28542
|
+
/**
|
|
28543
|
+
* CHRTsearch — find charted places by name.
|
|
28544
|
+
*
|
|
28545
|
+
* The only CHRT surface addressed by NAME rather than by space or identifier.
|
|
28546
|
+
* Text in, a small ranked list of named charted places out.
|
|
28547
|
+
*
|
|
28548
|
+
* ```ts
|
|
28549
|
+
* const { results } = await chrt.search({ q: "cutty harbor", near: [-70.93, 41.42] });
|
|
28550
|
+
* // -> [{ name: "Cuttyhunk Harbor Channel", class: "Fairway", kind: "place", ... }]
|
|
28551
|
+
* ```
|
|
28552
|
+
*
|
|
28553
|
+
* Three things worth knowing before wiring it to a text field:
|
|
28554
|
+
*
|
|
28555
|
+
* 1. **Pass `near`.** It biases ranking and never filters. "Newport" is
|
|
28556
|
+
* Rhode Island, Oregon *and* California; without `near` the first row is
|
|
28557
|
+
* the wrong Newport most of the time.
|
|
28558
|
+
* 2. **It is metered separately** from `features()` — exhausting one does not
|
|
28559
|
+
* affect the other. Sized for a typeahead, and not gated by tier.
|
|
28560
|
+
* 3. **An empty `results` array is not proof a place does not exist.** If the
|
|
28561
|
+
* response carries a `coverage` block, CHRT holds no charts at that
|
|
28562
|
+
* position and the search could not run there. That is a different answer
|
|
28563
|
+
* from "nothing matched", and neither means the water is clear.
|
|
28564
|
+
*/
|
|
28565
|
+
async search(options) {
|
|
28566
|
+
return this.searchEp.find(options);
|
|
28567
|
+
}
|
|
28509
28568
|
/** Spatial proximity query around a point */
|
|
28510
28569
|
async query(options) {
|
|
28511
28570
|
return this.queryEp.nearby(options);
|