@honua/react 0.0.20-alpha.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 +201 -0
- package/README.md +9 -0
- package/contract/analytics-sources.d.ts +149 -0
- package/contract/analytics-sources.d.ts.map +1 -0
- package/contract/analytics-sources.js +235 -0
- package/contract/edit-session.d.ts +203 -0
- package/contract/edit-session.d.ts.map +1 -0
- package/contract/edit-session.js +760 -0
- package/contract/edit-sketch.d.ts +91 -0
- package/contract/edit-sketch.d.ts.map +1 -0
- package/contract/edit-sketch.js +281 -0
- package/contract/index.d.ts +61 -0
- package/contract/index.d.ts.map +1 -0
- package/contract/index.js +51 -0
- package/contract/jobs.d.ts +149 -0
- package/contract/jobs.d.ts.map +1 -0
- package/contract/jobs.js +40 -0
- package/contract/source.d.ts +423 -0
- package/contract/source.d.ts.map +1 -0
- package/contract/source.js +3802 -0
- package/contract/spatial-aggregation.d.ts +336 -0
- package/contract/spatial-aggregation.d.ts.map +1 -0
- package/contract/spatial-aggregation.js +298 -0
- package/contract/temporal.d.ts +455 -0
- package/contract/temporal.d.ts.map +1 -0
- package/contract/temporal.js +146 -0
- package/contract/tiles.d.ts +370 -0
- package/contract/tiles.d.ts.map +1 -0
- package/contract/tiles.js +519 -0
- package/contract/types.d.ts +665 -0
- package/contract/types.d.ts.map +1 -0
- package/contract/types.js +175 -0
- package/contract/widget-source.d.ts +205 -0
- package/contract/widget-source.d.ts.map +1 -0
- package/contract/widget-source.js +1473 -0
- package/control-plane/client.d.ts +95 -0
- package/control-plane/client.d.ts.map +1 -0
- package/control-plane/client.js +374 -0
- package/control-plane/index.d.ts +18 -0
- package/control-plane/index.d.ts.map +1 -0
- package/control-plane/index.js +14 -0
- package/control-plane/types.d.ts +233 -0
- package/control-plane/types.d.ts.map +1 -0
- package/control-plane/types.js +7 -0
- package/core/batch.d.ts +37 -0
- package/core/batch.d.ts.map +1 -0
- package/core/batch.js +79 -0
- package/core/cache-state.d.ts +79 -0
- package/core/cache-state.d.ts.map +1 -0
- package/core/cache-state.js +87 -0
- package/core/client.d.ts +577 -0
- package/core/client.d.ts.map +1 -0
- package/core/client.js +1664 -0
- package/core/compatibility.d.ts +18 -0
- package/core/compatibility.d.ts.map +1 -0
- package/core/compatibility.js +245 -0
- package/core/errors.d.ts +107 -0
- package/core/errors.d.ts.map +1 -0
- package/core/errors.js +156 -0
- package/core/esri-geojson.d.ts +66 -0
- package/core/esri-geojson.d.ts.map +1 -0
- package/core/esri-geojson.js +363 -0
- package/core/geoservices.d.ts +34 -0
- package/core/geoservices.d.ts.map +1 -0
- package/core/geoservices.js +434 -0
- package/core/grpc-adapter.d.ts +23 -0
- package/core/grpc-adapter.d.ts.map +1 -0
- package/core/grpc-adapter.js +688 -0
- package/core/odata.d.ts +347 -0
- package/core/odata.d.ts.map +1 -0
- package/core/odata.js +913 -0
- package/core/ogc-conformance.d.ts +35 -0
- package/core/ogc-conformance.d.ts.map +1 -0
- package/core/ogc-conformance.js +134 -0
- package/core/ogc-features.d.ts +23 -0
- package/core/ogc-features.d.ts.map +1 -0
- package/core/ogc-features.js +114 -0
- package/core/ogc-maps.d.ts +49 -0
- package/core/ogc-maps.d.ts.map +1 -0
- package/core/ogc-maps.js +126 -0
- package/core/ogc-processes.d.ts +118 -0
- package/core/ogc-processes.d.ts.map +1 -0
- package/core/ogc-processes.js +423 -0
- package/core/ogc-records.d.ts +75 -0
- package/core/ogc-records.d.ts.map +1 -0
- package/core/ogc-records.js +251 -0
- package/core/ogc-tiles.d.ts +125 -0
- package/core/ogc-tiles.d.ts.map +1 -0
- package/core/ogc-tiles.js +183 -0
- package/core/path-utils.d.ts +69 -0
- package/core/path-utils.d.ts.map +1 -0
- package/core/path-utils.js +123 -0
- package/core/pbf-decoder.d.ts +39 -0
- package/core/pbf-decoder.d.ts.map +1 -0
- package/core/pbf-decoder.js +702 -0
- package/core/process-runner.d.ts +104 -0
- package/core/process-runner.d.ts.map +1 -0
- package/core/process-runner.js +315 -0
- package/core/protocol-transport.d.ts +76 -0
- package/core/protocol-transport.d.ts.map +1 -0
- package/core/protocol-transport.js +15 -0
- package/core/query-builder.d.ts +261 -0
- package/core/query-builder.d.ts.map +1 -0
- package/core/query-builder.js +538 -0
- package/core/request-pipeline.d.ts +88 -0
- package/core/request-pipeline.d.ts.map +1 -0
- package/core/request-pipeline.js +273 -0
- package/core/spatial-filter.d.ts +93 -0
- package/core/spatial-filter.d.ts.map +1 -0
- package/core/spatial-filter.js +153 -0
- package/core/stac.d.ts +55 -0
- package/core/stac.d.ts.map +1 -0
- package/core/stac.js +229 -0
- package/core/surfaces.d.ts +527 -0
- package/core/surfaces.d.ts.map +1 -0
- package/core/surfaces.js +1917 -0
- package/core/terrain-elevation.d.ts +114 -0
- package/core/terrain-elevation.d.ts.map +1 -0
- package/core/terrain-elevation.js +150 -0
- package/core/types.d.ts +1355 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +13 -0
- package/core/wfs-capabilities.d.ts +143 -0
- package/core/wfs-capabilities.d.ts.map +1 -0
- package/core/wfs-capabilities.js +478 -0
- package/core/wfs-filter.d.ts +118 -0
- package/core/wfs-filter.d.ts.map +1 -0
- package/core/wfs-filter.js +634 -0
- package/core/wfs.d.ts +219 -0
- package/core/wfs.d.ts.map +1 -0
- package/core/wfs.js +406 -0
- package/core/wire-shared.d.ts +32 -0
- package/core/wire-shared.d.ts.map +1 -0
- package/core/wire-shared.js +76 -0
- package/core/wms-axis.d.ts +36 -0
- package/core/wms-axis.d.ts.map +1 -0
- package/core/wms-axis.js +73 -0
- package/core/wms-capabilities.d.ts +110 -0
- package/core/wms-capabilities.d.ts.map +1 -0
- package/core/wms-capabilities.js +559 -0
- package/core/wms-types.d.ts +128 -0
- package/core/wms-types.d.ts.map +1 -0
- package/core/wms-types.js +32 -0
- package/core/wms.d.ts +144 -0
- package/core/wms.d.ts.map +1 -0
- package/core/wms.js +338 -0
- package/core/wmts-capabilities.d.ts +82 -0
- package/core/wmts-capabilities.d.ts.map +1 -0
- package/core/wmts-capabilities.js +402 -0
- package/core/wmts.d.ts +103 -0
- package/core/wmts.d.ts.map +1 -0
- package/core/wmts.js +332 -0
- package/core/xml-text.d.ts +20 -0
- package/core/xml-text.d.ts.map +1 -0
- package/core/xml-text.js +85 -0
- package/esri-compat/basemap-gallery.d.ts +38 -0
- package/esri-compat/basemap-gallery.d.ts.map +1 -0
- package/esri-compat/basemap-gallery.js +159 -0
- package/esri-compat/basemap-layer-list.d.ts +35 -0
- package/esri-compat/basemap-layer-list.d.ts.map +1 -0
- package/esri-compat/basemap-layer-list.js +139 -0
- package/esri-compat/basemap.d.ts +32 -0
- package/esri-compat/basemap.d.ts.map +1 -0
- package/esri-compat/basemap.js +84 -0
- package/esri-compat/bookmarks.d.ts +36 -0
- package/esri-compat/bookmarks.d.ts.map +1 -0
- package/esri-compat/bookmarks.js +108 -0
- package/esri-compat/class-breaks-renderer.d.ts +50 -0
- package/esri-compat/class-breaks-renderer.d.ts.map +1 -0
- package/esri-compat/class-breaks-renderer.js +164 -0
- package/esri-compat/color.d.ts +22 -0
- package/esri-compat/color.d.ts.map +1 -0
- package/esri-compat/color.js +106 -0
- package/esri-compat/controls.d.ts +174 -0
- package/esri-compat/controls.d.ts.map +1 -0
- package/esri-compat/controls.js +479 -0
- package/esri-compat/coordinate-conversion.d.ts +41 -0
- package/esri-compat/coordinate-conversion.d.ts.map +1 -0
- package/esri-compat/coordinate-conversion.js +125 -0
- package/esri-compat/directions.d.ts +45 -0
- package/esri-compat/directions.d.ts.map +1 -0
- package/esri-compat/directions.js +123 -0
- package/esri-compat/editor.d.ts +47 -0
- package/esri-compat/editor.d.ts.map +1 -0
- package/esri-compat/editor.js +170 -0
- package/esri-compat/esri-config.d.ts +16 -0
- package/esri-compat/esri-config.d.ts.map +1 -0
- package/esri-compat/esri-config.js +23 -0
- package/esri-compat/esri-request.d.ts +17 -0
- package/esri-compat/esri-request.d.ts.map +1 -0
- package/esri-compat/esri-request.js +127 -0
- package/esri-compat/event-bus.d.ts +106 -0
- package/esri-compat/event-bus.d.ts.map +1 -0
- package/esri-compat/event-bus.js +90 -0
- package/esri-compat/expand.d.ts +36 -0
- package/esri-compat/expand.d.ts.map +1 -0
- package/esri-compat/expand.js +97 -0
- package/esri-compat/extent.d.ts +43 -0
- package/esri-compat/extent.d.ts.map +1 -0
- package/esri-compat/extent.js +140 -0
- package/esri-compat/feature-filter.d.ts +55 -0
- package/esri-compat/feature-filter.d.ts.map +1 -0
- package/esri-compat/feature-filter.js +109 -0
- package/esri-compat/feature-form.d.ts +64 -0
- package/esri-compat/feature-form.d.ts.map +1 -0
- package/esri-compat/feature-form.js +137 -0
- package/esri-compat/feature-layer.d.ts +173 -0
- package/esri-compat/feature-layer.d.ts.map +1 -0
- package/esri-compat/feature-layer.js +661 -0
- package/esri-compat/feature-set.d.ts +32 -0
- package/esri-compat/feature-set.d.ts.map +1 -0
- package/esri-compat/feature-set.js +80 -0
- package/esri-compat/feature-table.d.ts +141 -0
- package/esri-compat/feature-table.d.ts.map +1 -0
- package/esri-compat/feature-table.js +500 -0
- package/esri-compat/feature-templates.d.ts +41 -0
- package/esri-compat/feature-templates.d.ts.map +1 -0
- package/esri-compat/feature-templates.js +97 -0
- package/esri-compat/feature.d.ts +33 -0
- package/esri-compat/feature.d.ts.map +1 -0
- package/esri-compat/feature.js +83 -0
- package/esri-compat/geojson-layer.d.ts +86 -0
- package/esri-compat/geojson-layer.d.ts.map +1 -0
- package/esri-compat/geojson-layer.js +191 -0
- package/esri-compat/geometry-engine.d.ts +107 -0
- package/esri-compat/geometry-engine.d.ts.map +1 -0
- package/esri-compat/geometry-engine.js +266 -0
- package/esri-compat/graphic.d.ts +46 -0
- package/esri-compat/graphic.d.ts.map +1 -0
- package/esri-compat/graphic.js +103 -0
- package/esri-compat/graphics-layer.d.ts +49 -0
- package/esri-compat/graphics-layer.d.ts.map +1 -0
- package/esri-compat/graphics-layer.js +185 -0
- package/esri-compat/group-layer.d.ts +48 -0
- package/esri-compat/group-layer.d.ts.map +1 -0
- package/esri-compat/group-layer.js +212 -0
- package/esri-compat/identify.d.ts +71 -0
- package/esri-compat/identify.d.ts.map +1 -0
- package/esri-compat/identify.js +299 -0
- package/esri-compat/identity-manager.d.ts +31 -0
- package/esri-compat/identity-manager.d.ts.map +1 -0
- package/esri-compat/identity-manager.js +115 -0
- package/esri-compat/imagery-layer.d.ts +78 -0
- package/esri-compat/imagery-layer.d.ts.map +1 -0
- package/esri-compat/imagery-layer.js +167 -0
- package/esri-compat/label-class.d.ts +31 -0
- package/esri-compat/label-class.d.ts.map +1 -0
- package/esri-compat/label-class.js +102 -0
- package/esri-compat/layer-list.d.ts +77 -0
- package/esri-compat/layer-list.d.ts.map +1 -0
- package/esri-compat/layer-list.js +342 -0
- package/esri-compat/legend.d.ts +53 -0
- package/esri-compat/legend.d.ts.map +1 -0
- package/esri-compat/legend.js +254 -0
- package/esri-compat/map-image-layer.d.ts +162 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -0
- package/esri-compat/map-image-layer.js +709 -0
- package/esri-compat/map-view.d.ts +323 -0
- package/esri-compat/map-view.d.ts.map +1 -0
- package/esri-compat/map-view.js +1175 -0
- package/esri-compat/map.d.ts +47 -0
- package/esri-compat/map.d.ts.map +1 -0
- package/esri-compat/map.js +209 -0
- package/esri-compat/measurement-2d.d.ts +61 -0
- package/esri-compat/measurement-2d.d.ts.map +1 -0
- package/esri-compat/measurement-2d.js +184 -0
- package/esri-compat/measurement.d.ts +45 -0
- package/esri-compat/measurement.d.ts.map +1 -0
- package/esri-compat/measurement.js +193 -0
- package/esri-compat/oauth-info.d.ts +35 -0
- package/esri-compat/oauth-info.d.ts.map +1 -0
- package/esri-compat/oauth-info.js +115 -0
- package/esri-compat/picture-marker-symbol.d.ts +35 -0
- package/esri-compat/picture-marker-symbol.d.ts.map +1 -0
- package/esri-compat/picture-marker-symbol.js +126 -0
- package/esri-compat/point.d.ts +31 -0
- package/esri-compat/point.d.ts.map +1 -0
- package/esri-compat/point.js +102 -0
- package/esri-compat/polygon.d.ts +31 -0
- package/esri-compat/polygon.d.ts.map +1 -0
- package/esri-compat/polygon.js +107 -0
- package/esri-compat/polyline.d.ts +31 -0
- package/esri-compat/polyline.d.ts.map +1 -0
- package/esri-compat/polyline.js +107 -0
- package/esri-compat/popup-template.d.ts +55 -0
- package/esri-compat/popup-template.d.ts.map +1 -0
- package/esri-compat/popup-template.js +128 -0
- package/esri-compat/popup.d.ts +54 -0
- package/esri-compat/popup.d.ts.map +1 -0
- package/esri-compat/popup.js +312 -0
- package/esri-compat/print.d.ts +47 -0
- package/esri-compat/print.d.ts.map +1 -0
- package/esri-compat/print.js +105 -0
- package/esri-compat/query.d.ts +58 -0
- package/esri-compat/query.d.ts.map +1 -0
- package/esri-compat/query.js +128 -0
- package/esri-compat/reactive-utils.d.ts +24 -0
- package/esri-compat/reactive-utils.d.ts.map +1 -0
- package/esri-compat/reactive-utils.js +193 -0
- package/esri-compat/request.d.ts +41 -0
- package/esri-compat/request.d.ts.map +1 -0
- package/esri-compat/request.js +253 -0
- package/esri-compat/route-layer.d.ts +59 -0
- package/esri-compat/route-layer.d.ts.map +1 -0
- package/esri-compat/route-layer.js +223 -0
- package/esri-compat/route-task.d.ts +88 -0
- package/esri-compat/route-task.d.ts.map +1 -0
- package/esri-compat/route-task.js +225 -0
- package/esri-compat/scene-view.d.ts +41 -0
- package/esri-compat/scene-view.d.ts.map +1 -0
- package/esri-compat/scene-view.js +68 -0
- package/esri-compat/search.d.ts +112 -0
- package/esri-compat/search.d.ts.map +1 -0
- package/esri-compat/search.js +820 -0
- package/esri-compat/simple-fill-symbol.d.ts +27 -0
- package/esri-compat/simple-fill-symbol.d.ts.map +1 -0
- package/esri-compat/simple-fill-symbol.js +85 -0
- package/esri-compat/simple-line-symbol.d.ts +27 -0
- package/esri-compat/simple-line-symbol.d.ts.map +1 -0
- package/esri-compat/simple-line-symbol.js +85 -0
- package/esri-compat/simple-marker-symbol.d.ts +29 -0
- package/esri-compat/simple-marker-symbol.d.ts.map +1 -0
- package/esri-compat/simple-marker-symbol.js +92 -0
- package/esri-compat/simple-renderer.d.ts +29 -0
- package/esri-compat/simple-renderer.d.ts.map +1 -0
- package/esri-compat/simple-renderer.js +92 -0
- package/esri-compat/sketch.d.ts +64 -0
- package/esri-compat/sketch.d.ts.map +1 -0
- package/esri-compat/sketch.js +227 -0
- package/esri-compat/spatial-reference.d.ts +31 -0
- package/esri-compat/spatial-reference.d.ts.map +1 -0
- package/esri-compat/spatial-reference.js +102 -0
- package/esri-compat/swipe.d.ts +34 -0
- package/esri-compat/swipe.d.ts.map +1 -0
- package/esri-compat/swipe.js +93 -0
- package/esri-compat/table-list.d.ts +36 -0
- package/esri-compat/table-list.d.ts.map +1 -0
- package/esri-compat/table-list.js +126 -0
- package/esri-compat/text-symbol.d.ts +37 -0
- package/esri-compat/text-symbol.d.ts.map +1 -0
- package/esri-compat/text-symbol.js +123 -0
- package/esri-compat/tile-layer.d.ts +52 -0
- package/esri-compat/tile-layer.d.ts.map +1 -0
- package/esri-compat/tile-layer.js +168 -0
- package/esri-compat/time-slider.d.ts +70 -0
- package/esri-compat/time-slider.d.ts.map +1 -0
- package/esri-compat/time-slider.js +208 -0
- package/esri-compat/track.d.ts +51 -0
- package/esri-compat/track.d.ts.map +1 -0
- package/esri-compat/track.js +174 -0
- package/esri-compat/unique-value-renderer.d.ts +41 -0
- package/esri-compat/unique-value-renderer.d.ts.map +1 -0
- package/esri-compat/unique-value-renderer.js +127 -0
- package/esri-compat/url.d.ts +13 -0
- package/esri-compat/url.d.ts.map +1 -0
- package/esri-compat/url.js +68 -0
- package/esri-compat/vector-tile-layer.d.ts +47 -0
- package/esri-compat/vector-tile-layer.d.ts.map +1 -0
- package/esri-compat/vector-tile-layer.js +130 -0
- package/esri-compat/web-map.d.ts +14 -0
- package/esri-compat/web-map.d.ts.map +1 -0
- package/esri-compat/web-map.js +24 -0
- package/esri-compat/wfs-layer.d.ts +64 -0
- package/esri-compat/wfs-layer.d.ts.map +1 -0
- package/esri-compat/wfs-layer.js +145 -0
- package/esri-compat/wms-layer.d.ts +76 -0
- package/esri-compat/wms-layer.d.ts.map +1 -0
- package/esri-compat/wms-layer.js +157 -0
- package/exploration/context.d.ts +25 -0
- package/exploration/context.d.ts.map +1 -0
- package/exploration/context.js +396 -0
- package/exploration/index.d.ts +27 -0
- package/exploration/index.d.ts.map +1 -0
- package/exploration/index.js +24 -0
- package/exploration/presets.d.ts +27 -0
- package/exploration/presets.d.ts.map +1 -0
- package/exploration/presets.js +114 -0
- package/exploration/reducer.d.ts +23 -0
- package/exploration/reducer.d.ts.map +1 -0
- package/exploration/reducer.js +332 -0
- package/exploration/selection.d.ts +25 -0
- package/exploration/selection.d.ts.map +1 -0
- package/exploration/selection.js +34 -0
- package/exploration/selectors.d.ts +56 -0
- package/exploration/selectors.d.ts.map +1 -0
- package/exploration/selectors.js +110 -0
- package/exploration/types.d.ts +294 -0
- package/exploration/types.d.ts.map +1 -0
- package/exploration/types.js +33 -0
- package/expr/expression.d.ts +457 -0
- package/expr/expression.d.ts.map +1 -0
- package/expr/expression.js +663 -0
- package/expr/index.d.ts +32 -0
- package/expr/index.d.ts.map +1 -0
- package/expr/index.js +30 -0
- package/gen/honua/v1/feature_service_pb.d.ts +918 -0
- package/gen/honua/v1/feature_service_pb.d.ts.map +1 -0
- package/gen/honua/v1/feature_service_pb.js +375 -0
- package/generated-app/errors.d.ts +41 -0
- package/generated-app/errors.d.ts.map +1 -0
- package/generated-app/errors.js +41 -0
- package/generated-app/index.d.ts +17 -0
- package/generated-app/index.d.ts.map +1 -0
- package/generated-app/index.js +12 -0
- package/generated-app/manifest.d.ts +183 -0
- package/generated-app/manifest.d.ts.map +1 -0
- package/generated-app/manifest.js +14 -0
- package/generated-app/projection.d.ts +44 -0
- package/generated-app/projection.d.ts.map +1 -0
- package/generated-app/projection.js +234 -0
- package/generated-app/runtime.d.ts +215 -0
- package/generated-app/runtime.d.ts.map +1 -0
- package/generated-app/runtime.js +1196 -0
- package/interactions/detail-model.d.ts +54 -0
- package/interactions/detail-model.d.ts.map +1 -0
- package/interactions/detail-model.js +105 -0
- package/interactions/exploration-bindings.d.ts +120 -0
- package/interactions/exploration-bindings.d.ts.map +1 -0
- package/interactions/exploration-bindings.js +218 -0
- package/interactions/feature-state.d.ts +144 -0
- package/interactions/feature-state.d.ts.map +1 -0
- package/interactions/feature-state.js +169 -0
- package/interactions/hit-test.d.ts +112 -0
- package/interactions/hit-test.d.ts.map +1 -0
- package/interactions/hit-test.js +291 -0
- package/interactions/index.d.ts +31 -0
- package/interactions/index.d.ts.map +1 -0
- package/interactions/index.js +24 -0
- package/interactions/share-state.d.ts +36 -0
- package/interactions/share-state.d.ts.map +1 -0
- package/interactions/share-state.js +123 -0
- package/map/feature-service-adapter.d.ts +138 -0
- package/map/feature-service-adapter.d.ts.map +1 -0
- package/map/feature-service-adapter.js +279 -0
- package/map/honua-map.d.ts +203 -0
- package/map/honua-map.d.ts.map +1 -0
- package/map/honua-map.js +347 -0
- package/map/index.d.ts +27 -0
- package/map/index.d.ts.map +1 -0
- package/map/index.js +22 -0
- package/map/maplibre-target.d.ts +103 -0
- package/map/maplibre-target.d.ts.map +1 -0
- package/map/maplibre-target.js +164 -0
- package/map/webmap-maplibre.d.ts +60 -0
- package/map/webmap-maplibre.d.ts.map +1 -0
- package/map/webmap-maplibre.js +212 -0
- package/package.json +37 -0
- package/react/context.d.ts +32 -0
- package/react/context.d.ts.map +1 -0
- package/react/context.js +19 -0
- package/react/honua-layer.d.ts +35 -0
- package/react/honua-layer.d.ts.map +1 -0
- package/react/honua-layer.js +47 -0
- package/react/honua-map.d.ts +83 -0
- package/react/honua-map.d.ts.map +1 -0
- package/react/honua-map.js +109 -0
- package/react/honua-popup.d.ts +26 -0
- package/react/honua-popup.d.ts.map +1 -0
- package/react/honua-popup.js +34 -0
- package/react/hooks.d.ts +127 -0
- package/react/hooks.d.ts.map +1 -0
- package/react/hooks.js +206 -0
- package/react/index.d.ts +42 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +34 -0
- package/react/provider.d.ts +36 -0
- package/react/provider.d.ts.map +1 -0
- package/react/provider.js +35 -0
- package/react/query-cache.d.ts +76 -0
- package/react/query-cache.d.ts.map +1 -0
- package/react/query-cache.js +188 -0
- package/runtime/diff.d.ts +31 -0
- package/runtime/diff.d.ts.map +1 -0
- package/runtime/diff.js +143 -0
- package/runtime/errors.d.ts +40 -0
- package/runtime/errors.d.ts.map +1 -0
- package/runtime/errors.js +35 -0
- package/runtime/index.d.ts +59 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +43 -0
- package/runtime/legend.d.ts +23 -0
- package/runtime/legend.d.ts.map +1 -0
- package/runtime/legend.js +38 -0
- package/runtime/load-package.d.ts +125 -0
- package/runtime/load-package.d.ts.map +1 -0
- package/runtime/load-package.js +264 -0
- package/runtime/map-package-fetch.d.ts +107 -0
- package/runtime/map-package-fetch.d.ts.map +1 -0
- package/runtime/map-package-fetch.js +336 -0
- package/runtime/map-package-realtime.d.ts +169 -0
- package/runtime/map-package-realtime.d.ts.map +1 -0
- package/runtime/map-package-realtime.js +350 -0
- package/runtime/map-package-validation.d.ts +43 -0
- package/runtime/map-package-validation.d.ts.map +1 -0
- package/runtime/map-package-validation.js +269 -0
- package/runtime/map-package-watch.d.ts +78 -0
- package/runtime/map-package-watch.d.ts.map +1 -0
- package/runtime/map-package-watch.js +695 -0
- package/runtime/map-package.d.ts +167 -0
- package/runtime/map-package.d.ts.map +1 -0
- package/runtime/map-package.js +15 -0
- package/runtime/ogc-styles.d.ts +110 -0
- package/runtime/ogc-styles.d.ts.map +1 -0
- package/runtime/ogc-styles.js +195 -0
- package/runtime/popups.d.ts +62 -0
- package/runtime/popups.d.ts.map +1 -0
- package/runtime/popups.js +95 -0
- package/runtime/query-tiles.d.ts +217 -0
- package/runtime/query-tiles.d.ts.map +1 -0
- package/runtime/query-tiles.js +801 -0
- package/runtime/runtime.d.ts +243 -0
- package/runtime/runtime.d.ts.map +1 -0
- package/runtime/runtime.js +1147 -0
- package/runtime/source-bridge.d.ts +99 -0
- package/runtime/source-bridge.d.ts.map +1 -0
- package/runtime/source-bridge.js +401 -0
- package/runtime/style-compose.d.ts +46 -0
- package/runtime/style-compose.d.ts.map +1 -0
- package/runtime/style-compose.js +144 -0
- package/runtime/style-interactions.d.ts +141 -0
- package/runtime/style-interactions.d.ts.map +1 -0
- package/runtime/style-interactions.js +574 -0
- package/runtime/style-spec-validation.d.ts +23 -0
- package/runtime/style-spec-validation.d.ts.map +1 -0
- package/runtime/style-spec-validation.js +357 -0
- package/studio/capability-manifest.d.ts +285 -0
- package/studio/capability-manifest.d.ts.map +1 -0
- package/studio/capability-manifest.js +59 -0
- package/studio/chart-spec.d.ts +85 -0
- package/studio/chart-spec.d.ts.map +1 -0
- package/studio/chart-spec.js +106 -0
- package/studio/index.d.ts +34 -0
- package/studio/index.d.ts.map +1 -0
- package/studio/index.js +27 -0
- package/studio/provenance.d.ts +131 -0
- package/studio/provenance.d.ts.map +1 -0
- package/studio/provenance.js +39 -0
- package/studio/publish.d.ts +64 -0
- package/studio/publish.d.ts.map +1 -0
- package/studio/publish.js +13 -0
- package/studio/types.d.ts +278 -0
- package/studio/types.d.ts.map +1 -0
- package/studio/types.js +71 -0
- package/studio/validate.d.ts +45 -0
- package/studio/validate.d.ts.map +1 -0
- package/studio/validate.js +255 -0
- package/studio/validation.d.ts +112 -0
- package/studio/validation.d.ts.map +1 -0
- package/studio/validation.js +42 -0
- package/style/factory.d.ts +30 -0
- package/style/factory.d.ts.map +1 -0
- package/style/factory.js +61 -0
- package/style/index.d.ts +25 -0
- package/style/index.d.ts.map +1 -0
- package/style/index.js +24 -0
- package/style/specification.d.ts +203 -0
- package/style/specification.d.ts.map +1 -0
- package/style/specification.js +178 -0
- package/style/wms-wmts-resolvers.d.ts +38 -0
- package/style/wms-wmts-resolvers.d.ts.map +1 -0
- package/style/wms-wmts-resolvers.js +92 -0
- package/webmap/contract.d.ts +28 -0
- package/webmap/contract.d.ts.map +1 -0
- package/webmap/contract.js +130 -0
- package/webmap/convert-basemap.d.ts +17 -0
- package/webmap/convert-basemap.d.ts.map +1 -0
- package/webmap/convert-basemap.js +78 -0
- package/webmap/convert-extent.d.ts +17 -0
- package/webmap/convert-extent.d.ts.map +1 -0
- package/webmap/convert-extent.js +114 -0
- package/webmap/convert-label.d.ts +13 -0
- package/webmap/convert-label.d.ts.map +1 -0
- package/webmap/convert-label.js +125 -0
- package/webmap/convert-layer.d.ts +22 -0
- package/webmap/convert-layer.d.ts.map +1 -0
- package/webmap/convert-layer.js +181 -0
- package/webmap/convert-popup.d.ts +34 -0
- package/webmap/convert-popup.d.ts.map +1 -0
- package/webmap/convert-popup.js +68 -0
- package/webmap/convert-renderer.d.ts +17 -0
- package/webmap/convert-renderer.d.ts.map +1 -0
- package/webmap/convert-renderer.js +161 -0
- package/webmap/convert-symbol.d.ts +17 -0
- package/webmap/convert-symbol.d.ts.map +1 -0
- package/webmap/convert-symbol.js +122 -0
- package/webmap/index.d.ts +44 -0
- package/webmap/index.d.ts.map +1 -0
- package/webmap/index.js +33 -0
- package/webmap/parse.d.ts +25 -0
- package/webmap/parse.d.ts.map +1 -0
- package/webmap/parse.js +83 -0
- package/webmap/types.d.ts +264 -0
- package/webmap/types.d.ts.map +1 -0
- package/webmap/types.js +13 -0
- package/webmap/warnings.d.ts +30 -0
- package/webmap/warnings.d.ts.map +1 -0
- package/webmap/warnings.js +37 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, DOM-free helpers for decoding RGB-encoded elevation tiles and
|
|
3
|
+
* sampling an elevation profile along a line.
|
|
4
|
+
*
|
|
5
|
+
* Two encodings dominate Terrain-RGB / raster-DEM tiles in the wild:
|
|
6
|
+
*
|
|
7
|
+
* - **Mapbox Terrain-RGB** — `elevation = -10000 + ((R*256*256 + G*256 + B) * 0.1)`
|
|
8
|
+
* metres. This is the encoding MapLibre's `raster-dem` source uses with
|
|
9
|
+
* `encoding: "mapbox"`.
|
|
10
|
+
* - **Terrarium (Mapzen / AWS Terrain Tiles)** — `elevation = (R*256 + G + B/256) - 32768`
|
|
11
|
+
* metres, used by MapLibre with `encoding: "terrarium"`.
|
|
12
|
+
*
|
|
13
|
+
* These functions are intentionally free of any map or DOM dependency so
|
|
14
|
+
* they can run anywhere (browser, Node, workers) and be unit-tested against
|
|
15
|
+
* known pixel → elevation values. `sampleElevationProfile` walks a line and
|
|
16
|
+
* resolves an elevation at each sampled coordinate through a caller-supplied
|
|
17
|
+
* accessor (e.g. a decoded raster lookup or a server elevation endpoint),
|
|
18
|
+
* returning per-sample distance + elevation plus gain/loss summary stats.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
/** A `[longitude, latitude]` coordinate pair in degrees (WGS84). */
|
|
23
|
+
export type ElevationCoordinate = readonly [longitude: number, latitude: number];
|
|
24
|
+
/**
|
|
25
|
+
* Decodes a single Mapbox Terrain-RGB pixel into metres above sea level.
|
|
26
|
+
*
|
|
27
|
+
* `height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)`
|
|
28
|
+
*
|
|
29
|
+
* Channel values are clamped to the 0–255 byte range, so callers may pass
|
|
30
|
+
* raw `ImageData`/`Uint8ClampedArray` samples directly.
|
|
31
|
+
*/
|
|
32
|
+
export declare function decodeTerrainRgbElevation(red: number, green: number, blue: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* Decodes a single Terrarium (Mapzen / AWS Terrain Tiles) pixel into metres
|
|
35
|
+
* above sea level.
|
|
36
|
+
*
|
|
37
|
+
* `height = (R * 256 + G + B / 256) - 32768`
|
|
38
|
+
*
|
|
39
|
+
* Channel values are clamped to the 0–255 byte range.
|
|
40
|
+
*/
|
|
41
|
+
export declare function decodeTerrariumElevation(red: number, green: number, blue: number): number;
|
|
42
|
+
/** Terrain-RGB pixel encodings supported by {@link decodeElevationPixel}. */
|
|
43
|
+
export type TerrainElevationEncoding = "mapbox" | "terrarium";
|
|
44
|
+
/**
|
|
45
|
+
* Decodes a Terrain-RGB pixel using the named encoding. Convenience wrapper
|
|
46
|
+
* over {@link decodeTerrainRgbElevation} / {@link decodeTerrariumElevation}
|
|
47
|
+
* for code that carries a MapLibre `raster-dem` `encoding` value.
|
|
48
|
+
*/
|
|
49
|
+
export declare function decodeElevationPixel(encoding: TerrainElevationEncoding, red: number, green: number, blue: number): number;
|
|
50
|
+
/** One sampled point of an elevation profile. */
|
|
51
|
+
export interface ElevationProfileSample {
|
|
52
|
+
/** Sampled coordinate `[longitude, latitude]`. */
|
|
53
|
+
readonly coordinate: ElevationCoordinate;
|
|
54
|
+
/** Cumulative great-circle distance from the line start, in metres. */
|
|
55
|
+
readonly distanceMeters: number;
|
|
56
|
+
/** Elevation in metres returned by the sampler for this coordinate. */
|
|
57
|
+
readonly elevationMeters: number;
|
|
58
|
+
}
|
|
59
|
+
/** An elevation profile sampled along a line. */
|
|
60
|
+
export interface ElevationProfile {
|
|
61
|
+
/** The line that was sampled (the input, verbatim). */
|
|
62
|
+
readonly line: readonly ElevationCoordinate[];
|
|
63
|
+
/** The sampled points, ordered from line start to end. */
|
|
64
|
+
readonly samples: readonly ElevationProfileSample[];
|
|
65
|
+
/** Total great-circle length of the line, in metres. */
|
|
66
|
+
readonly totalDistanceMeters: number;
|
|
67
|
+
/** Lowest sampled elevation, in metres (0 when there are no samples). */
|
|
68
|
+
readonly minElevationMeters: number;
|
|
69
|
+
/** Highest sampled elevation, in metres (0 when there are no samples). */
|
|
70
|
+
readonly maxElevationMeters: number;
|
|
71
|
+
/** Cumulative elevation gain across consecutive samples, in metres. */
|
|
72
|
+
readonly gainMeters: number;
|
|
73
|
+
/** Cumulative elevation loss across consecutive samples, in metres. */
|
|
74
|
+
readonly lossMeters: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves an elevation (metres) for a sampled coordinate. May be sync or
|
|
78
|
+
* async — a decoded raster lookup, a server elevation endpoint, or anything
|
|
79
|
+
* else. Receives the sample index and cumulative distance for convenience.
|
|
80
|
+
* Return a non-finite value (e.g. `NaN`) to mark a coordinate as no-data; it
|
|
81
|
+
* is treated as `0` in the profile summary.
|
|
82
|
+
*/
|
|
83
|
+
export type ElevationSampler = (coordinate: ElevationCoordinate, context: {
|
|
84
|
+
readonly index: number;
|
|
85
|
+
readonly distanceMeters: number;
|
|
86
|
+
}) => number | Promise<number>;
|
|
87
|
+
/** Options for {@link sampleElevationProfile}. */
|
|
88
|
+
export interface SampleElevationProfileOptions {
|
|
89
|
+
/** The polyline to sample, as `[lon, lat]` vertices (>= 2 required). */
|
|
90
|
+
readonly line: readonly ElevationCoordinate[];
|
|
91
|
+
/** How elevation is resolved at each sampled coordinate. */
|
|
92
|
+
readonly sampler: ElevationSampler;
|
|
93
|
+
/**
|
|
94
|
+
* Number of evenly spaced samples (including both endpoints). Defaults to
|
|
95
|
+
* `Math.max(2, line.length)`. Clamped to a minimum of 2.
|
|
96
|
+
*/
|
|
97
|
+
readonly sampleCount?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Samples elevation at evenly spaced points along a line and returns a
|
|
101
|
+
* profile with per-sample distance + elevation plus gain/loss/min/max stats.
|
|
102
|
+
*
|
|
103
|
+
* The line is resampled into `sampleCount` points spaced by equal
|
|
104
|
+
* great-circle distance (not by vertex), so the profile is independent of how
|
|
105
|
+
* densely the input line is digitized. Elevation at each point comes from the
|
|
106
|
+
* supplied {@link ElevationSampler}; samplers may be async and are awaited in
|
|
107
|
+
* order. No DOM or map dependency.
|
|
108
|
+
*
|
|
109
|
+
* @throws {RangeError} when `line` has fewer than two coordinates.
|
|
110
|
+
*/
|
|
111
|
+
export declare function sampleElevationProfile(options: SampleElevationProfileOptions): Promise<ElevationProfile>;
|
|
112
|
+
/** Great-circle distance between two `[lon, lat]` coordinates, in metres. */
|
|
113
|
+
export declare function haversineMeters([lon1, lat1]: ElevationCoordinate, [lon2, lat2]: ElevationCoordinate): number;
|
|
114
|
+
//# sourceMappingURL=terrain-elevation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terrain-elevation.d.ts","sourceRoot":"","sources":["../../../src/core/terrain-elevation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,oEAAoE;AACpE,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEjF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK1F;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzF;AAED,6EAA6E;AAC7E,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,wBAAwB,EAClC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM,CAIR;AAED,iDAAiD;AACjD,MAAM,WAAW,sBAAsB;IACrC,kDAAkD;IAClD,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,uEAAuE;IACvE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,uEAAuE;IACvE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9C,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACpD,wDAAwD;IACxD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,0EAA0E;IAC1E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,mBAAmB,EAC/B,OAAO,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,KACjE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9B,kDAAkD;AAClD,MAAM,WAAW,6BAA6B;IAC5C,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9C,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuB9G;AA6CD,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,mBAAmB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAO5G"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, DOM-free helpers for decoding RGB-encoded elevation tiles and
|
|
3
|
+
* sampling an elevation profile along a line.
|
|
4
|
+
*
|
|
5
|
+
* Two encodings dominate Terrain-RGB / raster-DEM tiles in the wild:
|
|
6
|
+
*
|
|
7
|
+
* - **Mapbox Terrain-RGB** — `elevation = -10000 + ((R*256*256 + G*256 + B) * 0.1)`
|
|
8
|
+
* metres. This is the encoding MapLibre's `raster-dem` source uses with
|
|
9
|
+
* `encoding: "mapbox"`.
|
|
10
|
+
* - **Terrarium (Mapzen / AWS Terrain Tiles)** — `elevation = (R*256 + G + B/256) - 32768`
|
|
11
|
+
* metres, used by MapLibre with `encoding: "terrarium"`.
|
|
12
|
+
*
|
|
13
|
+
* These functions are intentionally free of any map or DOM dependency so
|
|
14
|
+
* they can run anywhere (browser, Node, workers) and be unit-tested against
|
|
15
|
+
* known pixel → elevation values. `sampleElevationProfile` walks a line and
|
|
16
|
+
* resolves an elevation at each sampled coordinate through a caller-supplied
|
|
17
|
+
* accessor (e.g. a decoded raster lookup or a server elevation endpoint),
|
|
18
|
+
* returning per-sample distance + elevation plus gain/loss summary stats.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
/** Mean Earth radius in metres, used for great-circle distance. */
|
|
23
|
+
const EARTH_RADIUS_METERS = 6_371_000;
|
|
24
|
+
/**
|
|
25
|
+
* Decodes a single Mapbox Terrain-RGB pixel into metres above sea level.
|
|
26
|
+
*
|
|
27
|
+
* `height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)`
|
|
28
|
+
*
|
|
29
|
+
* Channel values are clamped to the 0–255 byte range, so callers may pass
|
|
30
|
+
* raw `ImageData`/`Uint8ClampedArray` samples directly.
|
|
31
|
+
*/
|
|
32
|
+
export function decodeTerrainRgbElevation(red, green, blue) {
|
|
33
|
+
const r = clampByte(red);
|
|
34
|
+
const g = clampByte(green);
|
|
35
|
+
const b = clampByte(blue);
|
|
36
|
+
return -10_000 + (r * 256 * 256 + g * 256 + b) * 0.1;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Decodes a single Terrarium (Mapzen / AWS Terrain Tiles) pixel into metres
|
|
40
|
+
* above sea level.
|
|
41
|
+
*
|
|
42
|
+
* `height = (R * 256 + G + B / 256) - 32768`
|
|
43
|
+
*
|
|
44
|
+
* Channel values are clamped to the 0–255 byte range.
|
|
45
|
+
*/
|
|
46
|
+
export function decodeTerrariumElevation(red, green, blue) {
|
|
47
|
+
const r = clampByte(red);
|
|
48
|
+
const g = clampByte(green);
|
|
49
|
+
const b = clampByte(blue);
|
|
50
|
+
return r * 256 + g + b / 256 - 32_768;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Decodes a Terrain-RGB pixel using the named encoding. Convenience wrapper
|
|
54
|
+
* over {@link decodeTerrainRgbElevation} / {@link decodeTerrariumElevation}
|
|
55
|
+
* for code that carries a MapLibre `raster-dem` `encoding` value.
|
|
56
|
+
*/
|
|
57
|
+
export function decodeElevationPixel(encoding, red, green, blue) {
|
|
58
|
+
return encoding === "terrarium"
|
|
59
|
+
? decodeTerrariumElevation(red, green, blue)
|
|
60
|
+
: decodeTerrainRgbElevation(red, green, blue);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Samples elevation at evenly spaced points along a line and returns a
|
|
64
|
+
* profile with per-sample distance + elevation plus gain/loss/min/max stats.
|
|
65
|
+
*
|
|
66
|
+
* The line is resampled into `sampleCount` points spaced by equal
|
|
67
|
+
* great-circle distance (not by vertex), so the profile is independent of how
|
|
68
|
+
* densely the input line is digitized. Elevation at each point comes from the
|
|
69
|
+
* supplied {@link ElevationSampler}; samplers may be async and are awaited in
|
|
70
|
+
* order. No DOM or map dependency.
|
|
71
|
+
*
|
|
72
|
+
* @throws {RangeError} when `line` has fewer than two coordinates.
|
|
73
|
+
*/
|
|
74
|
+
export async function sampleElevationProfile(options) {
|
|
75
|
+
const { line, sampler } = options;
|
|
76
|
+
if (line.length < 2) {
|
|
77
|
+
throw new RangeError("sampleElevationProfile requires a line with at least two coordinates.");
|
|
78
|
+
}
|
|
79
|
+
const segmentLengths = line.slice(1).map((point, index) => haversineMeters(line[index], point));
|
|
80
|
+
const totalDistanceMeters = segmentLengths.reduce((sum, value) => sum + value, 0);
|
|
81
|
+
const sampleCount = Math.max(2, Math.trunc(options.sampleCount ?? Math.max(2, line.length)));
|
|
82
|
+
const samples = [];
|
|
83
|
+
for (let index = 0; index < sampleCount; index += 1) {
|
|
84
|
+
const distanceMeters = totalDistanceMeters * (index / (sampleCount - 1));
|
|
85
|
+
const coordinate = interpolateAlongLine(line, segmentLengths, distanceMeters);
|
|
86
|
+
const elevation = await sampler(coordinate, { index, distanceMeters });
|
|
87
|
+
samples.push({
|
|
88
|
+
coordinate,
|
|
89
|
+
distanceMeters,
|
|
90
|
+
elevationMeters: Number.isFinite(elevation) ? elevation : 0,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return summarize(line, samples, totalDistanceMeters);
|
|
94
|
+
}
|
|
95
|
+
function summarize(line, samples, totalDistanceMeters) {
|
|
96
|
+
const elevations = samples.map((sample) => sample.elevationMeters);
|
|
97
|
+
let gainMeters = 0;
|
|
98
|
+
let lossMeters = 0;
|
|
99
|
+
for (let index = 1; index < elevations.length; index += 1) {
|
|
100
|
+
const delta = elevations[index] - elevations[index - 1];
|
|
101
|
+
if (delta > 0)
|
|
102
|
+
gainMeters += delta;
|
|
103
|
+
else
|
|
104
|
+
lossMeters += Math.abs(delta);
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
line,
|
|
108
|
+
samples,
|
|
109
|
+
totalDistanceMeters,
|
|
110
|
+
minElevationMeters: elevations.length > 0 ? Math.min(...elevations) : 0,
|
|
111
|
+
maxElevationMeters: elevations.length > 0 ? Math.max(...elevations) : 0,
|
|
112
|
+
gainMeters,
|
|
113
|
+
lossMeters,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function interpolateAlongLine(line, segmentLengths, targetDistance) {
|
|
117
|
+
let traversed = 0;
|
|
118
|
+
for (let index = 0; index < segmentLengths.length; index += 1) {
|
|
119
|
+
const segmentLength = segmentLengths[index];
|
|
120
|
+
if (targetDistance <= traversed + segmentLength || index === segmentLengths.length - 1) {
|
|
121
|
+
const start = line[index];
|
|
122
|
+
const end = line[index + 1];
|
|
123
|
+
const ratio = segmentLength === 0 ? 0 : (targetDistance - traversed) / segmentLength;
|
|
124
|
+
return [start[0] + (end[0] - start[0]) * ratio, start[1] + (end[1] - start[1]) * ratio];
|
|
125
|
+
}
|
|
126
|
+
traversed += segmentLength;
|
|
127
|
+
}
|
|
128
|
+
return line.at(-1);
|
|
129
|
+
}
|
|
130
|
+
/** Great-circle distance between two `[lon, lat]` coordinates, in metres. */
|
|
131
|
+
export function haversineMeters([lon1, lat1], [lon2, lat2]) {
|
|
132
|
+
const phi1 = degreesToRadians(lat1);
|
|
133
|
+
const phi2 = degreesToRadians(lat2);
|
|
134
|
+
const deltaPhi = degreesToRadians(lat2 - lat1);
|
|
135
|
+
const deltaLambda = degreesToRadians(lon2 - lon1);
|
|
136
|
+
const a = Math.sin(deltaPhi / 2) ** 2 + Math.cos(phi1) * Math.cos(phi2) * Math.sin(deltaLambda / 2) ** 2;
|
|
137
|
+
return EARTH_RADIUS_METERS * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
138
|
+
}
|
|
139
|
+
function degreesToRadians(value) {
|
|
140
|
+
return (value * Math.PI) / 180;
|
|
141
|
+
}
|
|
142
|
+
function clampByte(value) {
|
|
143
|
+
if (!Number.isFinite(value))
|
|
144
|
+
return 0;
|
|
145
|
+
if (value < 0)
|
|
146
|
+
return 0;
|
|
147
|
+
if (value > 255)
|
|
148
|
+
return 255;
|
|
149
|
+
return value;
|
|
150
|
+
}
|