@arcgis/core 5.0.0-next.42 → 5.0.0-next.44
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/applications/Components/imageryUtils.js +1 -1
- package/arcade/featureset/sources/FeatureLayerOGC.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
- package/assets/esri/core/workers/chunks/00ff4ca88c9d291d82c3.js +1 -0
- package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +1 -0
- package/assets/esri/core/workers/chunks/{c320a29df40e85fb4a8e.js → 15a0750c10b510564a42.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d95f38da21f97214f83.js → 1e0e7cef7ef947894bbe.js} +10 -10
- package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
- package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
- package/assets/esri/core/workers/chunks/{816227de5bd42b437df4.js → 233f9eb617f3d72995b5.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb9643b74cf35221ff98.js → 249504f7d356be80d214.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
- package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
- package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
- package/assets/esri/core/workers/chunks/{4f4d51181ae7db9fbe6d.js → 4404b6f931f681cca342.js} +1 -1
- package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +1 -0
- package/assets/esri/core/workers/chunks/6e8925412fb90f88d688.js +1 -0
- package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
- package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
- package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
- package/assets/esri/core/workers/chunks/83da9ee6544ee9d3c124.js +1 -0
- package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
- package/assets/esri/core/workers/chunks/{da517b4b07d4d27ce94c.js → 8e26831f71634288f834.js} +1 -1
- package/assets/esri/core/workers/chunks/{c367c7e553be3682f2db.js → 93c5f097bb7b380bb175.js} +1 -1
- package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
- package/assets/esri/core/workers/chunks/9c7682b300b877f60095.js +1 -0
- package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
- package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
- package/assets/esri/core/workers/chunks/{f3b3b193959db809c8c6.js → ab520fd1ae917daf07d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c9865e34f32fb5683e5.js → af8d6e6949930d0e6c7b.js} +1 -1
- package/assets/esri/core/workers/chunks/c9942ca57f542582ab4d.js +1 -0
- package/assets/esri/core/workers/chunks/ca1c65eb7f5900c60170.js +1 -0
- package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
- package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +1 -0
- package/assets/esri/core/workers/chunks/e5a6a646f27715152714.js +1 -0
- package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
- package/assets/esri/core/workers/chunks/e8a9971c8354569cb81d.js +1 -0
- package/assets/esri/core/workers/chunks/{96f798ee286b59396131.js → ea3cba01c60d9bc72719.js} +1 -1
- package/assets/esri/core/workers/chunks/ed550bf27f2bbf8d30fa.js +1 -0
- package/assets/esri/core/workers/chunks/ee186ddbb1eb5144a790.js +1 -0
- package/assets/esri/core/workers/chunks/{1357cc637524cd254974.js → ffcdc7ae03b0570e0db8.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/config.js +1 -1
- package/core/PooledArray.js +1 -1
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/interfaces.d.ts +109 -37
- package/kernel.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +1 -1
- package/layers/ogc/wcsUtils.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +5 -0
- package/layers/raster/datasets/CovJSONRaster.js +5 -0
- package/layers/raster/datasets/FunctionRaster.js +5 -0
- package/layers/raster/datasets/ImageAuxRaster.js +5 -0
- package/layers/raster/datasets/ImageServerRaster.js +5 -0
- package/layers/raster/datasets/InMemoryRaster.js +5 -0
- package/layers/raster/datasets/MRFRaster.js +5 -0
- package/layers/raster/datasets/RawBlockCache.js +5 -0
- package/layers/raster/datasets/TIFFRaster.js +5 -0
- package/layers/raster/datasets/WCSRaster.js +5 -0
- package/layers/raster/datasets/covJSONParser.js +5 -0
- package/layers/raster/datasets/multidimensionalUtils.js +5 -0
- package/layers/raster/datasets/pamParser.js +5 -0
- package/layers/raster/datasets/pixelReader.js +5 -0
- package/layers/raster/datasets/wcsCoverageParser.js +5 -0
- package/layers/raster/formats/Lerc.js +5 -0
- package/layers/raster/formats/Qb3.js +5 -0
- package/layers/raster/formats/RasterCodec.js +5 -0
- package/layers/raster/formats/TiffDecoder.js +5 -0
- package/layers/raster/functions/ArithmeticFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
- package/layers/raster/functions/BandArithmeticFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
- package/layers/raster/functions/BaseRasterFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
- package/layers/raster/functions/ColormapFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
- package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
- package/layers/raster/functions/CompositeBandFunction.js +5 -0
- package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
- package/layers/raster/functions/ComputeChangeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
- package/layers/raster/functions/ConvolutionFunction.js +5 -0
- package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
- package/layers/raster/functions/HillshadeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
- package/layers/raster/functions/LocalFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
- package/layers/raster/functions/RemapFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
- package/layers/raster/functions/ShadedReliefFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
- package/layers/raster/functions/SlopeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
- package/layers/raster/functions/StatisticsFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
- package/layers/raster/functions/StretchFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
- package/layers/raster/functions/bandIndexUtils.js +5 -0
- package/layers/raster/functions/changeDetectionUtils.js +5 -0
- package/layers/raster/functions/clipUtils.js +5 -0
- package/layers/raster/functions/conversionUtils.js +5 -0
- package/layers/raster/functions/convolutionUtils.js +5 -0
- package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
- package/layers/raster/functions/creators/utils.js +5 -0
- package/layers/raster/functions/focalStatUtils.js +5 -0
- package/layers/raster/functions/localUtils.js +5 -0
- package/layers/raster/functions/pixelTransformUtils.js +5 -0
- package/layers/raster/functions/pixelUtils.js +5 -0
- package/layers/raster/functions/stretchUtils.js +5 -0
- package/layers/raster/functions/surfaceUtils.js +5 -0
- package/layers/raster/functions/vectorFieldUtils.js +5 -0
- package/layers/raster/transforms/BaseRasterTransform.js +5 -0
- package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
- package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
- package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/support/rasterFunctionUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/VectorFieldRenderer.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/rest/locator/addressToLocations.js +1 -1
- package/rest/locator/addressesToLocations.js +1 -1
- package/rest/locator/suggestLocations.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/glTF/LoaderResult.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SGraphicsMap.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +10 -10
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +9 -9
- package/views/DOMContainer.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/layers/ImageryLayerViewMixin.js +1 -1
- package/views/layers/ImageryTileLayerViewMixin.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexElementDescriptor.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
- package/widgets/PanoramicViewer/support/importUtils.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/types.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0a5427127634738aa239.js +0 -1
- package/assets/esri/core/workers/chunks/110429583b28c28c36ee.js +0 -1
- package/assets/esri/core/workers/chunks/145c6a7cdcc9893efb27.js +0 -1
- package/assets/esri/core/workers/chunks/1bacdd17e199e22b5cd1.js +0 -1
- package/assets/esri/core/workers/chunks/1d566539ff6fb6ac798c.js +0 -1
- package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
- package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
- package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
- package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
- package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
- package/assets/esri/core/workers/chunks/5dc0d853c21ccb6054c7.js +0 -1
- package/assets/esri/core/workers/chunks/613cbac9cb925cd20b48.js +0 -1
- package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
- package/assets/esri/core/workers/chunks/800c91302eaad7f00877.js +0 -1
- package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
- package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
- package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
- package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
- package/assets/esri/core/workers/chunks/c4de24582c29fda5a033.js +0 -1
- package/assets/esri/core/workers/chunks/d786b17cc9062b1450ac.js +0 -1
- package/assets/esri/core/workers/chunks/d9958654c6438f28237b.js +0 -1
- package/assets/esri/core/workers/chunks/e6fa6f9c278589c8a713.js +0 -1
- package/assets/esri/core/workers/chunks/e7f4d135ef9665de1468.js +0 -1
- package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
- package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
- package/layers/support/rasterDatasets/BaseRaster.js +0 -5
- package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
- package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
- package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
- package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
- package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
- package/layers/support/rasterDatasets/MRFRaster.js +0 -5
- package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
- package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
- package/layers/support/rasterDatasets/WCSRaster.js +0 -5
- package/layers/support/rasterDatasets/covJSONParser.js +0 -5
- package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
- package/layers/support/rasterDatasets/pamParser.js +0 -5
- package/layers/support/rasterDatasets/pixelReader.js +0 -5
- package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
- package/layers/support/rasterFormats/Lerc.js +0 -5
- package/layers/support/rasterFormats/Qb3.js +0 -5
- package/layers/support/rasterFormats/RasterCodec.js +0 -5
- package/layers/support/rasterFormats/TiffDecoder.js +0 -5
- package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
- package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
- package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
- package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
- package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
- package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
- package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
- package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
- package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
- package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
- package/layers/support/rasterFunctions/LocalFunction.js +0 -5
- package/layers/support/rasterFunctions/RemapFunction.js +0 -5
- package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
- package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
- package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
- package/layers/support/rasterFunctions/StretchFunction.js +0 -5
- package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
- package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
- package/layers/support/rasterFunctions/clipUtils.js +0 -5
- package/layers/support/rasterFunctions/conversionUtils.js +0 -5
- package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
- package/layers/support/rasterFunctions/creators/utils.js +0 -5
- package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
- package/layers/support/rasterFunctions/localUtils.js +0 -5
- package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
- package/layers/support/rasterFunctions/pixelUtils.js +0 -5
- package/layers/support/rasterFunctions/stretchUtils.js +0 -5
- package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
- package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
- package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
- /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
- /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
- /package/layers/{support/rasterTransforms → raster/transforms}/utils.js +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{isSome as e}from"../../../core/arrayUtils.js";import n from"../../../geometry/Point.js";import{polygonCentroidPoint as t}from"../../../geometry/support/centroid.js";import i from"../DimensionalDefinition.js";function a(e,n,t){const i=n.shift();if(0===t.length){const e=[];t.push({sliceId:-1,multidimensionalDefinition:e})}const s=t.length;for(let a=0;a<s;a++){const n=t.shift().multidimensionalDefinition;i.values?.forEach(a=>{t.push({sliceId:-1,multidimensionalDefinition:[...n,{variableName:e,dimensionName:i.name,values:[a]}]})})}n.length&&a(e,n,t)}function s(e,n){const t=[];let i=0;return(n?e.variables.filter(e=>e.name.toLowerCase()===n.toLowerCase()):[...e.variables].sort((e,n)=>e.name>n.name?1:-1)).forEach(e=>{const n=[],s=[...e.dimensions].sort((e,n)=>e.name>n.name?-1:1);a(e.name,s,n),n.forEach(e=>{t.push({...e,sliceId:i++})})}),t}function r(e,n,t){let i=e;if(n&&(n=[...n].sort((e,n)=>e.dimensionName<n.dimensionName?-1:1)).forEach(({dimensionName:e,values:n,isSlice:t})=>{n.length&&(i=i.filter(i=>{const a=i.multidimensionalDefinition.find(n=>n.dimensionName===e);if(null==a)return!1;const s=a.values[0];return"number"==typeof s?"number"==typeof n[0]?n.includes(s):n.some(e=>e[0]<=s&&e[1]>=s):"number"==typeof n[0]?n.some(e=>s[0]<=e&&s[1]>=e):t?n.some(e=>e[0]===s[0]&&e[0]===s[1]):n.some(e=>e[0]>=s[0]&&e[0]<=s[1]||e[1]>=s[0]&&e[1]<=s[1]||e[0]<s[0]&&e[1]>s[1])}))}),i.length&&null!=t?.start&&null!=t.end){const e=t.start.getTime(),n=t.end.getTime(),a=i[0].multidimensionalDefinition.findIndex(e=>"StdTime"===e.dimensionName);a>-1&&(i=i.filter(t=>{const i=t.multidimensionalDefinition[a].values[0];return e<=i&&n>=i}))}return i.map(e=>e.sliceId)}function l(e,n){return Array.isArray(e)?n[0]===n[1]?e[0]===n[0]||e[1]===n[0]:e[0]>=n[0]&&e[0]<=n[1]&&e[1]>=n[0]&&e[1]<=n[1]:e>=n[0]&&e<=n[1]}function u(e,n){return e[0]<=n[0]&&e[1]>=n[0]||e[0]<=n[1]&&e[1]>=n[1]||e[0]>=n[0]&&e[1]<=n[1]}function o(e){return 1===e.length?[e[0],e[0]]:[e[0],e[e.length-1]]}function m(e,n,t){if(!n?.subsetDefinitions?.length)return e;let i;if(t){const{variables:a}=n;if(a.length&&!a.includes(t))return null;const s=n.subsetDefinitions.find(n=>n.dimensionName===e.name&&n.variableName===t);if(!s?.values?.length)return e;i=o(s.values)}else{const t=n.dimensions.find(({name:n})=>n===e.name);i=t?.extent}const a=i;if(!a?.length)return e;const s=e.values.filter(e=>l(e,a));return{...e,extent:[...a],values:s}}function c(e,n,t){if(!n?.subsetDefinitions?.length)return!1;const{variables:i}=n;if(i.length&&e.some(({variableName:e})=>e&&!i.includes(e)))return!0;for(let a=0;a<e.length;a++){const i=e[a],s=n.subsetDefinitions.find(e=>(""===i.variableName||e.variableName===i.variableName)&&e.dimensionName===i.dimensionName);if(s?.values.length){const e=o(s.values);if(!i.isSlice&&2===i.values.length&&!Array.isArray(i.values[0])&&i.values[0]!==i.values[1]&&t){if(!u(i.values,e))return!0}else if(i.values.some(n=>!l(n,e)))return!0}}return!1}function f(e,n){if(null==e)return{isOutside:!1};const{geometry:t,timeExtent:i,multidimensionalDefinition:a}=n;let s=null;if(null!=i&&(s=h(e,i),null==s))return{isOutside:!0};const{areaOfInterest:r}=e;if(r&&t){const e=d(t);if(e&&!r.contains(e))return{isOutside:!0}}return null!=a&&a.length&&c(a,e,!0)?{isOutside:!0}:{isOutside:!1,intersection:{geometry:t,timeExtent:s,multidimensionalDefinition:a}}}function d(e){switch(e.type){case"point":return e;case"extent":return e.center;case"polygon":{const i=t(e);return i?n.fromJSON(i):null}}return null}function h(e,n){const t=e.dimensions.find(({name:e})=>"StdTime"===e);if(null==t||null==n.start&&null==n.end)return n;n=n.clone();const{start:a,end:s}=n.toJSON(),r=a===s?[a]:null!=a&&null!=s?[a,s]:[a??s];if(2===r.length&&t?.extent.length&&(r[0]=Math.max(r[0],t.extent[0]),r[1]=Math.min(r[1],t.extent[1]??t.extent[0]),r[1]<r[0]))return null;return c([new i({variableName:"",dimensionName:"StdTime",isSlice:1===r.length,values:r})],e,!0)?null:(n.start=new Date(r[0]),n.end=new Date(r[1]??r[0]),n)}function g(e){const{rasterInfo:n,multidimensionalSubset:t}=e,{multidimensionalInfo:i}=n;if(null==i)return null;let a=e.multidimensionalDefinition?.length?e.multidimensionalDefinition:b(n,{multidimensionalSubset:t});if(!a?.length)return null;if(a.some(e=>!e.dimensionName)){const{variableName:e}=a[0],i=b(n,{multidimensionalSubset:t,variableName:e});i?.forEach(e=>{const n=a?.find(({dimensionName:n})=>n===e.dimensionName);n?.values?.length&&(e.values=n.values,e.isSlice=n.isSlice)}),a=i}const{timeExtent:s}=e;if(null!=a&&null!=s&&(null!=s.start||null!=s.end)){a=a.map(e=>e.clone());const e=i.variables.find(({name:e})=>e===a[0].variableName)?.dimensions?.find(({name:e})=>"StdTime"===e),n=a.find(({dimensionName:e})=>"StdTime"===e);if(!e||!n)return null;const{start:t,end:r}=s,l=null==t?null:t.getTime(),u=null==r?null:r.getTime(),o=l??u,m=u??l;if(null!=e.values){const t=e.values.filter(e=>{if(Array.isArray(e)){if(o===m)return e[0]<=o&&e[1]>=o;const n=e[0]<=o&&e[1]>o||e[0]<m&&e[1]>=m,t=e[0]>=o&&e[1]<=m||e[0]<o&&e[1]>m;return n||t}return o===m?e===o:e>=o&&e<=m});if(t.length){const e=t.sort((e,n)=>{const t=Array.isArray(e)?e[0]:e,i=Array.isArray(e)?e[1]:e,a=Array.isArray(n)?n[0]:n,s=Array.isArray(n)?n[1]:n;if(o===m)return t-a;return Math.abs(i-m)-Math.abs(s-m)})[0];n.values=[e]}else a=null}else if(e.hasRegularIntervals&&e.extent){const[t,i]=e.extent;o>i||m<t?a=null:n.values=o===m?[o]:[Math.max(t,o),Math.min(i,m)]}}return null!=a&&c(a,t)?null:a}function v(e,n={}){const{multidimensionalInfo:t,keyProperties:i}=e;if(null==t)return null;const{variableName:a,multidimensionalSubset:s,multidimensionalDefinition:r}=n,l=null!=r?r[0]?.variableName:null,u=a||l||i?.DefaultVariable;let{variables:o}=t;s?.variables?.length&&(o=o.filter(({name:e})=>s.variables.includes(e)));return u?o.find(({name:e})=>e===u)??o[0]:o[0]}function b(e,n={}){const t=v(e,n);if(!t)return null;const a=[],{dimensions:s,name:r}=t;if(0===s.length)return[new i({variableName:r,dimensionName:"",values:[],isSlice:!0})];for(let l=0;l<s.length;l++){const e=m(s[l],n.multidimensionalSubset,r);if(!e)return null;const{values:t,extent:u}=e;let o=t?.[0]??u?.[0];"stdz"===e.name.toLowerCase()&&!e.hasRanges&&u&&Math.abs(u[1])<=Math.abs(u[0])&&(o=t?.length?t[t.length-1]:u[1]),a.push(new i({variableName:r,dimensionName:e.name,values:[o],isSlice:!n.useRangeForRangedDimensionInfo||!!e.hasRanges}))}return a}function y(e){return!!e?.length&&e.some(e=>{if(null==e.values)return!0;const n=e.values.length;return 0===n||n>1||!e.isSlice&&Array.isArray(e.values[0])})}function D(n,t){if(null==t||null==n)return null;let i=t.variables.map(e=>({...e}));return n?.variables?.length&&(i=i.filter(({name:e})=>n.variables.includes(e)),i.forEach(t=>{t.dimensions=t.dimensions.map(e=>m(e,n,t.name)).filter(e)})),i}function N(e,n){const{values:t}=n;if(t?.length){const n=Array.isArray(t[0]),i=Array.isArray(e);return n!==i?-1:n&&i?t.findIndex(n=>n[0]===e[0]&&n[1]===e[1]):t.indexOf(e)}const{extent:i}=n;if(Array.isArray(e)||!i||e<i[0]||e>i[1])return-1;const a=n.interval||1;if("ISO8601"!==n.unit)return Math.round((e-i[0])/a);const s=i[0];let r=-1;switch(n.intervalUnit?.toLowerCase()||"days"){case"seconds":r=Math.round((e-s)/1e3/a);break;case"minutes":r=Math.round((e-s)/6e4/a);break;case"hours":r=Math.round((e-s)/36e5/a);break;case"days":r=Math.round((e-s)/864e5/a);break;case"months":{const n=new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear(),t=new Date(s).getUTCMonth(),i=new Date(e).getUTCMonth();r=0===n?i-t:i+11-t+12*(n-1)}break;case"years":r=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/a);break;case"decades":r=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/10/a)}return r}function T(e){let n=e.values?.length;if(n)return n;const{extent:t,unit:i}=e,a=e.interval||1,s=t?t[1]-t[0]:0;if("ISO8601"!==i)return Math.round(s/a);switch(e.intervalUnit?.toLowerCase()??"seconds"){case"seconds":n=Math.round(s/1e3/a);break;case"minutes":n=Math.round(s/6e4/a);break;case"hours":n=Math.round(s/36e5/a);break;case"days":n=Math.round(s/864e5/a);break;case"months":if(t){const e=new Date(t[1]).getUTCFullYear()-new Date(t[0]).getUTCFullYear(),i=new Date(t[0]).getUTCMonth(),a=new Date(t[1]).getUTCMonth();n=0===e?a-i+1:a+11-i+12*(e-1)+1}else n=0;break;case"years":n=t?Math.round((new Date(t[1]).getUTCFullYear()-new Date(t[0]).getUTCFullYear())/a):0;break;case"decades":n=t?Math.round((new Date(t[1]).getUTCFullYear()-new Date(t[0]).getUTCFullYear())/10/a):0;break;default:n=0}return n}function w(e){if(2!==e.extent?.length||!e.interval)return[];const{extent:[n,t],interval:i}=e;if("ISO8601"===e.unit){const a=e.intervalUnit?.toLowerCase()??"days";return["decades","years","months","days","hours","minutes","seconds"].includes(a)?M(n,t,i,a):[]}const a=Math.round((t-n)/i);return Array.from({length:a},(e,s)=>s===a-1?t:n+s*i)}function M(e,n,t,i){const a=[];let s=e;const r=new Date(e);for(;s<=n;)switch(a.push(s),i){case"decades":r.setUTCFullYear(r.getUTCFullYear()+10*t),s=r.getTime();break;case"years":r.setUTCFullYear(r.getUTCFullYear()+t),s=r.getTime();break;case"months":r.setUTCMonth(r.getUTCMonth()+t),s=r.getTime();break;case"days":s+=864e5*t;break;case"hours":s+=36e5*t;break;case"minutes":s+=6e4*t;break;case"seconds":s+=1e3*t}return 1===a.length?a[1]=n:a[a.length-1]=n,a}function C(e,n){let t=0;const i=e[0].variableName,a=[...n.variables].sort((e,n)=>e.name>n.name?1:-1);for(let s=0;s<a.length;s++){const n=a[s],r=[...n.dimensions].sort((e,n)=>e.name>n.name?-1:1);if(n.name!==i){t+=r.map(e=>T(e)).reduce((e,n)=>e*n);continue}const l=r.map(e=>T(e)),u=r.length;for(let i=0;i<u;i++){const n=e.find(e=>e.dimensionName===r[i].name);if(null==n)return null;const a=N(n.values[0],r[i]);if(-1===a)return null;l.shift(),t+=i===u-1?a:a*l.reduce((e,n)=>e*n)}break}return t}function U(e){return Math.round(24*(e-25569)*3600*1e3)}export{U as convertOleDateTimeToEpoch,s as createSlices,b as getDefaultMultidimensionalDefinition,v as getDefaultVariableInfo,w as getDimensionValues,g as getEffectiveMultidimensionalDefinition,r as getSliceIds,C as getSliceIndex,D as getSubsetVariablesFromMdInfo,M as getTimeDimensionValues,c as hasExcludedVariableOrDimension,f as intersectMultimensionalSubset,y as isMultiSliceOrRangeDefinition};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../geometry/SpatialReference.js";import{isWKT2 as n}from"../../../geometry/support/spatialReferenceUtils.js";import{isSameTagIgnoreNS as r,getElementValue as s,getElements as a,getElement as i,getElementNumericValue as l,getElementNumericValues as o}from"./xmlUtilities.js";import f from"../rasterTransforms/PolynomialTransform.js";function u(e,t){if(!e||!t)return null;const n=[];for(let r=0;r<e.length;r++)n.push(e[r]),n.push(t[r]);return n}function c(e){const t=i(e,"GeodataXform"),n=d(l(t,"SpatialReference/WKID")||s(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:n,transform:null};const r=l(t,"PolynomialOrder")??1,a=o(t,"CoeffX/Double"),c=o(t,"CoeffY/Double"),m=o(t,"InverseCoeffX/Double"),p=o(t,"InverseCoeffY/Double"),S=u(a,c),C=u(m,p);return{spatialReference:n,transform:S&&C&&S.length&&C.length?new f({spatialReference:n,polynomialOrder:r,forwardCoefficients:S,inverseCoefficients:C}):null}}function m(e){const t=l(e,"NoDataValue"),n=i(e,"Histograms/HistItem"),r=l(n,"HistMin"),o=l(n,"HistMax"),f=l(n,"BucketCount"),u=s(n,"HistCounts")?.split("|").map(e=>Number(e));let c,m,d,p;a(e,"Metadata/MDI").forEach(e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":c=t;break;case"STATISTICS_MAXIMUM":m=t;break;case"STATISTICS_MEAN":d=t;break;case"STATISTICS_STDDEV":p=t}});const S=l(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:u?.length&&null!=r&&null!=o?{min:r,max:o,size:f||u.length,counts:u}:null,sourceBandIndex:S,statistics:null!=c&&null!=m?{min:c,max:m,avg:d,stddev:p}:null}}function d(e){if(!e)return null;let r=Number(e);if(!isNaN(r)&&0!==r)return new t({wkid:r});if(e=String(e).trim(),n(e))return new t({wkt2:e});const s=e.toUpperCase();if(s.startsWith("COMPD_CS")){if(!s.includes("VERTCS")||!s.includes("GEOGCS")&&!s.startsWith("PROJCS"))return null;const n=s.indexOf("VERTCS"),a=s.indexOf("PROJCS"),i=a>-1?a:s.indexOf("GEOGCS");if(-1===i)return null;const l=e.slice(i,e.lastIndexOf("]",n)+1).trim(),o=e.slice(n,e.lastIndexOf("]")).trim();r=p(l);const f=new t(r?{wkid:r}:{wkt:l}),u=p(o);return u&&(f.vcsWkid=u),f}return s.startsWith("GEOGCS")||s.startsWith("PROJCS")?(r=p(e),new t(0!==r?{wkid:r}:{wkt:e})):null}function p(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),n=t[t.length-1].split(","),r=n[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){const e=Number(n[1]);if(!isNaN(e)&&0!==e)return e}return 0}function S(t){if("pamdataset"!==t?.documentElement.tagName?.toLowerCase())return{};const n={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};t.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if(r(e,"SRS")){if(!n.spatialReference){const t=s(e);n.spatialReference=d(t)}}else if(r(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:t,transform:r}=c(e);n.transform=r,n.spatialReference||(n.spatialReference=t)}else{a(e,"MDI").forEach(e=>n.metadata[e.getAttribute("key")]=s(e))}else if(r(e,"PAMRasterBand")){const t=m(e);null!=t.sourceBandIndex&&null==n.rasterBands[t.sourceBandIndex]?n.rasterBands[t.sourceBandIndex]=t:n.rasterBands.push(t)}});const i=n.rasterBands;if(i.length){const t=!!i[0].statistics;n.statistics=t?i.map(e=>e.statistics).filter(e):null;const r=!!i[0].histogram;n.histograms=r?i.map(e=>e.histogram).filter(e):null}return n}export{S as parsePAMInfo,d as parseSpatialReference};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import a from"../Field.js";import r from"../PixelBlock.js";import{getByteCount as o}from"../rasterFormats/pixelRangeUtils.js";import{snapToRaster as s,clip as l}from"../rasterFunctions/clipUtils.js";import{transformPixels as c}from"../rasterFunctions/pixelTransformUtils.js";import{mapPixelValueToAttribute as p,pixelIdFieldName as u,convertPixelBlockToFeatures as f,getValidPixels as m,mosaic as x,countCategoricalPixels as h}from"../rasterFunctions/pixelUtils.js";import{load as d,projectPolygon as y}from"../rasterFunctions/rasterProjectionHelper.js";import{computeBoxStatistics as w,computeStatisticsHistograms as g}from"../rasterFunctions/stretchUtils.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const B=2**30,S=2048,P=2**20,j=20,I=100;async function R(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function F(e){const t=[new a({name:u,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new a({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function T(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<j){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/I;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await d(),t=y(t,i)}return t}async function v(e,t,i=!1){const{spatialReference:a}=e,r=t?.geometry,o=await T(r??e.extent,a),l="extent"===o.type?o:o.extent,c=null==r||"extent"===r.type&&r.spatialReference.equals(a)?void 0:o,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:a}),u=!!t?.autoResample,f=u?p:t?.pixelSize??p;let{extent:m,width:x,height:h}=s(e,l,f);if(!u)return{extent:m,clipGeometry:c,width:x,height:h,pixelSize:f};const d=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=f;const g=t?.maxPixelCount??P;for(;x*h>g&&(!i||Math.max(x,h)>1024);)y*=d,w*=d,x/=d,h/=d;return x=Math.round(x),h=Math.round(h),{extent:m,clipGeometry:c,width:x,height:h,pixelSize:new n({x:y,y:w,spatialReference:a})}}async function*z(e,n,a=!1,r){const{extent:o,clipGeometry:s,width:c,height:p}=n,u=o.width/c,f=o.height/p,m=Math.ceil(c/S),x=Math.ceil(p/S),h=u*S,d=f*S,{xmin:y,xmax:w,ymin:g,ymax:k}=o,b=x*m,B={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...r};for(let P=0;P<x;P++)for(let n=0;n<m;n++){t(B);const r=new i({xmin:y+n*h,xmax:a?Math.min(w,y+(n+1)*h):y+(n+1)*h,ymax:k-P*d,ymin:a?Math.max(g,k-(P+1)*d):k-(P+1)*d,spatialReference:o.spatialReference}),c={row:P,col:n},p=P*m+n+1;if(s&&!r.intersects(s)){yield{extent:r,pixelBlock:null,id:c,total:b,current:p};continue}const x=a?Math.round(r.width/u):S,j=a?Math.round(r.height/f):S;let{pixelBlock:I}=await e.fetchPixels(r,x,j,B).catch(()=>({pixelBlock:void 0}));I&&s&&(I=await l(I,r,s)),yield{extent:r,pixelBlock:I,id:c,total:b,current:p}}}async function*M(e,i,n){const a=await R(e,n),r=F(a),o={...i,geometry:i?.geometry??a.extent},s=z(e,await v(a,o),!0,n),l=a.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const o=V(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await K({pixelBlock:s,rasterJobHandler:o},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*a.width*S+c.id.col*S;t(n),f.featureSet=await _({pixelBlock:s,extent:c.extent,fields:r,skipFactor:i?.skipFactor??1,rasterJobHandler:o,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function H(t,i,n){const a=o(i),{width:r,height:s}=t;if(r*s*a>B)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&r*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function C(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const a=await R(t),r=await v(a,i,!0);H(r,a.pixelType);const{extent:o,pixelSize:s}=r,l=Math.round(a.extent.width/s.x),c=F(a),p={fields:c,features:[]},u=p.features,{maxPixelCount:f}=i,m=!!i.autoResample&&null!=f&&r.width*r.height>f,x=m?1:i.skipFactor??1,h=r.width<=S||r.height<=S,d=z(t,r,1===x||h,n);for await(const e of d){if(!e.pixelBlock)continue;const i=V(t),r=Math.floor((a.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-a.extent.xmin)/s.x),o=await _({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:r,imageRowSize:l},n);if(o?.features?.length){const{features:e}=o,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}if(m&&f){const e=f/(i.skipFactor??1)**2;if(u.length>e){const t=u.length/e,i=[...u],n=u.length-1;u.length=0;for(let a=0,r=0;a<e-1;a++){r+=t;const e=Math.round(r);e<n&&u.push(i[e])}}}return{extent:o,featureSet:p,pixelSize:s}}async function O(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return J(e,n,i);if("polyline"===n.type)return U(e,n,i);const a=await $(e,{geometry:n},i);if(!a)return null;return w(a)}async function J(e,t,i){const n=await R(e,i),a=t.points.map((e,i)=>t.getPoint(i)).map(t=>q(e,t,i)),o=(await Promise.all(a)).filter(e=>null!=e);if(o.length<=1)return N(o[0]);const s=o[0].map((e,t)=>o.map(e=>e[t]));return w(new r({pixels:s,pixelType:n.pixelType}))}async function q(e,t,i){if("imagery"===e.type){const n=await e.identify(new b({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function N(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function U(e,t,i){const n=await D(e,{geometry:t},i),a=await R(e,i),{bandCount:o,pixelType:s}=a,l=new Array(o).fill(0).map(()=>r.createEmptyBand(s,n.length));let c=0;for(let r=0;r<n.length;r++){const e=n[r];if(null!=e.value){c++;for(let t=0;t<o;t++)l[t][r]=e.value[t]}}c!==n.length&&l.forEach((e,t)=>{l[t]=e.subarray(0,c)});return w(new r({pixels:l,pixelType:s}))}async function A(t,i,n){const a=await R(t,n);if(!a.attributeTable||!a.pixelType.startsWith("u"))return null;const r=a.attributeTable.clone(),o=r.fields.find(e=>"value"===e.name.toLowerCase()),s=r.fields.find(e=>"count"===e.name.toLowerCase());if(!o||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(a.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p}=i;return await L(t,p,(e,t)=>h(e,c),n),r.features.forEach(e=>{const t=e.attributes[o.name];e.attributes[s.name]=c[t]}),r}async function E(e,t,i){const{geometry:n}=t;if("point"===n.type)return q(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>q(e,t,i)),a=(await Promise.all(t)).filter(e=>null!=e);if(0===a.length)return null;return G(a).map(e=>e/a.length)}const a=await L(e,n,(e,t)=>W(e),i),r=a?.filter(e=>e.count>0);if(!r?.length)return null;const o=G(r.map(e=>e.bandSum)),s=r.map(e=>e.count).reduce((e,t)=>e+t);return o.map(e=>e/s)}function G(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function W(e){const{width:t,height:i,pixels:n,mask:a}=e,r=new Array(n.length).fill(0);let o=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!a||a[i]){for(let e=0;e<n.length;e++)r[e]+=n[e][i];o++}}return{bandSum:r,count:o}}async function D(e,t,i){const n=await L(e,t.geometry,m,i);return n?.flat()??[]}async function L(i,n,a,r){const o=i.spatialReference;if("polyline"===n.type&&!n.spatialReference.equals(o)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(n,o);if(null==t)throw new e("read-pixels","failed to fetch pixels");n=t}const s="polyline"===n.type?n.extent:n,c=await T(s,o),p="polyline"===n.type?n:c,u=await R(i,r),f={geometry:c,autoResample:!1},m=[],x=z(i,await v(u,f),!0,r);for await(const e of x){if(!e.pixelBlock)continue;const{extent:i}=e,n=a(await l(e.pixelBlock,i,p),i);m.push(n),t(r)}return m}async function K(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:a,histograms:r}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):g(n);return{statistics:a,histograms:r}}async function _(e,t){const{extent:i,fields:n,skipFactor:a,rasterJobHandler:r,pixelIdOffset:o,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=r?await r.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:a,pixelIdOffset:o,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:a,pixelIdOffset:o,imageRowSize:s});return p?{fields:n,features:p}:void 0}function V(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function $(e,t,i){const n=await R(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const a=await v(n,t);a.bandIds=t.bandIds?.length?t.bandIds:void 0,H(a,n.pixelType,t.maxPixelCount);const{width:r,height:o}=a;if(r<=S&&o<=S){const t=a.bandIds?.length?a.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(a.extent,r,o,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=z(e,a,!1,i);for await(const x of l)s.push(x.pixelBlock);if(!s.some(e=>null!=e))return null;const c=Math.ceil(r/S),p=Math.ceil(o/S),u={width:c*S,height:p*S};let f;const m=V(e);if(m){const e=await m.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:u,destDimension:u},{...i,transferPixelsToWorker:!0});f=e?.pixelBlock}else f=x(s,u);return f}async function Q(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");let a=await $(t,i,n);if(!a)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:r}=i;if(r&&"value"!==r.toLowerCase()){const e=await R(t,n);a=p(a,e,r)}const o=V(t),{transformType:s}=i;if(s){const e={lambda:i.lambda,shift:i.shift};a=o?await o.transformPixels({pixelBlock:a,transformType:s,transformParameters:e},{...n,transferPixelsToWorker:!0}):c(a,s,e)}const l=i.histogramSize??void 0;return o?await o.computeStatisticsHistograms({pixelBlock:a,histogramSize:l,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):g(a,{histogramSize:l,includeSkewnessKurtosis:!0})}export{O as computeBoxStatistics,A as computeRasterAttributeTable,Q as computeStatisticsHistograms,M as createPixelFeatureSetCursor,C as fetchPixelFeatureSet,E as identifyAveragePixelValue,D as readIntersectingPixels};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{convertOleDateTimeToEpoch as s,getDimensionValues as a}from"./multidimensionalUtils.js";import{getElements as o,isSameTagIgnoreNS as l,getElementValue as r,getElementValues as u,getNodeNameIgnoreNS as m,getElement as p,getSpaceDelimitedNumericValues as c}from"./xmlUtilities.js";function d(e){e.variables.forEach(e=>e.dimensions.forEach(e=>e.values??=a(e)))}function f(e){return{requestResponseCRSs:u(e,"requestResponseCRSs").map(e=>e.split(":")[1]),nativeCRSs:u(e,"nativeCRSs").map(e=>e.split(":")[1])}}function g(e,t){const n=u(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):r(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter(e=>e.toLowerCase()!==i.toLowerCase())):n}function h(e){return null==e?["nearest"]:e.map(e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null}).filter(e=>!!e)}function b(t){const n=o(t,"pos"),i=c(n[0]),s=c(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:s[0],ymax:s[1],spatialReference:{wkid:4326}})}function x(e,t){const n=u(e,t);return n?.length&&""!==n[0]&&!isNaN(Number(n[0]))?n.map(e=>Number(e)):null}function v(e){const t=c(e,"MinimumValue"),n=c(e,"MaximumValue");return t.length&&n.length?t.map((e,t)=>({min:e,max:n[t],avg:-1,stddev:-1})):null}function D(e){return null==e?null:e.every(t=>t===e[0])?e[0]:e}function y(e){const t=[],n=o(e,"RangeSet");let i=[];for(let s=0;s<n.length;s++){const e=r(n[s],"name"),a=r(n[s],"label"),l=[],m=x(n[s],"nullValues/singleValue"),p=o(n[s],"AxisDescription");for(let t=0;t<p.length;t++){const e=r(p[t],"name"),n=r(p[t],"label"),s=u(p[t],"singleValue");if(0===s.length){const e=r(p[t],"min"),n=r(p[t],"max"),i=Number(r(p[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)s.push(t.toString())}"band"===e.toLowerCase()&&(i=s),l.push({name:e,label:n,values:s})}t.push({name:e,label:a,nullValues:m,axis:l})}return{rangeSet:t,bandNames:i}}function w(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],s=["Years","Months","Days","Hours","Minutes","Seconds"];let a,o,l;return t.includes("PT")?(t=t.slice(2),l=i.findIndex(e=>t.includes(e)),a=s[3+l],o=parseFloat(t.slice(0,-1))):(t=t.slice(1),l=n.findIndex(e=>t.includes(e)),l>-1&&(a=s[l]),o=parseFloat(t.slice(0,-1))),{resolution:o,units:a}}function S(e){const t=o(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(r(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=p(e,"timePeriod")||p(e,"TimePeriod");if(n){return{begin:new Date(r(n,"beginPosition")||r(n,"BeginPosition")),end:new Date(r(n,"endPosition")||r(n,"EndPosition")),...w(r(n,"timeResolution")||r(n,"TimeResolution"))}}return null}function I(t){const n=p(t,"spatialDomain"),i=p(n,"Envelope")||p(n,"EnvelopeWithTimePeriod"),s=i.getAttribute("srsName").split(":"),a=s[s.length-1],l=o(i,"pos"),u=c(l[0]),m=c(l[1]),d=parseInt(a,10),f=isNaN(d)?null:{wkid:d},g=new e({xmin:u[0],ymin:u[1],xmax:m[0],ymax:m[1],spatialReference:f}),h=p(n,"RectifiedGrid"),b=r(h,"low").split(" "),x=r(h,"high").split(" "),v=parseInt(x[0],10)-parseInt(b[0],10)+1,D=parseInt(x[1],10)-parseInt(b[1],10)+1,y=c(n,"origin/pos"),w=o(n,"offsetVector"),I={envelope:g,columns:v,rows:D,offset:{x:parseFloat(r(w[0]).split(" ")[0]),y:parseFloat(r(w[1]).split(" ")[1])},origin:{x:y[0],y:y[1]}},L=p(t,"temporalDomain")||p(t,"TemporalDomain");return{spatialDomain:I,temporalDomain:L?S(L):null}}function L(e){const t={version:"1.0"};let n,s=[];for(let i=0;i<e.childNodes.length;i++){const a=e.childNodes[i];if(1===a.nodeType)if(l(a,"description"))t.description=r(a);else if(l(a,"name"))t.name=r(a);else if(l(a,"label"))t.label=r(a);else if(l(a,"supportedFormats"))t.supportedFormats=u(a,"formats");else if(l(a,"supportedCRSs"))t.supportedCRSs=f(a);else if(l(a,"supportedInterpolations"))t.supportedInterpolations=g(a,"1.0.0");else if(l(a,"lonLatEnvelope"))t.lonLatEnvelope=b(a);else if(l(a,"rangeSet")){const e=y(a);t.rangeSet=e.rangeSet,s=e.bandNames;const i=e.rangeSet[0].nullValues;i?.length&&(n=D(i))}else l(a,"domainSet")&&(t.domainSet=I(a))}const a=h(t.supportedInterpolations),{name:o,description:m,label:p,lonLatEnvelope:c,supportedFormats:d}=t,{spatialDomain:x}=t.domainSet,v={x:Math.abs(x.offset.x),y:Math.abs(x.offset.y)},w=C(t.domainSet),S=new i({width:x.columns,height:x.rows,pixelSize:v,pixelType:"unknown",extent:x.envelope,spatialReference:x.envelope.spatialReference,bandCount:s.length||1,noDataValue:n,multidimensionalInfo:w});return{id:o,title:t.name,description:m||p,lonLatEnvelope:c,rasterInfo:S,bandNames:s,supportedFormats:d,supportedInterpolations:a,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function C(e){if(!e.temporalDomain)return null;const{begin:t,end:n,values:i,units:s,resolution:a}=e.temporalDomain,o={variables:[{name:"default",description:"",dimensions:[{name:"StdTime",description:"",unit:"ISO8601",values:i?.map(e=>e.getTime()),hasRegularIntervals:!i,interval:a,intervalUnit:s,extent:[t.getTime(),n.getTime()]}]}]};return d(o),o}function T(e,t){const n=[],i=o(e,"Field");let s,a=[];for(let l=0;l<i.length;l++){const e=r(i[l],"Identifier"),m=r(i[l],"Description"),c=r(i[l],"Definition"),d=r(i[l],"Abstract"),f=r(i[l],"Title"),h=x(i[l],"NullValue"),b=p(i[l],"AllowedValues"),D=b?v(b):null,y=g(i[l],"1.1.0"),w=[],S=o(i[l],"Axis");for(let n=0;n<S.length;n++){const e=S[n].getAttribute("identifier"),i=r(S[n],"UOM"),o=r(S[n],"DataType"),l=u(S[n],"Key");t&&!e.toLowerCase().includes("band")||(a=l,s=h),w.push({identifier:e,uom:i,dataType:o,values:l,bandNoDataValues:s})}n.push({identifier:e,description:m,definition:c,abstract:d,title:f,supportedInterpolations:y,axis:w,nullValues:h,statistics:D})}return{rangeSet:n,bandNames:a,bandNoDataValues:s,statistics:n[0].statistics}}function R(e,t){if(!t.temporalDomain)return null;const n=e.filter(e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some(e=>e.identifier.includes("band"))),i=[];if(n.length&&n.forEach(e=>{const t=e.axis.map(e=>{const t=e.values.map(t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())}),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}});i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t,statistics:e.statistics})}),t.temporalDomain){const{begin:e,end:n,values:s,units:a,resolution:o}=t.temporalDomain;i.some(e=>e.dimensions.some(e=>"stdtime"===e.name.toLowerCase()))||i.forEach(t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map(e=>e.getTime()),hasRegularIntervals:!s,interval:o,intervalUnit:a,extent:[e.getTime(),n.getTime()]})})}if(i.length){const e={variables:i};return d(e),e}return null}function M(t){const i=p(t,"SpatialDomain"),s=p(i,"GridCRS"),a=r(s,"GridBaseCRS"),l=r(s,"GridOrigin"),u=l?.split(" ").map(e=>parseFloat(e))??[0,0],m=c(s,"GridOffsets"),d=o(i,"BoundingBox");let f,g,h,b;for(let n=0;n<d.length;n++){const t=d[n].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=c(d[n],"LowerCorner"),t=c(d[n],"UpperCorner");f=t[0]-e[0]+1,g=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");h=parseInt(i[i.length-1],10);const s=c(d[n],"LowerCorner"),a=c(d[n],"UpperCorner");b=new e({xmin:s[0],ymin:s[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:h}})}}const x=f>g,v=b.xmax-b.xmin>b.ymax-b.ymin;let D=!1;n(h)&&(x===v?D=!1:(D=!0,b=new e({xmin:b.ymin,ymin:b.xmin,xmax:b.ymax,ymax:b.xmax,spatialReference:{wkid:h}})));const y={columns:f,rows:g,origin:{x:u[0],y:u[1]},offset:{x:m[0],y:m[m.length-1]},gridBaseCRS:a,envelope:b,useEPSGAxis:D},w=p(t,"temporalDomain")||p(t,"TemporalDomain");return{spatialDomain:y,temporalDomain:w?S(w):null}}function N(e,t){const n=[],s=[],a={supportedFormats:n,supportedCRSs:s,version:"1.1"};let o,l,u=[];for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const p=m(t).toLowerCase();switch(p){case"title":case"abstract":case"identifier":a[p]=r(t);break;case"supportedformat":{const e=r(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=r(t);s.includes(e)||s.push(e)}break;case"range":{const e=T(t,!!a.domain?.temporalDomain);a.range=e.rangeSet,u=e.bandNames;const{bandNoDataValues:n}=e;n?.length&&(o=D(n)),l=e.statistics}break;case"domain":a.domain=M(t)}}const p=h(a.range[0].supportedInterpolations),{identifier:c,abstract:d,title:f,domain:g,range:b}=a,x={x:Math.abs(g.spatialDomain.offset.x),y:Math.abs(g.spatialDomain.offset.y)},v=R(b,g);v&&(o=b[0].nullValues,1===o?.length&&(o=o[0]));const y=new i({width:g.spatialDomain.columns,height:g.spatialDomain.rows,pixelSize:x,pixelType:"unknown",extent:g.spatialDomain.envelope,spatialReference:g.spatialDomain.envelope.spatialReference,bandCount:u.length||1,noDataValue:o,statistics:l,multidimensionalInfo:v});return{id:c,title:a.title,description:d||f,bandNames:u,rasterInfo:y,supportedFormats:n,supportedInterpolations:p,coverageDescription:a,version:t,useEPSGAxis:g.spatialDomain.useEPSGAxis}}function P(t){const n=p(t,"Envelope")||p(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),s=i.slice(i.lastIndexOf("/")+1),a=n.getAttribute("axisLabels").split(" ").map(e=>e.trim()).filter(e=>""!==e.trim()),o=c(n,"lowerCorner"),u=c(n,"upperCorner"),m=!["y","lat","latitude","north","nor","n","b"].includes(a[0].toLowerCase());let d;const f=parseInt(s,10),g=isNaN(f)?null:{wkid:f};d=new e(m?{xmin:o[0],ymin:o[1],xmax:u[0],ymax:u[1],spatialReference:g}:{xmin:o[1],ymin:o[0],xmax:u[1],ymax:u[0],spatialReference:g});const h={mins:o,maxs:u},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;if(l(n,"EnvelopeWithTimePeriod")){x=new Date(r(t,"beginPosition")||r(t,"BeginPosition")),v=new Date(r(t,"endPosition")||r(t,"EndPosition"));const e=b?.findIndex(e=>"oledatetime"===e?.toLowerCase());e>-1&&(b[e]="ISO8601")}return{envelope:d,axisLabels:a,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:m}}function E(e,t){const n=[],i=o(e,"DataRecord"),s=[];let a,l=[];for(let u=0;u<i.length;u++){const e=o(i[u],"field"),m=[];for(let n=0;n<e.length;n++){const i=e[n].getAttribute("name"),o=r(e[n],"description")||"",u=p(e[n],"uom")?.getAttribute("code")||"",d=c(e[n],"interval"),f=x(e[n],"nilValue")?.[0];t&&!i.toLowerCase().includes("band")||(s.push(i),d?.length&&(a=a||[],a.push({min:d[0],max:d[1],avg:-1,stddev:-1})),l.push(f)),m.push({name:i,description:o,uom:u,allowedValues:d,nilValue:f})}n.push(m)}return l.some(e=>null!=e)||(l=null),{rangeType:n,bandNames:s,bandStats:a,bandNoDataValues:l}}function V(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function A(e,t,n){if(n.axisLabels.length<=2)return null;const i=[];for(let s=0;s<e.length;s++){const t=e[s];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const a=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const a=t.uomLabels?.[i]?.trim()??"",o=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===a.toLowerCase()||"oledatetime"===a.toLowerCase();let l,r;if(o){const e=V(n.offset[i]);l=e.interval,r=e.intervalUnit}else l=n.offset[i],r=a;const u=[];o?(u.push(s(t.envelopeAllDims.mins[i])),u.push(s(t.envelopeAllDims.maxs[i]))):(u.push(t.envelopeAllDims.mins[i]),u.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:o?"ISO8601":a,hasRegularIntervals:!0,extent:u,interval:l,intervalUnit:r})}if(i.forEach(t=>{const{allowedValues:n}=t,i=2===n?.length?[{min:n[0],max:n[1],avg:-1,stddev:-1}]:null;a.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),statistics:i,dimensions:[...e]})}),a.length){const e={variables:a};return d(e),e}}return null}function F(e,t){const n=p(e,"RectifiedGrid"),i=c(n,"low"),s=c(n,"high"),a=[];for(let o=0;o<i.length;o++)a.push(s[o]-i[o]+1);const l=r(n,"axisLabels").split(" "),u=c(n,"origin/pos"),m=o(n,"offsetVector"),d=[];for(let o=0;o<m.length;o++){const e=c(m[o]),t=e.findIndex(e=>0!==e);d[t]=e[t]}const f=["y","lat","latitude","north","nor","n","b"];let g=!1;if(t?.length&&l?.length){g=[...t].sort((e,t)=>e<t?-1:1).join(",")===[...l].sort((e,t)=>e<t?-1:1).join(",")}const h=g?l:t;let b,x,v;return f.includes(h[0].toLowerCase())?(b=a[1],x=a[0],v={y:Math.abs(d[0]),x:Math.abs(d[1])}):(b=a[0],x=a[1],v={x:Math.abs(d[0]),y:Math.abs(d[1])}),{columns:b,rows:x,origin:u,offset:d,resolution:v,gridSamples:a,axisLabels:l,hasSameAxisLabelsAsBoundedBy:g}}function O(e){const n=p(e,"EarthObservation");if(!n)return null;const i=p(n,"phenomenonTime"),s=i?S(i):null,a=p(n,"phenomenonTime"),o=a?S(a):null,l=r(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let u=null;if(l){const e=l.split(" ").map(e=>e.trim()).filter(e=>null!=e&&""!==e).map(Number);if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);u=new t({rings:[[n]]})}}return{observation:{phenomenonTime:s,resultTime:o,footprint:u,identifier:r(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:r(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:r(e,"metaDataProperty/EarthObservationMetaData/status")}}}function B(e){const t={version:"2.0"};let n,s,a=[];for(let i=0;i<e.childNodes.length;i++){const o=e.childNodes[i];if(1===o.nodeType)if(l(o,"coverageId"))t.coverageId=r(o);else if(l(o,"ServiceParameters"))t.serviceParameters={supportedFormats:u(o,"nativeFormat")};else if(l(o,"boundedBy"))t.boundedBy=P(o);else if(l(o,"rangeType")){const e=E(o,t.boundedBy?.axisLabels.length>2||t.domainSet?.axisLabels.length>2);t.rangeType=e.rangeType,a=e.bandNames,n=e.bandStats;const{bandNoDataValues:i}=e;i?.length&&(s=D(i))}else if(l(o,"domainSet"))t.domainSet=F(o,t.boundedBy?.axisLabels);else if(l(o,"metadata")){const e=p(o,"EOMetadata");t.eoMetadata=e?O(e):null}}const{coverageId:o,boundedBy:m,domainSet:c,rangeType:d,serviceParameters:f}=t,g=A(d,m,c);!n&&g&&(n=g?.variables[0].statistics),null!=g&&(s=d[0][0].nilValue);return{id:o,title:o,description:o,bandNames:a,rasterInfo:new i({width:c.columns,height:c.rows,pixelSize:c.resolution,pixelType:"unknown",extent:m.envelope,spatialReference:m.envelope.spatialReference,bandCount:a.length||1,statistics:n,noDataValue:s,multidimensionalInfo:g}),supportedFormats:f.supportedFormats,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function k(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return o(n,"CoverageOffering").map(e=>L(e))}const i=o(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map(e=>N(e,t)):i.map(e=>B(e))}export{k as parseCoverages,h as standardizeInterpolations};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,127]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null;function r(){return n||(n=import("../../../chunks/lerc-wasm.js").then(e=>e.l).then(({default:t})=>t({locateFile:t=>e(`esri/layers/support/rasterFormats/${t}`)})).then(e=>{l(e)}),n)}const a={getBlobInfo:null,decode:null};function o(e){return 16+(e>>3<<3)}function s(e,t,n){n.set(e.slice(t,t+n.length))}function l(e){const{_malloc:n,_free:r,_lerc_getBlobInfo:l,_lerc_getDataRanges:i,_lerc_decode_4D:u,asm:f}=e;let c;const h=Object.values(f).find(t=>t&&"buffer"in t&&t.buffer===e.HEAPU8.buffer),y=e=>{const t=e.map(e=>o(e)),r=t.reduce((e,t)=>e+t),a=n(r);c=new Uint8Array(h.buffer);let s=t[0];t[0]=a;for(let n=1;n<t.length;n++){const e=t[n];t[n]=t[n-1]+s,s=e}return t};a.getBlobInfo=e=>{const t=12,n=3,a=new Uint8Array(4*t),o=new Uint8Array(8*n),[u,f,p]=y([e.length,a.length,o.length]);c.set(e,u),c.set(a,f),c.set(o,p);let g=l(u,e.length,f,p,t,n);if(g)throw r(u),new Error(`lerc-getBlobInfo: error code is ${g}`);c=new Uint8Array(h.buffer),s(c,f,a),s(c,p,o);const d=new Uint32Array(a.buffer),b=new Float64Array(o.buffer),[w,A,,m,U,x,C,V,T,D,z]=d,F={version:w,depthCount:D,width:m,height:U,validPixelCount:C,bandCount:x,blobSize:V,maskCount:T,dataType:A,minValue:b[0],maxValue:b[1],maxZerror:b[2],statistics:[],bandCountWithNoData:z};if(z&&D>1)return r(u),F;if(1===D&&1===x)return r(u),F.statistics.push({minValue:b[0],maxValue:b[1]}),F;const I=D*x*8,_=new Uint8Array(I),k=new Uint8Array(I);let B=u,S=0,v=0,E=!1;if(c.byteLength<u+2*I?(r(u),E=!0,[B,S,v]=y([e.length,I,I]),c.set(e,B)):[S,v]=y([I,I]),c.set(_,S),c.set(k,v),g=i(B,e.length,D,x,S,v),g)throw r(B),E||r(S),new Error(`lerc-getDataRanges: error code is ${g}`);c=new Uint8Array(h.buffer),s(c,S,_),s(c,v,k);const O=new Float64Array(_.buffer),$=new Float64Array(k.buffer),j=F.statistics;for(let r=0;r<x;r++)if(D>1){const e=O.slice(r*D,(r+1)*D),t=$.slice(r*D,(r+1)*D),n=Math.min.apply(null,e),a=Math.max.apply(null,t);j.push({minValue:n,maxValue:a,depthStats:{minValues:e,maxValues:t}})}else j.push({minValue:O[r],maxValue:$[r]});return r(B),E||r(S),F},a.decode=(e,n)=>{const{maskCount:a,depthCount:o,bandCount:l,width:i,height:f,dataType:p,bandCountWithNoData:g}=n,d=t[p],b=i*f,w=new Uint8Array(b*l),A=b*o*l*d.size,m=new Uint8Array(A),U=new Uint8Array(l),x=new Uint8Array(8*l),[C,V,T,D,z]=y([e.length,w.length,m.length,U.length,x.length]);c.set(e,C),c.set(w,V),c.set(m,T),c.set(U,D),c.set(x,z);const F=u(C,e.length,a,V,o,i,f,l,p,T,D,z);if(F)throw r(C),new Error(`lerc-decode: error code is ${F}`);c=new Uint8Array(h.buffer),s(c,T,m),s(c,V,w);let I=null;if(g){s(c,D,U),s(c,z,x),I=[];const e=new Float64Array(x.buffer);for(let t=0;t<U.length;t++)I.push(U[t]?e[t]:null)}return r(C),{data:m,maskData:w,noDataValues:I}}}function i(e,t,n,r,a){if(n<2)return e;const o=new r(t*n);for(let s=0,l=0;s<t;s++)for(let r=0,a=s;r<n;r++,a+=t)o[a]=e[l++];return o}function u(e,n={}){const r=n.inputOffset??0,o=e instanceof Uint8Array?e.subarray(r):new Uint8Array(e,r),s=a.getBlobInfo(o),{data:l,maskData:u,noDataValues:f}=a.decode(o,s),{width:c,height:h,bandCount:y,depthCount:p,dataType:g,maskCount:d,statistics:b}=s,w=t[g],A=new w.ctor(l.buffer),m=[],U=[],x=c*h,C=x*p;for(let t=0;t<y;t++){const e=A.subarray(t*C,(t+1)*C);if(n.returnInterleaved)m.push(e);else{const t=i(e,x,p,w.ctor);m.push(t)}U.push(u.subarray(t*C,(t+1)*C))}const V=0===d?null:1===d?U[0]:new Uint8Array(x);if(d>1){V.set(U[0]);for(let e=1;e<U.length;e++){const t=U[e];for(let e=0;e<x;e++)V[e]=V[e]&t[e]}}const{noDataValue:T}=n,D=null!=T&&w.range[0]<=T&&w.range[1]>=T;if(d>0&&D)for(let t=0;t<y;t++){const e=m[t],n=U[t]||V;for(let t=0;t<x;t++)0===n[t]&&(e[t]=T)}const z=d===y&&y>1?U:null,{pixelType:F}=w;return{width:c,height:h,bandCount:y,pixelType:F,depthCount:p,statistics:b,pixels:m,mask:V,bandMasks:z,noDataValues:f}}function f(e,t={}){const n=e instanceof Uint8Array?e.subarray(t.inputOffset??0):new Uint8Array(e,t.inputOffset??0);return a.getBlobInfo(n)}export{u as decode,f as getBlobInfo,r as load,t as pixelTypeInfoMap};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{getAssetUrl as t}from"../../../assets.js";const n=new Set(["uint8","int8","uint16","int16","uint32","int32","int64","uint64"]),r=new Map([["uint8",{byteCount:1,ctor:Uint8Array}],["int8",{byteCount:1,ctor:Int8Array}],["uint16",{byteCount:2,ctor:Uint16Array}],["int16",{byteCount:2,ctor:Int16Array}],["uint32",{byteCount:4,ctor:Uint32Array}],["int32",{byteCount:4,ctor:Int32Array}],["uint64",{byteCount:8,ctor:BigUint64Array}],["int64",{byteCount:8,ctor:BigInt64Array}]]);let e;function o(){return e??=import("../../../chunks/qb3-wasm.js").then(({default:n})=>n({locateFile:n=>t(`esri/layers/support/rasterFormats/${n}`)})).then(t=>{u(t)}),e}const i={getBlobInfo:null,decode:null};function a(t){if(!r.has(t))throw new Error("Unsupported data type: "+t);return r.get(t)}function u(t){const{_GetInfo:r,_decode:e,_malloc:o,_free:u,writeArrayToMemory:c,UTF8ToString:l}=t;i.getBlobInfo=t=>{t.length>1e3&&(t=t.slice(0,1e3));const n=o(t.length);c(t,n);const e=r(n,t.length);if(u(n),!e)return null;const i=l(e);u(e);try{const t=JSON.parse(i);return{width:t.xsize,height:t.ysize,bandCount:t.nbands,dataType:t.dtype,mode:t.mode,bandMap:t.bandmap}}catch{return null}},i.decode=(r,o)=>{const{dataType:i,width:u,height:c,bandCount:l}=o;if(!n.has(i))throw new Error("Unsupported data type: "+i);const{_malloc:s,_free:y}=t,d=s(r.length);t.writeArrayToMemory(r,d);const{ctor:h,byteCount:f}=a(i),g=u*c*l*f,b=s(g),p=s(1024);if(0===e(d,r.length,b,p))throw y(d),y(b),y(p),new Error("Decoding failed: "+t.UTF8ToString(p));const w=new h(t.HEAPU8.slice(b,b+g).buffer);if(y(d),y(b),y(p),w instanceof BigInt64Array||w instanceof BigUint64Array){const t=new Float64Array(w.length);for(let n=0;n<w.length;n++)t[n]=Number(w[n]);return t}return w}}function c(t){const n=new Uint8Array(t),r=i.getBlobInfo(n);if(!r)return null;const e=i.decode(n,r);if(!e)return null;const{width:o,height:u,bandCount:c,dataType:l}=r,{ctor:s}=a(l),y=s===BigInt64Array||s===BigUint64Array?Float64Array:s,d=Array.from({length:c},()=>new y(o*u));for(let i=0,a=0;i<o*u;i++)for(let t=0;t<c;t++)d[t][i]=e[a++];return{width:o,height:u,pixels:d}}export{c as decode,o as load};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"../PixelBlock.js";import{SimpleBandStatistics as i}from"../SimpleBandStatistics.js";import s from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as n,decode as o}from"./Lerc.js";import{decode as h}from"./Lzw.js";import{convertNoDataToMask as c}from"./pixelRangeUtils.js";import{Z as l}from"../../../chunks/Zlib.js";import{load as p,decode as d}from"./Qb3.js";import u from"./Raw.js";import{decodeTileOrStrip as f,decode as m}from"./TiffDecoder.js";import{isPlatformLittleEndian as g}from"./utils.js";var w=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,c,p,d,u,f,m,g,w,y,b,x,k,T,C,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new l(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=x=0;x<w;s=x+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],i=(s-s%u)/u,y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=C=0;C<w;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=I=0;I<w;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===g?y=b=0:(y=f[(g-1)*w+i*u+s%u],b=i&&f[(g-1)*w+(i-1)*u+s%u]),o=r+y-b,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-b),c=h<=p&&h<=d?r:p<=d?y:b,f[a++]=(e+c)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const y=new Set(["jpg","png","bmp","gif"]);async function b(e,s){if(!g)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await n();const{offset:r}=s,{width:h,height:c,pixelType:l,statistics:p,depthCount:d,noDataValues:u,bandMasks:f,pixels:m,mask:w}=o(e,{inputOffset:r,returnInterleaved:s.returnInterleaved}),y=new a({width:h,height:c,pixelType:l.toLowerCase(),pixels:m,mask:w,statistics:p.map(({minValue:t,maxValue:e})=>new i(t,e)),bandMasks:f,depthCount:d,noDataValues:u});return p?.length||y.updateStatistics(),y}async function x(e,i){await p();const s=d(e);if(!s)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:r,height:n,pixels:o}=s,h=new a({width:r,height:n,pixelType:"u16",pixels:o});return h.updateStatistics(),h}async function k(t,i){const s=await m(t,{...i,noDataValue:i.tiffNoDataValue,matchAllNoData:i.matchAllNoData});e(s);const r=new a({width:s.width,height:s.height,pixels:s.pixels,pixelType:s.pixelType.toLowerCase(),mask:s.mask,bandMasks:s.bandMasks,statistics:null});return r.updateStatistics(),r}async function T(t,e){const i=await f(t,e.customOptions),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,statistics:null});return s.updateStatistics(),s}function C(t,e){const i=e.pixelType||"u8",s=a.getPixelArrayConstructor(i),r="u8"===i?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let a=0;a<o;a++){const i=(e.width||1)*(e.height||t.length),h=new s(i);for(let t=0;t<i;t++)h[t]=r[t*o+a];n.push(h)}const h=new a({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:i,statistics:null});return h.updateStatistics(),h}function I(t,e){return C(new l(new Uint8Array(t)).getBytes(),e)}function A(t,e){return C(h(t,e.offset,e.eof,!e.isInputBigEndian),e)}function v(t,e,i){const{pixelTypeCtor:s}=P(e.pixelType),r=(0,u.decode)(t,{width:e.width,height:e.height,pixelType:s,format:i}),n=new a({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function D(t,e){const i=r.decode(t,e.hasNoZlibMask??void 0),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:"u8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function U(t,e){const i=new Uint8Array(t),s=new w(i),{width:r,height:n}=e,o=r*n,h=s.decode();let c,l=0,p=0;const d=new Uint8Array(o);for(l=0;l<o;l++)d[l]=h[4*l+3];const u=new a({width:r,height:n,pixels:[],pixelType:"u8",mask:d,statistics:[]});for(l=0;l<3;l++){for(c=new Uint8Array(o),p=0;p<o;p++)c[p]=h[4*p+l];u.addData({pixels:c})}return u.updateStatistics(),u}async function S(t,e,i,r){const n=new s,o={applyJpegMask:!1,format:e,...i},h=await n.decode(t,o,r),c=new a(h);return c.updateStatistics(),c}function j(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":81===a[0]&&66===a[1]&&51===a[2]?i="qb3":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function O(e){let a=null;switch(e){case"lerc":case"lerc2":a=b;break;case"jpg":a=D;break;case"png":a=U;break;case"bsq":case"bip":a=(t,a)=>v(t,a,e);break;case"tiff":a=k;break;case"deflate":a=I;break;case"lzw":a=A;break;case"qb3":a=x;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function P(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function M(t,e=1){if(!t)return;const{pixels:i,width:s,height:r,mask:n}=t;if(!i||0===i.length)return;const o=i.length,h=s-1,c=r-1,l=[];let p,d,u,f,m,g,w=null;const y=a.getPixelArrayConstructor(t.pixelType);if(0===e){for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];l.push(g)}if(null!=n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;l.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=l}function L(t){let e=j(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function R(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return T(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=j(e)),i.useCanvas&&y.has(r))return S(e,r,i,s);const n=O(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:h}=i;if(h&&h.length>1){const t=h.map((t,a)=>n(e.slice(t,h[a+1]),i)),s=await Promise.all(t);o=s[0],o.pixels=s.map(t=>t.pixels[0]);const r=s.map(t=>t.mask);s.some(t=>null!=t)&&(r.forEach((t,e)=>{null==t&&(r[e]=new Uint8Array(o.width*o.height).fill(255))}),o.bandMasks=r,o.mask=a.combineBandMasks(r)),o.updateStatistics()}else o=await n(e,{...i,offset:h?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&c(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&M(o),o}export{R as decode,L as getFormat};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import"../../../core/has.js";import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as r}from"./pixelRangeUtils.js";import{tiffTags as s,ifdTags as l,getTagName as o,geoKeys as f}from"./tiffTag.js";import{isPlatformLittleEndian as u}from"./utils.js";import{Z as c}from"../../../chunks/Zlib.js";const h=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],g=4294967296,E=new Set([1,5,6,7,8,34712,34887]);function I(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function T(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function w(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function p(e,t){return e.get(t)?.values}function d(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function y(e,t){return e.get(t)?.values?.[0]}function A(e,t,n,a=0,i=s,r=4){const l=8===r,f=l?B(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),u=4+2*r,c=l?8:2,h=c+f*u;if(n+h>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:h};const g=8===r?8:4,E=n+h+g<=e.byteLength?W(new DataView(e,n+h,g),0,t,8===r):null,I=n+c,T=new Map;let w,p,d,m,y,A=0,S=0;for(let s=0;s<f;s++){p=new DataView(e,I+u*s,u),d=p.getUint16(0,t),y=p.getUint16(2,t),m=o(d,i);const n=[];2===r?(A=p.getUint16(4,t),S=p.getUint16(6,t)):4===r?(A=p.getUint32(4,t),S=p.getUint32(8,t)):8===r&&(A=W(p,4,t,!0),S=W(p,12,t,!0),n.push(p.getUint32(12,t)),n.push(p.getUint32(16,t))),w={id:d,type:y,valueCount:A,valueOffset:S,valueOffsets:n,values:null},N(e,t,w,a,!1,r),T.set(m,w)}return{success:!0,ifd:T,nextIFD:E,requiredBufferSize:h}}const S=(e,t)=>a(e,{inputOffset:t}).pixels[0];function M(e,t){if(t%8==0)return e;const n=t>16?32:t>8?16:8;n>8&&(e=b(e,32===n?4:2));const a=32===n?Uint32Array:16===n?Uint16Array:Uint8Array,i=new a(e),r=Math.floor(8*e.byteLength/t+1e-6),s=new a(r),l=(1<<t)-1;let o=0,f=0,u=0;for(let c=0;c<r;c++)if(0===f&&(u=i[o++],f=n),f>=t)s[c]=u>>>f-t&l,f-=t;else{const e=t-f;let a=(u&l)<<e&l;u=i[o++],f=n-e,a+=u>>>f,s[c]=a}return s.buffer}function P(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const r=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(r.buffer)}function O(e){const t=new c(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}function b(e,t){const n=new Uint8Array(e),a=new Uint8Array(n.length);if(2===t)for(let i=0;i<n.length;i+=2)a[i]=n[i+1],a[i+1]=n[i];else if(4===t)for(let i=0;i<n.length;i+=4)a[i]=n[i+3],a[i+1]=n[i+2],a[i+2]=n[i+1],a[i+3]=n[i];else for(let i=0;i<n.length;i+=8)a[i]=n[i+7],a[i+1]=n[i+6],a[i+2]=n[i+5],a[i+3]=n[i+4],a[i+4]=n[i+3],a[i+5]=n[i+2],a[i+6]=n[i+1],a[i+7]=n[i];return a.buffer}async function x(e,t,a,r,s){const l=u===t,o=y(a,"BITSPERSAMPLE"),f=y(a,"SAMPLESPERPIXEL")??1,c=y(a,"PHOTOMETRICINTERPRETATION"),h=y(a,"SAMPLEFORMAT")??1,g=I(h,o),E=y(a,"COMPRESSION")??1,w=T(g);let p,d,m;if(34887===E)return await n(),S(e,r);if(1===E)p=e.slice(r,r+s),d=new Uint8Array(p);else if(8===E||32946===E)d=new Uint8Array(e,r,s),d=O(d),p=d.buffer;else if(6===E)d=new Uint8Array(e,r,s),d=P(d,f,c),p=d.buffer;else if(7===E){const t=a.get("JPEGTABLES").values,n=t.length-2;d=new Uint8Array(n+s-2);for(let e=0;e<n;e++)d[e]=t[e];const i=new Uint8Array(e,r+2,s-2);for(let e=0;e<i.length;e++)d[n+e]=i[e];d=P(d,f,c),p=d.buffer}else{if(5!==E)throw new Error("tiff-decode: unsupport compression "+E);d=i(e,r,s,t),p=d.buffer}if(p=M(p,o),l||o<=8)m=new w(p);else{const e=o>32?8:o>16?4:2;m=new w(b(d.buffer,e))}const A=y(a,"PREDICTOR")??1,x=y(a,"TILEWIDTH"),L=y(a,"TILELENGTH");if(A>1&&(5===E||8===E||32946===E)&&x&&L){const e=C(a),t=new w(m.length);t.set(m),m=j(t,L,x,3===h&&3===A,e?1:f)}return m}async function L(e,t,n){const a=d(n,"TILEOFFSETS");if(void 0===a)return null;const i=d(n,"TILEBYTECOUNTS"),{width:r,height:s,pixelType:l,tileWidth:o,tileHeight:f}=k([n]),u=C(n,t),c=y(n,"SAMPLESPERPIXEL")||t.planes,h=r*s,g=y(n,"BITSPERSAMPLE"),E=34887===(y(n,"COMPRESSION")??1),I=T(l),w=[];for(let T=0;T<c;T++)w.push(new I(h));let p,m,A,S,M,P,O,b,L,D,R,U,N;const G=Math.ceil(r/o),v=new Uint8Array(h).fill(255);let F=!1;if(g%8==0)if(E&&u&&c>1){const l=Math.round(a.length/c);for(p=0;p<l;p++){P=Math.floor(p/G)*f,O=p%G*o,b=P*r+O;for(let l=0;l<c;l++){const u=p*c+l;for(0===i[u]?(A=null,F=!0):A=await x(e,t.littleEndian,n,a[u],i[u]),D=0,L=b,U=Math.min(o,r-O),R=Math.min(f,s-P),N=w[l],S=0;S<R;S++)for(L=b+S*r,D=S*o,M=0;M<U;M++,L++,D++)A?N[L]=A[D]:v[L]=0}}}else for(p=0;p<a.length;p++)for(P=Math.floor(p/G)*f,O=p%G*o,b=P*r+O,0===i[p]?(A=null,F=!0):A=await x(e,t.littleEndian,n,a[p],i[p]),D=0,L=b,U=Math.min(o,r-O),R=Math.min(f,s-P),m=0;m<c;m++)if(N=w[m],u||E)for(S=0;S<R;S++)for(L=b+S*r,D=o*f*m+S*o,M=0;M<U;M++,L++,D++)A?N[L]=A[D]:v[L]=0;else for(S=0;S<R;S++)for(L=b+S*r,D=S*o*c+m,M=0;M<U;M++,L++,D+=c)A?N[L]=A[D]:v[L]=0;return{width:r,height:s,pixelType:l,pixels:w,mask:F?v:void 0}}const D=(e,t,n)=>{const a=u===t.littleEndian,r=d(n,"STRIPOFFSETS");if(void 0===r)return null;const{width:s,height:l,pixelType:o}=k([n]),f=y(n,"SAMPLESPERPIXEL")||t.planes,c=y(n,"PHOTOMETRICINTERPRETATION"),h=s*l,g=y(n,"BITSPERSAMPLE"),E=T(o),I=new E(h*f),w=d(n,"STRIPBYTECOUNTS"),p=y(n,"ROWSPERSTRIP"),m=y(n,"COMPRESSION")??1;let A,S,b,x,L,D,R,U,N;if(g%8==0)for(A=0;A<r.length;A++){if(L=A*(p*s)*f,"u8"===o||"s8"===o||a)8===m||32946===m?(R=new Uint8Array(e,r[A],w[A]),R=O(R),D=R.buffer):6===m?(R=new Uint8Array(e,r[A],w[A]),R=P(R,f,c),D=R.buffer):5===m?(R=i(e,r[A],w[A],t.littleEndian),D=R.buffer):D=e.slice(r[A],r[A]+w[A]),D=M(D,g),x=new E(D);else{switch(6===m||8===m||32946===m?(R=new Uint8Array(e,r[A],w[A]),U=O(R),D=U.buffer):(D=new ArrayBuffer(w[A]),R=new Uint8Array(e,r[A],w[A]),U=new Uint8Array(D)),o){case"u16":case"s16":for(b=0;b<R.length;b+=2)U[b]=R[b+1],U[b+1]=R[b];break;case"u32":case"s32":case"f32":for(b=0;b<R.length;b+=4)U[b]=R[b+3],U[b+1]=R[b+2],U[b+2]=R[b+1],U[b+3]=R[b]}D=M(D,g),x=new E(D)}I.set(x,L)}const C=[];if(1===f)C.push(I);else for(A=0;A<f;A++){for(N=new E(h),S=0;S<h;S++)N[S]=I[S*f+A];C.push(N)}return{width:s,height:l,pixelType:o,pixels:C}},R=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,r;const s=e[0].length,l=e.length,o=new Uint8Array(s);for(let f=0;f<l;f++)if(a=e[f],i=t[f],r=n[f],0===f)for(let e=0;e<s;e++)o[e]=a[e]<i||a[e]>r?0:1;else for(let e=0;e<s;e++)o[e]&&(o[e]=a[e]<i||a[e]>r?0:1);return o},U=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,r,s,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),s=a.indexOf("sample="),s>-1&&(l=a.slice(s+8,a.indexOf('"',s+8))),s=a.indexOf("name="),s>-1&&(i=a.slice(s+6,a.indexOf('"',s+6))),i&&(r=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=r:n.set(i,[r]):n.set(i,r)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),I=n.get("WavelengthMax");let T=null;if(g){T=[];for(let e=0;e<g.length;e++)T.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:I&&parseFloat(I[e])})}return{statistics:h,bandProperties:T,dataType:n.get("DataType"),rawMetadata:n}};function N(e,t,n,a=0,i=!1,r=4){if(n.values)return!0;const s=n.type,l=n.valueCount;let o=n.valueOffset,f=[];const u=h[s],c=8*u,E=l*u,I=l*h[s]*8;let T,w;const p=8===r?64:32,d=n.valueOffsets;if(I>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(I<=p){if(!t)if(p<=32)o>>>=32-I;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/g);I<=32?(o=e>>>32-I,d[0]=o):(o=e*2**(32-I)+(t>>>32-I),d[0]=e,d[1]=t>>>32-I)}if(1===l&&c===p)f=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/g);let n=e,a=32;for(w=1;w<=l;w++){const e=32-c*w%32;if(a<c){const i=n<<e>>>32-a,r=t<<32-a>>>32-a;n=t,f.push(i+r*2**(c-a)),a-=32-(c-a)}else f.push(n<<e>>>32-c),a-=c;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-c*w;f.push(o<<e>>>32-c)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=u){switch(s){case 1:case 2:case 7:T=new DataView(e,n,1).getUint8(0);break;case 3:T=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:T=new DataView(e,n,4).getUint32(0,t);break;case 5:T=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:T=new DataView(e,n,1).getInt8(0);break;case 8:T=new DataView(e,n,2).getInt16(0,t);break;case 9:T=new DataView(e,n,4).getInt32(0,t);break;case 10:T=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:T=new DataView(e,n,4).getFloat32(0,t);break;case 12:T=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:T=B(new DataView(e,n,8),0,t);break;case 17:T=V(new DataView(e,n,8),0,t);break;default:T=null}f.push(T)}}if(2===s){let e="";const t=f;for(f=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(f.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==f.length||f.push(e)}return n.values=f,!0}function k(e){const t=e[0],n=y(t,"TILEWIDTH"),a=y(t,"TILELENGTH"),i=y(t,"IMAGEWIDTH"),r=y(t,"IMAGELENGTH"),s=y(t,"BITSPERSAMPLE"),l=y(t,"SAMPLESPERPIXEL"),o=y(t,"SAMPLEFORMAT")??1,f=I(o,s),u=C(t),c=p(t,"GDAL_NODATA");let h=null;c?.length&&(h=c.map(e=>parseFloat(e)),h.some(e=>isNaN(e))&&(h=null));const g=y(t,"COMPRESSION")??1;let T;switch(g){case 1:T="NONE";break;case 2:case 3:case 4:case 32771:T="CCITT";break;case 5:T="LZW";break;case 6:case 7:T="JPEG";break;case 32773:T="PACKBITS";break;case 8:case 32946:T="DEFLATE";break;case 34712:T="JPEG2000";break;case 34887:T="LERC";break;default:T=String(g)}let A=!0,S="";E.has(g)||(A=!1,S+="unsupported tag compression "+g),o>3&&(A=!1,S+="unsupported tag sampleFormat "+o),s>32&&64!==s&&(A=!1,S+="unsupported tag bitsPerSample "+s);const M=m(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find(e=>e.includes("ESRI PE String = ")),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=d(t,"GEOTIEPOINTS"),b=d(t,"GEOPIXELSCALE"),x=d(t,"GEOTRANSMATRIX"),L=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let D,R,N=!1,k=!1;if(L){N=2===y(L,"GTRasterTypeGeoKey");const e=y(L,"GTModelTypeGeoKey");if(2===e){const e=y(L,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(k=!0,P={wkid:4326})}else if(1===e){const e=y(L,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(D=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],N&&(D[2]-=.5*D[0]+.5*D[1],D[5]-=.5*D[3]+.5*D[4])):x&&16===x.length&&(D=N?[x[0],x[1],x[3]-.5*x[0],x[4],x[5],x[7]-.5*x[5]]:[x[0],x[1],x[3],x[4],x[5],x[7]]),D){const e=[{x:0,y:r},{x:0,y:0},{x:i,y:r},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=w(e[i],D),n=t.x>n?n:t.x,s=t.x<s?s:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;R={xmin:n,xmax:s,ymin:a,ymax:l,spatialReference:P}}else R={xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:P};k&&(R.xmax-R.xmin>400||Math.max(Math.abs(R.xmin),Math.abs(R.xmax))>361)&&(P=null,R.spatialReference=null);const F=G(e);let B,V,W,H,Y;if(F.length>0){W=Math.round(Math.log(i/y(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];H=F.length,B=y(e,"TILEWIDTH"),V=y(e,"TILELENGTH")}B=null!=H&&H>0?B||n:null,V=null!=H&&H>0?V||a:null,n&&(Y=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(r/a)-1,minRow:0,minCol:0}],F.forEach(e=>{Y.push({maxCol:Math.ceil(y(e,"IMAGEWIDTH")/y(e,"TILEWIDTH"))-1,maxRow:Math.ceil(y(e,"IMAGELENGTH")/y(e,"TILELENGTH"))-1,minRow:0,minCol:0})}));const j=m(e[0],"GDAL_METADATA"),X=U(j);S+=" "+_({width:i,height:r,tileWidth:n,tileHeight:a,planes:l,ifds:e});const K=v(e).length===F.length+1,J=F?.length?F.map(e=>({x:i/y(e,"IMAGEWIDTH"),y:r/y(e,"IMAGELENGTH")})):void 0;return{width:i,height:r,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:T,noData:h,hasMaskBand:K,isSupported:A,pyramidResolutions:J,message:S,extent:R,isPseudoGeographic:k,affine:b?null:D,firstPyramidLevel:W,maximumPyramidLevel:H,pyramidBlockWidth:B,pyramidBlockHeight:V,tileBoundary:Y,metadata:X}}function C(e,t){const n=p(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function G(e){return e.filter(e=>1===y(e,"NEWSUBFILETYPE"))}function v(e){return e.filter(e=>{const t=!(4&~(y(e,"NEWSUBFILETYPE")??0)),n=4===y(e,"PHOTOMETRICINTERPRETATION");return t&&n})}function F(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=H(e);let i=a;const r=[];do{const a=Y(e,t,i,0,s,n?8:4);if(!a.success)break;r.push(a.ifd),i=a.nextIFD}while(i>0);return{...k(r),littleEndian:t,isBigTiff:n,ifds:r,pyramidIFDs:G(r),maskIFDs:v(r)}}function B(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*g+a:a*g+i}function V(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const r=(n?a:i)>=0?1:-1;n?a*=r:i*=r;return r*(n?i*g+a:a*g+i)}function W(e,t,n,a){return a?B(e,t,n):e.getUint32(t,n)}function H(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let r=4;const s=43===i;if(s){const e=t.getUint16(r,a);if(r+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(r,a))throw new Error("unsupported bigtiff version");r+=2}return{littleEndian:a,isBigTiff:s,firstIFDPos:W(t,r,a,s)}}function Y(t,n,a,i=0,r=s,o=4){const u=A(t,n,a,i,r,o);let c;const h=u.ifd;if(h){if(l.forEach((e,a)=>{h.has(a)&&(c=h.get(a),c.data=A(t,n,c.valueOffset-i,i,e).ifd)}),h.has("GEOKEYDIRECTORY")){c=h.get("GEOKEYDIRECTORY");const e=c.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];c.data=A(t,n,c.valueOffset+6-i,i,f,2).ifd,c.data&&c.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(h.has("XMP")){c=h.get("XMP");const t=c.values;"number"==typeof t[0]&&7===c.type&&(c.values=[e(new Uint8Array(t))])}}return u}function _(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,r=e.planes,s=i?i*a:t*n,l=y(e.ifds[0],"BITSPERSAMPLE");let o="";return s*r>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function j(e,t,n,a,i){const r=a?4:1,s=n*r*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*s;for(let n=i;n<s;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*s;for(let n=0;n<o;n++)for(let a=0;a<r;a++)l[t+n*r+a]=e[t+n+(r-a-1)*o]}return new Float32Array(l.buffer)}async function X(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:s}=t,l=[];for(let r=0;r<i.length;r++){s[r];const t=await x(e,n.littleEndian,a,i[r],s[r]||e.byteLength);l.push(t)}const o=C(a,n),f=y(a,"BITSPERSAMPLE"),u=I(y(a,"SAMPLEFORMAT")??1,f),c=y(a,"SAMPLESPERPIXEL")||n.planes,h=T(u),g=y(a,"TILEWIDTH"),E=y(a,"TILELENGTH"),w=y(a,"COMPRESSION")??1,p=g*E;let d;const m=[];let A=l[0];const S=34887===w;for(let r=0;r<c;r++){if(d=new h(p),l.length===c)A=l[r],A.length===p&&(d=A);else if(A.length)if(o||S)d=A.length===p?A:A.slice(p*r,p*(r+1));else for(let e=0;e<p;e++)d[e]=A[e*c+r];m.push(d)}const M=n.noData?n.noData[0]:t.noDataValue,P=n.metadata?n.metadata.statistics:null,O=P?P.map(e=>e.min):null,b=P?P.map(e=>e.max):null,L={pixelType:u,width:g,height:E,pixels:m,noDataValue:M};return null!=M?r(L,M,{matchAllNoData:t?.matchAllNoData}):O&&b&&t.applyMinMaxConstraint&&(L.mask=R(m,O,b)),L}async function K(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||F(e),{ifds:i,noData:s}=a;if(0===i.length)throw new Error("no valid image file directory");const l=_(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=s??t.noDataValue;if(o=a.tileWidth?await L(e,a,f):D(e,a,f),!o)return o;if(null!=u){r(o,u,{matchAllNoData:null==s&&t?.matchAllNoData})}return o}export{K as decode,X as decodeTileOrStrip,k as getImageInfo,v as getMaskIFDs,G as getPyramidIFDs,C as isBSQConfig,N as parseFieldValues,F as parseHeader,Y as parseIFD,H as parseSignature,M as unpackBits};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as r,isIntegerPixelType as o}from"../rasterFormats/pixelRangeUtils.js";import i from"./ArithmeticFunctionArguments.js";import n from"./BaseRasterFunction.js";import{arithmetic as u}from"./localUtils.js";let p=class extends n{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:u(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],s=this.outputPixelType??"f32";let[i,n]=r(s);const u=o(s);return u&&(i-=1e-4,n+=1e-4),{imageCount:2,operationName:e,domainRange:[i,n],isOutputRounded:u}}};t([e({json:{write:!0,name:"rasterFunction"}})],p.prototype,"functionName",void 0),t([e({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],p.prototype,"functionArguments",void 0),t([e()],p.prototype,"rasterArgumentNames",void 0),p=t([s("esri.layers.support.rasterFunctions.ArithmeticFunction")],p);const a=p;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../rasterFormats/pixelRangeUtils.js";import n from"./BandArithmeticFunctionArguments.js";import{calculateBandIndex as r,getBandMatrix3 as a}from"./bandIndexUtils.js";import o from"./BaseRasterFunction.js";const c=new Set(["vari","mtvi2","rtvi-core","evi"]);let u=class extends o{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const e=this.sourceRasterInfos[0];if(e.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const t=e.clone();t.pixelType=this.outputPixelType,t.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(t),t.keyProperties={...t.keyProperties,BandProperties:void 0},this.rasterInfo=t;return{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(e){const t=e.pixelBlocks?.[0];if(null==t)return t;const{method:s,bandIndexes:i}=this.functionArguments,n=i.split(" ").map(e=>parseFloat(e));if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:e}=this,t=c.has(this.functionArguments.method)?3:2,s=n.slice(0,t).map(t=>e.indexOf(t-1));n.splice(0,t,...s)}return r(t,{method:s,bandIndexes:n,equation:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const e=this.functionArguments.bandIndexes.split(" ").map(e=>parseFloat(e)-1);2===e.length&&e.push(0);const t=this.isInputBandIdsSwizzled?[0,1,2]:e;let s,n;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=a([t[0],t[1],0]),n="ndxi";break;case"ndwi":s=a([t[1],t[0],0]),n="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=a([t[0],t[1],0]),n="sr";break;case"ci-g":case"ci-re":s=a([t[0],t[1],0]),n="ci";break;case"savi":s=a([t[0],t[1],0]),n="savi",r[0]=e[2]+1;break;case"tsavi":s=a([t[0],t[1],0]),n="tsavi",r[0]=e[2]+1,r[1]=e[3]+1,r[2]=e[4]+1;break;case"msavi":s=a([t[0],t[1],0]),n="msavi";break;case"gemi":s=a([t[0],t[1],0]),n="gemi";break;case"pvi":s=a([t[0],t[1],0]),n="tsavi",r[0]=e[2]+1,r[1]=e[3]+1;break;case"vari":s=a([t[0],t[1],t[2]]),n="vari";break;case"mtvi2":s=a([t[0],t[1],t[2]]),n="mtvi";break;case"rtvi-core":s=a([t[0],t[1],t[2]]),n="rtvicore";break;case"evi":s=a([t[0],t[1],t[2]]),n="evi";break;case"wndwi":s=a([t[0],t[1],0]),n="wndwi",r[0]=e[3]?e[3]+1:.5;break;case"bai":s=a([t[1],t[0],0]),n="bai";break;default:s=a([0,1,2]),n="custom"}return{bandIndexMat3:s,indexType:n,adjustments:r,isOutputRounded:i(this.outputPixelType)}}_getInputBandIds(e){if("custom"===this.functionArguments.method)return e;const t=this.functionArguments.bandIndexes.split(" ").map(e=>parseFloat(e)-1),s=e.length,i=t.map(e=>e>=s?s-1:e),n=c.has(this.functionArguments.method)?3:2,r=i.slice(0,n).map(t=>e[t]);return 2===r.length&&r.push(0),r}_swizzleBandIds(e){const t=this.functionArguments.bandIndexes.split(" ").map(e=>parseFloat(e)-1);2===t.length&&t.push(0);const{method:s}=this.functionArguments,i=(["vari","mtvi2","rtvi-core","evi"].includes(s)?t.slice(0,3):"bai"===s||"ndwi"===s?[t[1],t[0]]:t.slice(0,2)).map(t=>e.indexOf(t));return i[2]??=i[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=i,!1}};e([t({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),e([t({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),e([t()],u.prototype,"rasterArgumentNames",void 0),u=e([s("esri.layers.support.rasterFunctions.BandArithmeticFunction")],u);const m=u;export{m as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{property as e,cast as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import i from"../PixelBlock.js";import o from"../RasterInfo.js";const a=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let u=class extends s{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this.isRoot=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const s=[t],{parameters:e}=t;let r=e.rasters||e.raster&&[e.raster];for(;r?.length;){s.unshift(...r);const t=[];for(let s=0;s<r.length;s++){const{parameters:e}=r[s],n=e.rasters||e.raster&&[e.raster];n?.length&&t.push(...n)}r=t}for(let a=s.length-1;a>=0;a--)s[a].isNoopProcess&&s.splice(a,1);let n=!1;for(let a=0;a<s.length;a++){const t=s[a];t.id=s.length-a-1;const{rasters:e}=t.parameters;n=n||null!=e&&e.length>1}const i=s.some(({name:t})=>a.has(t.toLowerCase())),{rawSourceRasterInfos:o}=this;return{functions:s,hasBranches:n,hasFocalFunction:i,isSourceSingleBand:1===o?.[0]?.bandCount}}bind(t,s=!1,e=-1){this.id=e+1;const r=this._getRasterValues();let n=!0;for(let i=0;i<r.length;i++){const e=r[i];if(null!=e&&this._isRasterFunctionValue(e)){const r=e.bind(t,s,this.id+i);if(!r.success)return this._bindingResult=r,r;n=n&&r.supportsGPU}}if(!this.rasterInfo||s){if(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),n&&=this._bindingResult.supportsGPU,this._bindingResult.success&&(this._patchRasterInfo(),n&&this.isRoot)){this.processInputBandIds();this.swizzleInputBandIds(this.rawInputBandIds)||(n=this.rawInputBandIds.length<=3)}return this._bindingResult.supportsGPU=n,this._bindingResult}return this._bindingResult={success:!0,supportsGPU:!0},this._bindingResult}process(t){const s=this._getRasterValues(),e=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map(s=>this._readRasterValue(s,t));return this._processPixels({...t,pixelBlocks:e})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);if(t.length>1){const s=t.map(t=>t.processInputBandIds());return this.rawInputBandIds=[...new Set(s.flat())],this.rawInputBandIds}const s=t[0];if(s)return this.rawInputBandIds=s.processInputBandIds(),this.rawInputBandIds;const{bandCount:e}=this.sourceRasterInfos[0],r=Array.from({length:e},(t,s)=>s);return this.rawInputBandIds=this._getInputBandIds(r),this.rawInputBandIds}swizzleInputBandIds(t){const s=this._getRasterValues().filter(this._isRasterFunctionValue);let e=!0;for(const r of s)e=r.swizzleInputBandIds(t)&&e;return!!e&&this._swizzleBandIds(t)}getPrimaryRasters(){const t=[],s=[];return this._getPrimaryRasters(this,t,s),{rasters:t,rasterIds:s}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:s,rasters:e}=this.functionArguments;return e&&Array.isArray(e)&&e.length?(t.rasters=e.map(t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(t=>null!=t)||(t.rasters=null)):this._isRasterFunctionValue(s)&&(t.raster=s.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:s,rasters:e}=this.functionArguments;if(e&&Array.isArray(e)&&e.length)e.forEach(s=>{if(this._isRasterFunctionValue(s)){const e=s.getClippingGeometries();t.push(...e)}});else if(this._isRasterFunctionValue(s)){const e=s.getClippingGeometries();t.push(...e)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_swizzleBandIds(t){return!0}_isInputRasterPrimaryOrConstant(){return!this._getRasterValues().some(t=>t&&"object"==typeof t&&"rasterFunction"in t&&t.rasterFunction)}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach(t=>{t.statistics=void 0,t.histograms=void 0})}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap(t=>this.functionArguments[t])}_getSourceRasterInfos(t){const s=this._getRasterValues(),{rasterInfos:e,rasterIds:r}=t;if(0===s.length)return e;const n=s.map(t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?e[r.indexOf(t)]:"number"!=typeof t?e[0]:void 0),i=n.find(t=>t)??e[0];return n.forEach((t,s)=>{void 0===t&&(n[s]=i)}),n}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,s=[],e=[]){for(let r=0;r<t.sourceRasters.length;r++){const n=t.sourceRasters[r];if("number"!=typeof n)if("bind"in n)this._getPrimaryRasters(n,s,e);else{const t=n,r=this._getPrimaryRasterId(t);if(null==r)continue;e.includes(r)||(this.mainPrimaryRasterId===r?(s.unshift(t),e.unshift(r)):(s.push(t),e.push(r)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,s){const{primaryPixelBlocks:e}=s;if(null==t||"$$"===t){const t=e[0];return null==t?null:t.clone()}if("string"==typeof t){const r=s.primaryRasterIds.indexOf(t);return-1===r?null:e[r]}if("number"==typeof t){const s=e[0];if(null==s)return null;const{width:r,height:n,pixelType:o}=s,a=new Float32Array(r*n);a.fill(t);const u=this.sourceRasterInfos[0].bandCount,l=new Array(u).fill(a);return new i({width:r,height:n,pixelType:o,pixels:l})}return t.process(s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:s,keyProperties:e,statistics:r,histograms:n}=t,i=e.BandProperties;i&&i.length!==s&&(t.keyProperties={...e,BandProperties:void 0}),r&&r.length!==s&&(t.statistics=r.length>s?r.slice(0,s):null),n&&n.length!==s&&(t.histograms=n.length>s?n.slice(0,s):null),e.BAND_COUNT&&Number(e.BAND_COUNT)!==s&&(t.keyProperties={...e,BAND_COUNT:"string"==typeof e.BAND_COUNT?String(s):s})}};t([e({json:{write:!0}})],u.prototype,"functionName",void 0),t([e({json:{write:!0}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}}),r(t=>t?.toLowerCase())],u.prototype,"outputPixelType",void 0),t([e({json:{write:!0}})],u.prototype,"mainPrimaryRasterId",void 0),t([e()],u.prototype,"sourceRasters",void 0),t([e({type:[o],json:{write:!0}})],u.prototype,"sourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"rasterInfo",void 0),t([e({json:{write:!0}})],u.prototype,"readingBufferSize",void 0),t([e({json:{write:!0}})],u.prototype,"id",void 0),t([e()],u.prototype,"isNoopProcess",void 0),t([e()],u.prototype,"supportsGPU",null),t([e({json:{write:!0}})],u.prototype,"rawInputBandIds",void 0),t([e()],u.prototype,"rawSourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"isInputBandIdsSwizzled",void 0),t([e({json:{write:!0}})],u.prototype,"swizzledBandSelection",void 0),t([e()],u.prototype,"isBranch",void 0),t([e()],u.prototype,"isRoot",void 0),t([e({readOnly:!0})],u.prototype,"flatWebGLFunctionChain",null),t([e()],u.prototype,"_bindingResult",void 0),u=t([n("esri.layers.support.rasterFunctions.BaseRasterFunction")],u);const l=u;export{l as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import{property as t,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as s}from"../rasterFormats/pixelRangeUtils.js";import e from"./BaseRasterFunction.js";import p from"./ColormapFunctionArguments.js";import{getColormapByName as i}from"./colormaps.js";import{convertColorRampToColormap as n,getColorRampJSON as a}from"../../../renderers/support/colorRampUtils.js";import{fromJSON as c}from"../../../rest/support/colorRamps.js";let m=class extends e{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const o=this.sourceRasterInfos[0];if(o.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:t,colormapName:r,colorRamp:s,colorRampName:e}=this.functionArguments;if(!t?.length)if(s)this.colorRamp=s,t=n(s,{interpolateAlpha:!0});else if(e){const o=a(e);o&&(t=n(o),this.colorRamp=c(o))}else r&&(t=i(r));if(!t?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const p=this._getOutputPixelType(o.pixelType);this.outputPixelType=p.startsWith("f")?"s32":p;const m=o.clone();return m.pixelType=this.outputPixelType,m.colormap=t,m.bandCount=1,this.rasterInfo=m,{success:!0,supportsGPU:!0}}_processPixels(o){let t=o.pixelBlocks?.[0];return!t||s(t.pixelType)||(t=t.clone(),t.clamp(this.outputPixelType)),t}};o([t({json:{write:!0,name:"rasterFunction"}})],m.prototype,"functionName",void 0),o([t({type:p,json:{write:!0,name:"rasterFunctionArguments"}})],m.prototype,"functionArguments",void 0),o([t()],m.prototype,"rasterArgumentNames",void 0),o([t()],m.prototype,"isNoopProcess",void 0),o([t({json:{write:!0}})],m.prototype,"indexedColormap",void 0),o([t()],m.prototype,"colorRamp",void 0),m=o([r("esri.layers.support.rasterFunctions.ColormapFunction")],m);const u=m;export{u as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../core/accessorSupport/decorators.js";import{SimpleBandStatistics as r}from"../SimpleBandStatistics.js";import s from"./BaseRasterFunction.js";import n from"./ColormapToRGBFunctionArguments.js";import{createColormapLUT as i}from"./pixelUtils.js";import{isColormapSupportedByWebGL as p}from"../../../renderers/support/rasterRendererChecks.js";let a=class extends s{constructor(){super(...arguments),this.functionName="ColormapToRGB",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||!t.colormap?.length)return{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: source data must be single band with a colormap"};const o=t.clone();o.pixelType=this.outputPixelType=this._getOutputPixelType("u8"),this._removeStatsHistColormapVAT(o),o.bandCount=3,o.statistics=[{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20}],this.rasterInfo=o;const e=[...t.colormap].sort((t,o)=>t[0]-o[0]),{indexedColormap:r,offset:s}=i({colormap:e});return r?(this.lookup={indexedColormap:r,offset:s},{success:!0,supportsGPU:p(r)}):{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: the colormap is not supported"}}_processPixels(t){let o=t.pixelBlocks?.[0];if(!o||!this.lookup)return o;o=o.clone();const e=o.pixels[0],s=o.mask??new Uint8Array(e.length).fill(255),n=new Uint8Array(e.length),i=new Uint8Array(e.length),p=new Uint8Array(e.length),{indexedColormap:a,offset:u}=this.lookup,l=a.length;for(let r=0;r<e.length;r++)if(s[r]){let t=4*(e[r]-u);t<0||t>l-4?s[r]=0:(n[r]=a[t++],i[r]=a[t++],p[r]=a[t++])}return o.pixels=[n,i,p],o.statistics=[new r(0,255),new r(0,255),new r(0,255)],o.pixelType=this.outputPixelType,o}_getWebGLParameters(){return this.lookup}};t([o({json:{write:!0,name:"rasterFunction"}})],a.prototype,"functionName",void 0),t([o({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],a.prototype,"functionArguments",void 0),t([o()],a.prototype,"rasterArgumentNames",void 0),t([o({json:{write:!0}})],a.prototype,"lookup",void 0),a=t([e("esri.layers.support.rasterFunctions.ColormapToRGBFunction")],a);const u=a;export{u as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import n from"./BaseRasterFunction.js";import r from"./CompositeBandFunctionArguments.js";import{compositeBands as o}from"./pixelUtils.js";let i=class extends n{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();if(e.attributeTable=null,e.colormap=null,e.pixelType=this.outputPixelType,e.bandCount=t.map(({bandCount:t})=>t).reduce((t,s)=>t+s),t.every(({statistics:t})=>null!=t&&t.length)){const s=[];t.forEach(({statistics:t})=>null!=t&&s.push(...t)),e.statistics=s}if(t.every(({histograms:t})=>null!=t&&t.length)){const s=[];t.forEach(({histograms:t})=>null!=t&&s.push(...t)),e.histograms=s}e.multidimensionalInfo&&e.multidimensionalInfo.variables.forEach(s=>{const e=t.map(t=>t.multidimensionalInfo?.variables.find(({name:t})=>t===s.name)),n=e.map(t=>t?.statistics?.length?t.statistics:null),r=e.map(t=>t?.histograms?.length?t.histograms:null);s.statistics=n.every(t=>null!=t)?n.flat():null,s.histograms=r.every(t=>null!=t)?r.flat():null}),e.bandCount>1&&(e.colormap=null,e.attributeTable=null);const n=t.every(t=>t.keyProperties.BandProperties?.length)?t.flatMap(t=>t.keyProperties.BandProperties):void 0;e.keyProperties={...e.keyProperties,BandProperties:n},this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:s}=t;if(!s)return null;const e=s?.[0];return null==e?null:o(s)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};t([s({json:{write:!0,name:"rasterFunction"}})],i.prototype,"functionName",void 0),t([s({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],i.prototype,"functionArguments",void 0),t([s()],i.prototype,"rasterArgumentNames",void 0),i=t([e("esri.layers.support.rasterFunctions.CompositeBandFunction")],i);const a=i;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as r}from"tslib";import{clone as t}from"../../../core/lang.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.js";import e from"./BaseFunctionArguments.js";import{writer as a}from"../../../core/accessorSupport/decorators/writer.js";var p;let n=p=class extends e{constructor(){super(...arguments),this.rasters=[]}writeRasters(r,t){t.rasters=r.map(r=>"number"==typeof r||"string"==typeof r?r:r.toJSON())}clone(){return new p({rasters:t(this.rasters)})}};r([s({json:{write:!0}})],n.prototype,"rasters",void 0),r([a("rasters")],n.prototype,"writeRasters",null),n=p=r([o("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],n);const i=n;export{i as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import n from"../Field.js";import{getPixelValueRange as r,isIntegerPixelType as a}from"../rasterFormats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import{computeChange as i}from"./changeDetectionUtils.js";import u from"./ComputeChangeFunctionArguments.js";let l=class extends o{constructor(){super(...arguments),this.functionName="ComputeChange",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{method:e}=this.functionArguments,t=this.sourceRasterInfos[0].clone();if(this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),"categorical"===e){const e=this.sourceRasterInfos.map(e=>e.attributeTable),s=this._getFieldNames(e,"value"),n=e.map(e=>this._getClassFieldName(e));if(null==s[0]||null==s[1]||null==n[0]||null==n[1])return{success:!1,supportsGPU:!1,error:"both inputs must have proper attribute table with value and class fields"};this._updateAttributeTable(t,s,n)}t.bandCount=1,this.rasterInfo=t;return{success:!0,supportsGPU:"difference"===e||"relative-difference"===e}}_processPixels(e){const{pixelBlocks:t}=e;if(null==t?.[0]||null==t?.[1])return null;const{method:s}=this.functionArguments;return i(t,s,this.outputPixelType,this._categoryConfig)}_getWebGLParameters(){const e=this.outputPixelType??"f32";let[t,s]=r(e);const n=a(e);return n&&(t-=1e-4,s+=1e-4),{method:this.functionArguments.method,domainRange:[t,s],isOutputRounded:n}}_updateAttributeTable(e,t,s){const r=this.sourceRasterInfos.map(e=>e.attributeTable),a=r.map((e,s)=>e.features.map(e=>e.attributes[t[s]])),o=r.map((e,t)=>e.features.map(e=>e.attributes[s[t]])),i=a.map(e=>{const t=[];return e.forEach((e,s)=>t[e]=s),t}),{keepMethod:u}=this.functionArguments;this._categoryConfig={categoryIndexLookups:i,classNames:o,keepMethod:u};const l=r[0].clone();l.fields=[new n({name:"OID",type:"oid"}),new n({name:"Value",type:"integer"}),new n({name:"ClassName",type:"string"}),new n({name:"Class_From",type:"string"}),new n({name:"Class_To",type:"string"})];const m=this._getFieldNames(r,"red"),p=this._getFieldNames(r,"green"),c=this._getFieldNames(r,"blue"),d=[],g=2===m.length&&2===p.length&&2===c.length;g&&(d.push(...r.map((e,t)=>e.features.map(e=>[e.attributes[m[t]],e.attributes[p[t]],e.attributes[c[t]]]))),l.fields.push(new n({name:"Red",type:"integer"}),new n({name:"Green",type:"integer"}),new n({name:"Blue",type:"integer"})));const h=l.features[0].clone();h.geometry=null;const f=[],[y,C]=a.map(e=>e.length);let b=1;for(let n=0;n<y;n++){const e=o[0][n];for(let t=0;t<C;t++){const s=o[1][t];if("changed"===u&&e===s||"unchanged"===u&&e!==s)continue;const r=h.clone();r.attributes={OID:b++,Value:n*C+t,ClassName:e===s?e:`${e} -> ${s}`,Class_From:e,Class_To:s},g&&(r.attributes.Red=d[0][n][0]+d[1][t][0]>>1,r.attributes.Green=d[0][n][1]+d[1][t][1]>>1,r.attributes.Blue=d[0][n][2]+d[1][t][2]>>1),f.push(r)}}if("changed"===u){const e=h.clone();e.attributes={OID:b++,Value:y*C+1,ClassName:"No Change",Class_From:"Same",Class_To:"Same"},f.push(e)}else if("unchanged"===u){const e=h.clone();e.attributes={OID:b++,Value:y*C+2,ClassName:"Changed",Class_From:"Any",Class_To:"Any"},f.push(e)}l.features=f,e.attributeTable=l}_getFieldNames(e,t){return e.map(({fields:e})=>e.find(e=>e.name.toLowerCase()===t)?.name).filter(e=>e)}_getClassFieldName(e){const t=e.fields.find(e=>"string"===e.type&&e.name.toLowerCase().startsWith("class"))??e.fields.find(e=>"string"===e.type&&e.name.toLowerCase().includes("class")||e.name.toLowerCase().includes("type")||e.name.toLowerCase().includes("name"))??e.fields.find(e=>"string"===e.type);return t?.name}};e([t({json:{write:!0,name:"rasterFunction"}})],l.prototype,"functionName",void 0),e([t({type:u,json:{write:!0,name:"rasterFunctionArguments"}})],l.prototype,"functionArguments",void 0),e([t()],l.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],l.prototype,"_categoryConfig",void 0),l=e([s("esri.layers.support.rasterFunctions.ComputeChangeFunction")],l);const m=l;export{m as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../../core/accessorSupport/decorators.js";import{convolutionKernel as n}from"../rasterFunctionConstants.js";import{getPixelValueRange as s}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import i from"./ConvolutionFunctionArguments.js";import{convolute as u}from"./convolutionUtils.js";const l=25;let c=class extends r{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,o=t.reduce((t,e)=>t+e);return-1===e||0===o||1===o?t:t.map(t=>t/o)}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:o,kernel:s}=this.functionArguments;if(!Object.values(n).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==n.none&&e*o!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const i=r.clone();i.pixelType=this.outputPixelType;const u=[n.none,n.sharpen,n.sharpen2,n.sharpening3x3,n.sharpening5x5];(-1===t||"u8"!==this.outputPixelType&&!u.includes(t))&&(i.statistics=null,i.histograms=null),i.colormap=null,i.attributeTable=null,this.rasterInfo=i;return{success:!0,supportsGPU:s.length<=l}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===n.none)return e;const{rows:o,cols:s}=this.functionArguments,{_normalizedKernel:r}=this;return u(e,{kernel:r,rows:o,cols:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(l),{rows:e,cols:o}=this.functionArguments,{_normalizedKernel:n}=this;for(let s=0;s<e;s++)for(let e=0;e<o;e++)t[5*s+e]=n[s*o+e];return{kernelRows:e,kernelCols:o,kernel:t,clampRange:s(this.outputPixelType)}}};t([e({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([e({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([e()],c.prototype,"rasterArgumentNames",void 0),t([e()],c.prototype,"_normalizedKernel",null),c=t([o("esri.layers.support.rasterFunctions.ConvolutionFunction")],c);const p=c;export{p as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{clone as o}from"../../../core/lang.js";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{convolutionKernel as r}from"../rasterFunctionConstants.js";import n from"./BaseFunctionArguments.js";import{convolutionKernels as i}from"./convolutionUtils.js";var p;let l=p=class extends n{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const o=i.get(t);if(!o||t===r.userDefined||t===r.none)return;const e=Math.sqrt(o.length);this._set("kernel",o),this._set("cols",e),this._set("rows",e)}clone(){return new p({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:o(this.raster)})}};t([e({json:{type:Number,write:!0}})],l.prototype,"rows",void 0),t([e({json:{type:Number,write:!0}})],l.prototype,"cols",void 0),t([e({json:{name:"type",type:Number,write:!0}})],l.prototype,"convolutionType",null),t([e({json:{type:[Number],write:!0}})],l.prototype,"kernel",void 0),l=p=t([s("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")],l);const c=l;export{c as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import o from"./HillshadeFunctionArguments.js";import{getHillshadeOptions as n,hillshade as u,calculateHillshadeParams as a,gcsFactor as p}from"./surfaceUtils.js";let c=class extends r{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:i}=t,r=i?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),a=n(this.functionArguments,o,this.isGCS),p=u(e,a);return p.pixelType=this.outputPixelType,p}_getWebGLParameters(){const t=n(this.functionArguments,{x:1,y:1},this.isGCS),e=a(t),{slopeType:s,zFactor:r,pixelSizeFactor:o,pixelSizePower:u}=this.functionArguments,c="scaled"===s,l=i(this.outputPixelType);return{...e,zFactor:r,gcsFactor:this.isGCS?p:1,pixelSizeFactor:c?o:0,pixelSizePower:c?u:0,isOutputRounded:l}}};t([e({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([e()],c.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],c.prototype,"isGCS",void 0),c=t([s("esri.layers.support.rasterFunctions.HillshadeFunction")],c);const l=c;export{l as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{localOperators as n}from"../rasterFunctionConstants.js";import{getPixelValueRange as o,isIntegerPixelType as i,getIntegerPixelType as r}from"../rasterFormats/pixelRangeUtils.js";import u from"./BaseRasterFunction.js";import a from"./LocalFunctionArguments.js";import{operandsCount as c,local as l,getOutputDomain as p}from"./localUtils.js";let m=class extends u{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0],{bandCount:e}=s,{processAsMultiband:n}=this.functionArguments;if(t.some(t=>t.bandCount!==e))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:o,rasters:i}=this.functionArguments,r=c[o];if(!(999===r||i.length===r||i.length<=1&&1===r))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${r}`};const u=s.clone();u.bandCount=999!==r||n?e:1,this._removeStatsHistColormapVAT(u),this._updateStatistics(u),this._updatePixelType(u),this.rasterInfo=u;return{success:!0,supportsGPU:1===u.bandCount&&r<=3}}_processPixels(t){const{pixelBlocks:s}=t;return null==s||s.some(t=>null==t)?null:l(s,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,s=c[t],e=Object.keys(n).find(s=>n[s]===t)?.toLowerCase()??"undefined",r=this.outputPixelType??"f32";let[u,a]=o(r);const l=i(r);return l&&(u-=1e-4,a+=1e-4),{imageCount:s,operationName:e,domainRange:[u,a],isOutputRounded:l}}_updateStatistics(t){const s=this.sourceRasterInfos[0],{operation:e}=this.functionArguments,n=p(e)?.domain;if(n){t.statistics=[];for(let s=0;s<t.bandCount;s++)t.statistics[s]={min:n[0],max:n[1],avg:(n[0]+n[1])/2,stddev:(n[0]+n[1])/10}}else 45===e&&s.statistics?.length&&(t.statistics=s.statistics.map(t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0})))}_updatePixelType(t){const{statistics:s,pixelType:e}=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,{domain:o,isInteger:u}=p(n)??{domain:null,isInteger:!1};let a="f32";if(o&&u)a=r(o[0],o[1]);else if(30===n){const t=s?.[0];a=t?r(t.min,t.max):i(e)?e:"s32"}else if(45===n&&i(e)){const t=s?.map(({max:t})=>-t),n=s?.map(({min:t})=>-t),o=t?.length?Math.min(...t):null,i=n?.length?Math.min(...n):null;a=null!=o&&null!=i?r(o,i):e.startsWith("s")?e.replace("s","u"):"u1"===e||"u2"===e||"u4"===e?"s8":"u8"===e?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(a)}};t([s({json:{write:!0,name:"rasterFunction"}})],m.prototype,"functionName",void 0),t([s({type:a,json:{write:!0,name:"rasterFunctionArguments"}})],m.prototype,"functionArguments",void 0),t([s()],m.prototype,"rasterArgumentNames",void 0),m=t([e("esri.layers.support.rasterFunctions.LocalFunction")],m);const d=m;export{d as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{numberMaxFloat32 as e}from"../../../core/mathUtils.js";import{property as s,subclass as n}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as u}from"../rasterFormats/pixelRangeUtils.js";import a from"./BaseRasterFunction.js";import{createRemapLUT as o,maxMapSizeGpu as i,lookupPixels as l,lookupBandValues as r,remap as p,createRangeMaps as m}from"./pixelUtils.js";import c from"./RemapFunctionArguments.js";let f=class extends a{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;t.bandCount=1;const{statistics:s}=t;this._removeStatsHistColormapVAT(t);const{allowUnmatched:n,replacementValue:a,outputValues:l,inputRanges:r,noDataRanges:p,isLastInputRangeInclusive:m}=this.functionArguments,c="unknown"===this.outputPixelType||null==this.outputPixelType;if(this.outputPixelType=this._getOutputPixelType(e),l?.length){const o=s?.[0];if(n&&null==a){let e=o?.min??l[0],s=o?.max??l[0];e=Math.min.apply(null,[...l,e]),s=Math.max.apply(null,[...l,s]),t.statistics=[{min:e,max:s,avg:o?.avg??0,stddev:o?.stddev??-1}]}else{let e=l[0],s=e;for(let t=0;t<l.length;t++)e=e>l[t]?l[t]:e,s=s>l[t]?s:l[t];n&&null!=a&&(e=Math.min(e,a),s=Math.max(s,a)),t.statistics=[{min:e,max:s,avg:o?.avg??0,stddev:o?.stddev??-1}]}if(c){const{min:s,max:o}=t.statistics[0],i=["u8","s8","u16","s16","u32","s32","f32"],r=i.find(t=>{const[e,n]=u(t);return s>=e&&o<=n})??"f64";l.some(t=>Math.floor(t)!==t)?this.outputPixelType="f64"===r?"f64":"f32":this.outputPixelType=n&&null==a&&i.indexOf(e)>i.indexOf(r)?e:r}}t.pixelType=this.outputPixelType,this.rasterInfo=t,this.lookup=n?null:o({srcPixelType:e,inputRanges:r,outputValues:l,noDataRanges:p,allowUnmatched:n,isLastInputRangeInclusive:m,outputPixelType:this.outputPixelType});return{success:!0,supportsGPU:(!l||l.length<=i)&&(!p||p.length<=i)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:s,outputPixelType:n}=this;if(s){const t=l(e,{lut:[s.lut],offset:s.offset,outputPixelType:n});return null!=t&&s.mask&&(t.mask=r(e.pixels[0],e.mask,s.mask,s.offset,"u8")),t}const{inputRanges:u,outputValues:a,noDataRanges:o,allowUnmatched:i,isLastInputRangeInclusive:m,replacementValue:c}=this.functionArguments;return p(e,{inputRanges:u,outputValues:a,noDataRanges:o,outputPixelType:n,allowUnmatched:i,isLastInputRangeInclusive:m,replacementValue:c})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:s,isLastInputRangeInclusive:n}=this.functionArguments,a=this.functionArguments.inputRanges??[],o=this.functionArguments.outputValues??[],l=m(a,o,n),r=new Float32Array(2*i);r.fill(e),s?.length&&r.set(s);return{allowUnmatched:t,rangeMaps:l,noDataRanges:r,clampRange:u(this.outputPixelType),replacementValue:this.functionArguments.replacementValue}}};t([s({json:{write:!0,name:"rasterFunction"}})],f.prototype,"functionName",void 0),t([s({type:c,json:{write:!0,name:"rasterFunctionArguments"}})],f.prototype,"functionArguments",void 0),t([s()],f.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],f.prototype,"lookup",void 0),f=t([n("esri.layers.support.rasterFunctions.RemapFunction")],f);const g=f;export{g as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as r}from"../rasterFormats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import{createColormapLUT as i}from"./pixelUtils.js";import n from"./ShadedReliefFunctionArguments.js";import{getHillshadeOptions as a,hillshade as p,tintHillshade as u,calculateHillshadeParams as c,gcsFactor as l}from"./surfaceUtils.js";import{convertColorRampToColormap as m,createHsvMap as d}from"../../../renderers/support/colorRampUtils.js";import{isColormapSupportedByWebGL as f}from"../../../renderers/support/rasterRendererChecks.js";let h=class extends o{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:t,colormap:s}=this.functionArguments;if(!t&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const r=e.clone();this._removeStatsHistColormapVAT(r),r.pixelType=this.outputPixelType,r.bandCount=3,r.statistics=[{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=r,this.isGCS=r.spatialReference?.isGeographic??!1,s?.length||(s=m(t,{interpolateAlpha:!0}));const{indexedColormap:o,offset:n}=i({colormap:s});if(!o?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const a=d(o);return this.lookup={indexedColormap:o,offset:n,hsvMap:a},{success:!0,supportsGPU:f(o)}}_processPixels(e){const t=e.pixelBlocks?.[0];if(!t||!this.lookup)return null;let s=e.primaryPixelSizes?.[0];if(null==s){const{extent:r}=e;s=r?{x:r.width/t.width,y:r.height/t.height}:{x:1,y:1}}const r=a(this.functionArguments,s,this.isGCS),o=p(t,r),i=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return u(o,t,this.lookup.hsvMap,i),o.pixelType=this.outputPixelType,o}_getWebGLParameters(){const e=a(this.functionArguments,{x:1,y:1},this.isGCS),t=c(e),{slopeType:s,zFactor:o,pixelSizeFactor:i,pixelSizePower:n}=this.functionArguments,p="scaled"===s,{indexedColormap:u,offset:m}=this.lookup,d=this.sourceRasterInfos[0].statistics?.[0],f=r(this.outputPixelType);return{...t,indexedColormap:u,offset:m,zFactor:o,gcsFactor:this.isGCS?l:1,pixelSizeFactor:p?i:0,pixelSizePower:p?n:0,minValue:d?.min??0,maxValue:d?.max??8e3,isOutputRounded:f}}};e([t({json:{write:!0,name:"rasterFunction"}})],h.prototype,"functionName",void 0),e([t({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],h.prototype,"functionArguments",void 0),e([t()],h.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],h.prototype,"isGCS",void 0),e([t({json:{write:!0}})],h.prototype,"lookup",void 0),h=e([s("esri.layers.support.rasterFunctions.ShadedReliefFunction")],h);const x=h;export{x as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import o from"./SlopeFunctionArguments.js";import{slope as n,gcsFactor as p}from"./surfaceUtils.js";let u=class extends r{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,slopeType:i,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:p}=this,{extent:u,primaryPixelSizes:a}=t,c=a?.[0],l=c??(u?{x:u.width/e.width,y:u.height/e.height}:{x:1,y:1});return n(e,{zFactor:s,slopeType:i,pixelSizePower:r,pixelSizeFactor:o,isGCS:p,resolution:l})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:r}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*p:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:r??0,isOutputRounded:i(this.outputPixelType)}}};t([e({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],u.prototype,"isGCS",void 0),u=t([s("esri.layers.support.rasterFunctions.SlopeFunction")],u);const a=u;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as o}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import{computeFocalStatistics as i}from"./focalStatUtils.js";import n from"./StatisticsFunctionArguments.js";let u=class extends r{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const s=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();e.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;"stddev"===o&&this._removeStatsHistColormapVAT(e),this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3&&t<5}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return s;const{statisticsType:e,rows:o,cols:r,fillNoDataOnly:n}=this.functionArguments;return i(s,{kernelRows:o,kernelCols:r,fillNoDataOnly:n,outputPixelType:this.outputPixelType,statisticsType:e,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:s,statisticsType:e,fillNoDataOnly:r}=this.functionArguments;return{fillNoDataOnly:r,kernelRows:t,kernelCols:s,statisticsType:e,clampRange:o(this.outputPixelType)}}};t([s({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([s({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([s()],u.prototype,"rasterArgumentNames",void 0),u=t([e("esri.layers.support.rasterFunctions.StatisticsFunction")],u);const a=u;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as o}from"../rasterFormats/pixelRangeUtils.js";import u from"./BaseRasterFunction.js";import{lookupPixels as r}from"./pixelUtils.js";import i from"./StretchFunctionArguments.js";import{getStretchCutoff as n,createStretchLUT as a,stretch as p,computeGammaCorrection as m}from"./stretchUtils.js";let c=class extends u{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:s}=t,{functionArguments:e}=this,{dynamicRangeAdjustment:u,gamma:r,useGamma:i}=e;if(!u&&["u8","u16","s8","s16"].includes(s)){const u=n(e.toJSON(),{rasterInfo:t}),p=o(this.outputPixelType)?"round":"float";this.lookup=a({pixelType:s,...u,gamma:i?r:null,rounding:p}),this.cutOffs=u}else u||(this.cutOffs=n(e.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(s);const p=t.clone();p.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(p),"u8"===this.outputPixelType&&(p.keyProperties.DataType="processed");const{outputMin:m=0,outputMax:c=255}=this.functionArguments;p.statistics=[];for(let o=0;o<p.bandCount;o++)p.statistics[o]={min:m,max:c};this.rasterInfo=p;return{success:!0,supportsGPU:!u}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return s;const{lookup:e}=this;if(e)return r(s,{...e,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:o}=this,u=this.cutOffs||n(o.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:s}),i=o.useGamma?o.gamma:null;return p(s,{...u,gamma:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:s=255,gamma:e,useGamma:u}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,i=u&&e?.length?m(r,e):[1,1,1],{minCutOff:n,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===n.length&&(n[1]=n[2]=n[0],a[1]=a[2]=a[0]);const p=a.map((e,o)=>(s-t)/(a[o]-n[o])),c=o(this.outputPixelType),f=u&&e?[e[0],e[1]??e[0],e[2]??e[0]]:[1,1,1],l=u?[i[0],i[1]??i[0],i[2]??i[0]]:[1,1,1];return{bandCount:r,minOutput:t,maxOutput:s,minCutOff:n,maxCutOff:a,factor:p,useGamma:u,gamma:f,gammaCorrection:l,stretchType:this.functionArguments.stretchType,isOutputRounded:c,type:"stretch"}}};t([s({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([s({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([s()],c.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],c.prototype,"lookup",void 0),t([s({json:{write:!0}})],c.prototype,"cutOffs",void 0),c=t([e("esri.layers.support.rasterFunctions.StretchFunction")],c);const f=c;export{f as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{JSONMap as t}from"../../../core/jsonMap.js";import n from"../PixelBlock.js";import{isIntegerPixelType as e,clipBandToPixelTypeRange as r}from"../rasterFormats/pixelRangeUtils.js";import{calculateCustomBandIndex as a}from"./customBandIndexUtils.js";import{isValidPixelBlock as o}from"./pixelUtils.js";const i=new t({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function s(t,i){if(!o(t))return t;const{equation:s,method:l}=i,c=i.bandIndexes.map(t=>t-1),{pixels:U,mask:q}=t;let M;switch(l){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":M=u(q,U[c[0]],U[c[1]]);break;case"ndwi":M=u(q,U[c[1]],U[c[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":M=f(q,U[c[0]],U[c[1]]);break;case"ci-g":case"ci-re":M=h(q,U[c[0]],U[c[1]]);break;case"savi":M=w(q,U[c[0]],U[c[1]],c[2]+1);break;case"tsavi":M=m(q,U[c[0]],U[c[1]],c[2]+1,c[3]+1,c[4]+1);break;case"msavi":M=d(q,U[c[0]],U[c[1]]);break;case"gemi":M=g(q,U[c[0]],U[c[1]]);break;case"pvi":M=y(q,U[c[0]],U[c[1]],c[2]+1,c[3]+1);break;case"gvitm":M=p(q,[U[c[0]],U[c[1]],U[c[2]],U[c[3]],U[c[4]],U[c[5]]]);break;case"sultan":M=b(q,[U[c[0]],U[c[1]],U[c[2]],U[c[3]],U[c[4]]]);break;case"vari":M=v(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"mtvi2":M=k(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"rtvi-core":M=A(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"evi":M=F(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"wndwi":M=x(q,[U[c[0]],U[c[1]],U[c[2]]],c[3]?c[3]+1:.5);break;case"bai":M=j(q,U[c[0]],U[c[1]]);break;case"custom":M=a(q,U,s);break;default:return t}const{outputPixelType:B="f32"}=i,T=null!=B&&e(B);let I;q?(I=new Uint8Array(t.width*t.height),I.set(q)):T&&(I=new Uint8Array(t.width*t.height).fill(255)),T&&(M=M.map(t=>{const e=n.createEmptyBand(B,t.length);return r(t,I,B,e),e}));const P=new n({width:t.width,height:t.height,pixelType:B,pixels:M,mask:I});return P.updateStatistics(),P}function l(t,e,r,a){const{mask:o,pixels:i,width:s,height:l}=t,c=i[r],u=i[e],f=u.length,h=a?new Uint8Array(f):new Float32Array(f),w=a?100:1,m=a?100.5:0;for(let n=0;n<f;n++)if(null==o||o[n]){const t=c[n],e=u[n],r=t+e;r&&(h[n]=(t-e)/r*w+m)}const d=new n({width:s,height:l,mask:o,pixelType:a?"u8":"f32",pixels:[h]});return d.updateStatistics(),d}function c(t){const n=new Float32Array(9);return n[3*t[0]]=1,n[3*t[1]+1]=1,n[3*t[2]+2]=1,n}function u(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o],i=t+r;i&&(a[o]=(t-r)/i)}return[a]}function f(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o];r&&(a[o]=t/r)}return[a]}function h(t,n,e){const r=n.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o];r&&(a[o]=t/r-1)}return[a]}function w(t,n,e,r){const a=e.length,o=new Float32Array(a);for(let i=0;i<a;i++)if(null==t||t[i]){const t=e[i],a=n[i],s=a+t+r;s&&(o[i]=(a-t)/s*(1+r))}return[o]}function m(t,n,e,r,a,o){const i=e.length,s=new Float32Array(i),l=-a*r+o*(1+r*r);for(let c=0;c<i;c++)if(null==t||t[c]){const t=e[c],o=n[c],i=a*o+t+l;i&&(s[c]=r*(o-r*t-a)/i)}return[s]}function d(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o],i=2*r+1;a[o]=.5*(i-Math.sqrt(i*i-8*(r-t)))}return[a]}function g(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o];if(1!==t&&r+t+.5!==0){const n=(2*(r*r-t*t)+1.5*r+.5*t)/(r+t+.5);a[o]=n*(1-.25*n)-(t-.125)/(1-t)}}return[a]}function y(t,n,e,r,a){const o=e.length,i=new Float32Array(o),s=1/Math.sqrt(1+r*r);for(let l=0;l<o;l++)if(null==t||t[l]){const t=e[l],o=n[l];i[l]=(o-r*t-a)*s}return[i]}function p(t,n){const[e,r,a,o,i,s]=n,l=e.length,c=new Float32Array(l);for(let u=0;u<l;u++)(null==t||t[u])&&(c[u]=-.2848*e[u]-.2435*r[u]-.5436*a[u]+.7243*o[u]+.084*i[u]-.18*s[u]);return[c]}function b(t,n){const[e,r,a,o,i]=n,s=e.length,l=new Float32Array(s),c=new Float32Array(s),u=new Float32Array(s);for(let f=0;f<s;f++)(null==t||t[f])&&(l[f]=i[f]?o[f]/i[f]*100:0,c[f]=e[f]?o[f]/e[f]*100:0,u[f]=a[f]?r[f]/a[f]*(o[f]/a[f])*100:0);return[l,c,u]}function v(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=n+t-a[s];o&&(i[s]=(n-t)/o)}return[i]}function k(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=a[s],l=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(n))-.5);if(l){const e=1.5*(1.2*(t-o)-2.5*(n-o));i[s]=e/l}}return[i]}function A(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=a[s];i[s]=100*(t-n)-10*(t-o)}return[i]}function F(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=t+6*n-7.5*a[s]+1;o&&(i[s]=2.5*(t-n)/o)}return[i]}function x(t,n,e=.5){const[r,a,o]=n,i=a.length,s=new Float32Array(i);for(let l=0;l<i;l++)if(null==t||t[l])for(l=0;l<i;l++){const t=r[l],n=a[l],i=o[l],c=t+e*n+(1-e)*i;c&&(s[l]=(t-e*n-(1-e)*i)/c)}return[s]}function j(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o])for(o=0;o<r;o++){const t=(.1-n[o])**2+(.06-e[o])**2;t&&(a[o]=1/t)}return[a]}export{i as bandIndexMethodMap,s as calculateBandIndex,l as calculateNDVI,c as getBandMatrix3};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import"../../../core/has.js";import{JSONMap as e}from"../../../core/jsonMap.js";import t from"../PixelBlock.js";import{isIntegerPixelType as a}from"../rasterFormats/pixelRangeUtils.js";const n=new e({0:"difference",1:"relative-difference",2:"categorical",3:"euclidean-distance",4:"angle-difference",5:"band-with-most-change"},{useNumericKeys:!0}),s=new e({0:"all",1:"changed",2:"unchanged"},{useNumericKeys:!0});function i(e,n,s,i){const[f,h]=e,m=a(s)&&!a(f.pixelType)&&!a(h.pixelType),p=[f.mask,h.mask].filter(e=>e),u=t.combineBandMasks(p),g=e.map(e=>e.pixels[0]),{width:k,height:x}=f,b=t.createEmptyBand(s,k*x);switch(n){case"difference":case"relative-difference":o({bands:g,mask:u,outBand:b,isRoundingNeeded:m,isRelative:"relative-difference"===n});break;case"categorical":c({bands:g,mask:u,outBand:b,...i});break;case"euclidean-distance":l({pixels:e.map(e=>e.pixels),mask:u,outBand:b});break;case"angle-difference":r({pixels:e.map(e=>e.pixels),mask:u,outBand:b});break;case"band-with-most-change":d({pixels:e.map(e=>e.pixels),mask:u,outBand:b})}const B=new t({width:k,height:x,pixels:[b],pixelType:s,mask:u});return B.updateStatistics(),B}function o(e){const{bands:[t,a],mask:n,isRelative:s,isRoundingNeeded:i,outBand:o}=e,c=t.length;for(let l=0;l<c;l++)if(!n||n[l]){let e=t[l]-a[l];if(s){const n=Math.max(Math.abs(t[l])-Math.abs(a[l]));e=n>0?e/n:0}o[l]=i?Math.round(e):e}}function c(e){const{bands:[t,a],categoryIndexLookups:[n,s],classNames:[i,o],mask:c,keepMethod:l,outBand:r}=e,d=t.length,f=i.length,h=o.length,m=f*h,p=m+1,u=m+2;for(let g=0;g<d;g++)if(!c||c[g]){const e=t[g],c=a[g],d=n[e],f=s[c],k=i[d],x=o[f];r[g]=null==d||null==f?m:"changed"===l&&k===x?p:"unchanged"===l&&k!==x?u:d*h+f}}function l(e){const{pixels:[t,a],mask:n,outBand:s}=e,i=t[0].length,o=t.length;for(let c=0;c<i;c++)if(!n||n[c]){let e=0;for(let n=0;n<o;n++){const s=t[n][c]-a[n][c];e+=s*s}s[c]=Math.sqrt(e)}}function r(e){const{pixels:[t,a],mask:n,outBand:s}=e,i=t[0].length,o=t.length;for(let c=0;c<i;c++)if(!n||n[c]){let e=0,n=0,i=0;for(let s=0;s<o;s++){const o=t[s][c],l=a[s][c];e+=o*l,n+=o*o,i+=l*l}const l=Math.sqrt(n*i);s[c]=l?Math.acos(e/l):1.5707963267948966}}function d(e){const{pixels:[t,a],mask:n,outBand:s}=e,i=t[0].length,o=t.length;for(let c=0;c<i;c++)if(!n||n[c]){let e=0,n=0;for(let s=0;s<o;s++){const i=Math.abs(t[s][c]-a[s][c]);i>e&&(e=i,n=s)}s[c]=n}}export{n as changeMethodMap,i as computeChange,s as keepMethodMap};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{getMetersPerUnitForSR as t}from"../../../core/units.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:M}=n,u=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,M),T=.5*h,k=.5*x;if(w-u<T||g-d<k||w<m+T||u>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(u-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),E=Math.round(R),P=Math.round(j)-1,S=Math.round(A),U=Math.round(z)-1;if(E===P&&R%1>.5&&j%1<.5||S===U&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===E&&0===S&&P===a&&U===r)return t;const v=t.mask;for(let i=S;i<=U;i++)for(let t=E;t<=P;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),M=Math.max(0,Math.floor((s-y)/x)),u=Math.min(r-1,Math.floor((s-c)/x));if(!(u<M))if(M===u){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=M*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=M;n<=u;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:M}=p;const{xmin:u,ymax:w}=t.extent;return r?(f=u+(f>u?h*Math.round((f-u)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=u+(c>u?h*Math.round((c-u)/h):0),M=w-(M<w?x*Math.round((w-M)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:M,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-M)/x+.8),f=u+(f>u?h*Math.floor((f-u)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,M=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:M,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,p as snapToRaster};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import t from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";function i(i,s,a){const{pixels:l,width:n,height:r,mask:o,bandMasks:h}=i,p=n*r,m=h?.length?t.combineBandMasks(h):o,f=Math.min(s.length,l.length),c=a.startsWith("f"),d=!c&&a!==i.pixelType,[x,g]=e(a),k=t.createEmptyBand(a,p);for(let t=0;t<r;t++){let e=t*n;for(let t=0;t<n;t++,e++)if(!m||m[e]){let t=0;for(let i=0;i<f;i++)t+=s[i]*l[i][e];c||(t=Math.round(t),d&&(t=t>g?g:t<x?x:t)),k[e]=t}}const u=new t({width:n,height:r,pixels:[k],pixelType:a,mask:m});return u.updateStatistics(),u}export{i as grayscale};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import e from"../PixelBlock.js";import{convolutionKernel as t}from"../rasterFunctionConstants.js";import{mirror as n}from"./mirror.js";const l=new Map;function o(e){const t=Math.sqrt(e.length),n=e.slice(0,t),l=[1];for(let o=1;o<t;o++){let n=null;for(let l=0;l<t;l++){const r=e[l+o*t],s=e[l];if(null==n)if(0===s){if(r)return{separable:!1,row:null,col:null}}else n=r/s;else if(r/s!==n)return{separable:!1,row:null,col:null}}if(null==n)return{separable:!1,row:null,col:null};l.push(n)}return{separable:!0,row:n,col:l}}function r(e,t,n,l,o,r,s){const i=new Float32Array(t*n),a=r.length,h=s?0:l,c=s?l:0,p=s?1:t;for(let u=h;u<n-h;u++){const n=u*t;for(let s=c;s<t-c;s++){if(o&&!o[n+s])continue;let t=0;for(let o=0;o<a;o++)t+=e[n+s+(o-l)*p]*r[o];i[n+s]=t}}return i}function s(e,t,n,l,o,r,s){const i=new Float32Array(t*n),a=Math.floor(l/2),h=Math.floor(o/2);for(let c=a;c<n-a;c++){const n=c*t;for(let c=h;c<t-h;c++){if(r&&!r[n+c])continue;let p=0;for(let r=0;r<l;r++)for(let l=0;l<o;l++)p+=e[n+c+(r-a)*t+l-h]*s[r*o+l];i[n+c]=p}}return i}function i(t,l,o=!0){const{pixels:r,width:i,height:a,pixelType:h,mask:c}=t,p=r.length,u=[],{kernel:f,rows:g,cols:m}=l;for(let e=0;e<p;e++){const t=s(r[e],i,a,g,m,c,f);o&&n(t,i,a,g,m),u.push(t)}return new e({width:i,height:a,pixelType:h,pixels:u,mask:c})}function a(t,l,o,s=!0){const{pixels:i,width:a,height:h,pixelType:c,mask:p}=t,u=i.length,f=[],g=l.length,m=o.length,x=Math.floor(g/2),w=Math.floor(m/2);for(let e=0;e<u;e++){let t=r(i[e],a,h,x,p,l,!0);t=r(t,a,h,w,p,o,!1),s&&n(t,a,h,g,m),f.push(t)}return new e({width:a,height:h,pixelType:c,pixels:f,mask:p})}function h(e,t){const n=o(t.kernel),l=!1!==t.mirrorEdges,r=n.separable?a(e,n.row,n.col,l):i(e,t,l),{outputPixelType:s}=t;return s&&r.clamp(s),r}l.set(t.none,[0,0,0,0,1,0,0,0,0]),l.set(t.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),l.set(t.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),l.set(t.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),l.set(t.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),l.set(t.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),l.set(t.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),l.set(t.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),l.set(t.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),l.set(t.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),l.set(t.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),l.set(t.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),l.set(t.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),l.set(t.smoothing5x5,[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1]),l.set(t.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),l.set(t.sharpening5x5,[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1]),l.set(t.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),l.set(t.laplacian5x5,[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0]),l.set(t.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),l.set(t.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),l.set(t.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),l.set(t.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),l.set(t.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);export{h as convolute,a as convoluteSeparable,l as convolutionKernels,o as separateKernels};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{getNamedColor as t,hexToRgba as e}from"../../../../colorUtils.js";import{colormapName as n}from"../../rasterFunctionConstants.js";import{createRasterFunction as o}from"./utils.js";import{colorRampDict as r}from"../../../../renderers/support/colorRampUtils.js";function a(t){return"colormap"in t?s(t):"colorRamp"in t?i(t):u(t)}function s(n){const r=n.colormap.map(n=>{if("value"in n){const o="string"==typeof n.color?t(n.color)??e(n.color):n.color;(n=[n.value,...o])[4]&&n[4]<=1&&(n[4]=Math.round(255*n[4]))}return n}),{raster:a,outputPixelType:s}=n;return o("Colormap",{colormap:r,raster:a},s)}function i(t){const{raster:e,colorRamp:n,outputPixelType:r}=t,a={colorRamp:"toJSON"in n?n.toJSON():n,raster:e};return o("Colormap",a,r)}function u(t){const{colorRampName:e}=t,a=Object.values(n).find(t=>t.toLowerCase()===e?.toLowerCase()),s=r.toJSON(e),{raster:i,outputPixelType:u="unknown"}=t;return o("Colormap",a?{colormapName:a,raster:i}:{colorRampName:s,raster:i},u)}function l(t){const{raster:e,outputPixelType:n="u8"}=t;return o("ColormapToRGB",{raster:e},n)}function p(t){const{raster:e,histograms:n,outputPixelType:r}=t,a=t.statistics?.map(t=>({min:t.min,max:t.max,mean:t.avg,standardDeviation:t.stddev}));return o("StatisticsHistograms",{raster:e,statistics:a,histograms:n},r)}function c(t){const{raster:e,attributeTable:n,outputPixelType:r="unknown"}=t,a="toJSON"in n?n.toJSON():n;return o("Table",{raster:e,attributeTableAsRecordSet:a},r)}function m(t){const{raster:e,outputPixelType:n="unknown"}=t,r={raster:e,missingBandAction:"fail"===t.missingBandAction?1:0};return"bandIds"in t?r.bandIds=t.bandIds:"bandNames"in t?r.bandNames=t.bandNames:"bandWavelengths"in t&&(r.bandWavelengths=t.bandWavelengths),o("ExtractBand",r,n)}function d(t){const{redBand:e,greenBand:n,blueBand:r,raster:a,outputPixelType:s}=t,i="name"===t.method?0:2;return o("CreateColorComposite",{raster:a,method:i,bandIndexesR:e,bandIndexesG:n,bandIndexesB:r},s)}function f(t){const{rasters:e,outputPixelType:n}=t;return o("CompositeBand",{rasters:e},n)}function g(t){const{allowUnmatched:e,raster:n,rangeMaps:r,outputPixelType:a,replacementValue:s}=t,i=r?.filter(({output:t})=>null!=t),u=i?.flatMap(({range:t})=>t),l=i?.map(({output:t})=>t),p=r?.filter(t=>null==t.output)?.flatMap(({range:t})=>t);return o("Remap",{allowUnmatched:e,raster:n,inputRanges:u,outputValues:l,noDataRanges:p,replacementValue:s},a)}function b(t){const{inputBitPositions:e,raster:n,fillRaster:r,outputBitPositions:a,outputPixelType:s}=t,i={inputBitPositions:e,outputBitPositions:a,raster:n};return null!=r&&("number"==typeof r?(i.constantFillCheck=!0,i.constantFillValue=r):i.fillRaster=r),o("TransposeBits",i,s)}function x(t){const{raster:e,outputPixelType:n="unknown"}=t,r=t.includedRanges?.flat(),a=t.noDataValues?.map(t=>t.join(" ")),s="match-all"===t.noDataInterpretation?1:0;return o("Mask",{raster:e,includedRanges:r,noDataInterpretation:s,noDataValues:a},n)}function T(t){const{geometry:e,keepOutside:n,outputPixelType:r="unknown",raster:a}=t,s="declaredClass"in e?e.toJSON():e;return o("Clip",{clippingGeometry:s,clippingType:n?2:1,raster:a},r)}export{T as clip,a as colormap,l as colormapToRGB,f as compositeBand,d as createColorComposite,m as extractBand,x as mask,g as remap,p as statisticsHistogram,c as table,b as transposeBits};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import n from"../../RasterFunction.js";function e(e,t,o){return Object.keys(t).forEach(n=>{null==t[n]&&delete t[n]}),o||(o="unknown"),new n({functionName:e,functionArguments:t,outputPixelType:o})}export{e as createRasterFunction};
|