-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PMTiles URL schema throws error in iOS #618
Comments
Is this error only in the logs or is there an actual functional deficit? I've pasted you example in the example app and the borders in BC are rendered. |
An actual functional deficit; the app will just crash. Borders render fine in Android. In iOS the problem arises. Are you running the example repro app in iOS? Simulator or device? I'll admit I only ran this on Android and iOS simulators as I don't have an iOS device, but the error suggests it's problem with |
This repository contains two example apps:
In both cases it renders fine for me within iOS simulator. I've used this bug report template: import {
LineLayer,
MapView,
VectorSource,
} from "@maplibre/maplibre-react-native";
export function BugReport() {
return (
<MapView style={{ flex: 1 }}>
<VectorSource
id="fireCentreSource"
url="pmtiles://https://nrs.objectstore.gov.bc.ca/lwzrin/psu/pmtiles/fireCentres.pmtiles"
>
<LineLayer
id="border-fire-centres"
sourceLayerID="tippecanoe_input"
style={{ lineColor: "red" }}
/>
</VectorSource>
</MapView>
);
} |
I can also reproduce on iOS 17.5. |
It might be MapLibre Native needs to fix something here, awaiting feedback. If I just directly pass the |
Would adopting protomaps/PMTiles#509 |
@bdon I think that decision is rather on MapLibre Native. |
It works on iOS 17 when using a |
Here are the error logs:
|
NSURL *url = [NSURL URLWithString:@"pmtiles://https://example.com/some.pmtiles"];
NSLog(@"URL: %@", url.absoluteString); Logs the following:
So |
Yeah I suspect this is a bug in the @KiwiKilian do you have any upstream issues opened you can share? |
Unfortunately no, I get this error when adjusting trying this alternative:
Parser seems to strip off the |
I think |
I've tested this code and the NSURL *url = [NSURL URLWithString:@"pmtiles://https://example.com/some.pmtiles"];
NSLog(@"%@", url.absoluteString);
NSURL *urlAlternative = [NSURL URLWithString:@"pmtiles+https://example.com/some.pmtiles"];
NSLog(@"%@", urlAlternative.absoluteString);
Until now I've discussed this on Slack, about to create an issue upstream. |
Upstream issue maplibre/maplibre-native#3151. Keeping this open, as we might have to adopt the string constructor, if that's the chosen fix. |
As we wait for the upstream fix release, here is a workaround, which can already be used: <VectorSource
id="fireCentreSource"
tileUrlTemplates={[
"pmtiles://https://nrs.objectstore.gov.bc.ca/lwzrin/psu/pmtiles/fireCentres.pmtiles",
]}
>
<LineLayer
id="border-fire-centres"
sourceLayerID="tippecanoe_input"
style={{ lineColor: "red" }}
/>
</VectorSource> |
Describe and reproduce the Bug
iOS uses
NSUrl
to represent the maplibre tile source. This type doesn't recognizepmtiles://https://<rest-of-url>
as a valid url and throws an error:The likely fix is to use a type other than
NSUrl
to represent the URL for the tile source, perhaps a string or more constrained type.Repro repo is here: https://github.com/conbrad/pmtiles-ios-bug
@maplibre/maplibre-react-native Version
10.0.0
Which platforms does this occur on?
iOS Simulator, iOS Device
Which frameworks does this occur on?
Expo, React Native
Which architectures does this occur on?
No response
Environment
The text was updated successfully, but these errors were encountered: