Skip to content
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

OSM Tile Server not working #3941

Closed
galdinoramon opened this issue Sep 7, 2021 · 4 comments
Closed

OSM Tile Server not working #3941

galdinoramon opened this issue Sep 7, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@galdinoramon
Copy link

galdinoramon commented Sep 7, 2021

Summary

UrlTile is not working with openstreetmap url on Android (emulator / real device). According to the #3747, this appears to be a permissions problem relatade to the http user agent and the new usage policy presented on OSM Tile Usage Policy
,

No solution has been presented so far and there are many others users with that problem.

Please if someone know how to fix the problem and can give some tips.

Environment info

"expo": "42.0.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "0.63.4",
"react-native-maps": "0.28.0"

Steps to reproduce

UrlTile works fine with this url 'http://tile.stamen.com/terrain/{z}/{x}/{y}.jpg' but not working with osm url 'http://c.tile.openstreetmap.org/{z}/{x}/{y}.png'.

Describe what you expected to happen:

Visible OSM tiles

Describe what you actually happens:

Blank map on android device

Reproducible sample code

const urlTemplate = 'http://tile.stamen.com/terrain/{z}/{x}/{y}.jpg';

return (
    <View style={styles.container}>
        <MapView
            provider={null}
            style={{
                position: 'absolute',
                top: 0,
                left: 0,
                right: 0,
                bottom: 0,
            }}
            mapType={'none'}
            initialRegion={region}
        >
            <UrlTile urlTemplate={urlTemplate} maximumZ={19} flipY={false} />
        </MapView>
    </View>
);
@galdinoramon galdinoramon added the bug Something isn't working label Sep 7, 2021
@christopherdro
Copy link
Collaborator

@MaRaSu Put together some docs recently around Tiles that might be helpful. https://github.com/react-native-maps/react-native-maps/blob/master/docs/tiles.md

@galdinoramon
Copy link
Author

Thanks for the feedback @christopherdro , apparently OSM free tile servers do not work on Android anymore due to the overuse. Do you know another way? maybe with a webview implementation... is it possible?

@MaRaSu
Copy link
Collaborator

MaRaSu commented Sep 8, 2021

@galdinoramon @christopherdro I think the right way to solve this is to use either a commercial tile service provider or setup your own tile server (relatively simple, see https://switch2osm.org/serving-tiles/), or if you find one, use a free tileserver for which Terms of Use are aligned with the actual usage. Trying to abuse openstreetmap.org tileservers, against their stated Usage Policy, with whatever workaround or hack, is not the right way in my opinion.

Some people probably misunderstand React Native Maps functionality: it's not a full map application for OSM-maps, it's just the client, and you need to organise for the service (server) yourself.

@galdinoramon
Copy link
Author

Thanks @MaRaSu and @christopherdro , it was really helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants