• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

124
Views
Error downloading openstreetmap tile on react-native

I'm making a react-native application and I need to allow to use the map without internet. For this I download the tiles on the mobile with react-native-fs. I don't understand the following error:

[Error: Unable to resolve host "tile.openstreetmap.org": No address associated with hostname]

On postman I have to put a Host field in the header but in the doc I don't have this field indicated : https://operations.osmfoundation.org/policies/tiles/

postman request

request:

    RNFS.downloadFile({
      fromUrl: link,
      toFile:
        dir +
        '/' +
        splitLink[splitLink.length - 3] +
        '/' +
        splitLink[splitLink.length - 2] +
        '/' +
        splitLink[splitLink.length - 1],
      headers: {
        'User-Agent': 'android',
      },
    })
      .promise.then(response => {
        console.log('response', response);
        if (response.statusCode === 200) {
          return console.log('FILES UPLOADED!', response);
        } else {
          console.log('SERVER ERROR');
        }
      })
      .catch(err => {
        console.log('err', err);
      });

I think it's the Host field that's missing in my request but I can't find what value to put.

Thanks for your help :)

about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error