[Bug]: RasterLayers suddenly throw CGImageSourceCreateImageAtIndex
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
Mapbox Implementation
Mapbox
Mapbox Version
11.4.1
React Native Version
0.75.3
Platform
iOS, Android
@rnmapbox/maps version
10.1.33
Standalone component to reproduce
import React, {useMemo} from 'react';
import {
RasterLayer,
RasterSource,
} from '@rnmapbox/maps';
const tileUrl = 'https://<geoserver>/wms?service=WMS&version=1.1.0&bbox={bbox-epsg-3857}&format=image/png&transparent=true&request=GetMap&srs=EPSG:3857&width=256&height=256&layers=LayerName&tiled=true&authkey=<auth_code>';
const layerId = 'raster.layer';
const sourceId = 'source.1';
const bellowId = 'base.layer';
const visible = true;
const Raster = () => {
if (! layerId || !sourceId) {
return null;
}
const rasterStyles = useMemo(
() => ({
visibility: visible ? 'visible' : 'none',
rasterOpacity: 0.7,
}),
[visible],
);
return (
<RasterSource
key={layerId}
id={sourceId}
tileUrlTemplates={[tileUrl]}
tileSize={256}
existing={false}>
<RasterLayer
belowLayerID={bellowId}
existing={true}
sourceID={sourceId}
id={layerId}
style={rasterStyles}
/>
</RasterSource>
);
}
export default Raster;
Observed behavior and steps to reproduce
I've observed that this issue started with layers where the tileURI was converted/filled with the substitution of the {bbox-epsg-3857} placeholder by the coordinates, where the coordinates were getting a strange concat value of %252C, after an attempt to upgrade the lib to the latest version and cleaning the node_modules cache it started having issues with the Turbo mode and I rollback to 10.1.33, now the CGImageSourceCreateImageAtIndex happens to all layers and this crashes the app, with no chance to catch the error because there is no onError callback in the Source components.
Expected behavior
It is expected not to throw an error and place an empty layer in its place so that the other layers don't get hidden.
It is also expecting to not nave coordinates with %252C in place of the %2C
Notes / preliminary analysis
The issue started with layers that had %252C in the coordinates
Additional links and references
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the standalone RasterSource and RasterLayer reproduction in the issue, focusing on tileUrlTemplates and the {bbox-epsg-3857} substitution. Reproduce the %252C URL encoding and CGImageSourceCreateImageAtIndex crash on iOS and Android, then verify that malformed raster tiles no longer crash the app and that an empty layer preserves other layers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100