Elleo / qt-osm-map-providers

Easily setup a Qt OSM Map providers repository to allow use of tile servers that require an API key
MIT License
9 stars 2 forks source link

Embedding api key into the desktop application #2

Closed berkantay closed 4 years ago

berkantay commented 4 years ago

Hi, My aim is to embed my api key to the application that I developed and show tiles without API KEY REQUIRED. Could you please help me to do that?

Elleo commented 4 years ago

Do you mean you want to do it without setting up an HTTP server? You could try embedding the repository files in a QRC and see if passing a QRC path to the osm.mapping.providersrepository.address property works

berkantay commented 4 years ago

Actually I have two steps,

First, user will download the map using the API KEY one that I embed then I will cache those tiles in a specific directory. Then when he/she goes offline program uses that directory using osm.offline.directory plugin parameter

I am able to do the second part BUT all those cached tiles has API KEY REQUIRED tag on it. I want to remove the tag.

berkantay commented 4 years ago

I will try it and let you know whether it works or not.

Cheers

Elleo commented 4 years ago

If you're able to set up an HTTP server it sounds like everything you want to do will work fine with the original method I detailed here: https://blog.mikeasoft.com/2020/06/22/qt-qml-maps-using-the-osm-plugin-with-api-keys/

It just directs the Map element to the correct URLs when online to get files using an API key, so the cached files will still be accessible as normal offline (without any watermarks)

berkantay commented 4 years ago

So, initiating a local HTTP server and implementing your method should work. Am I correct?

Elleo commented 4 years ago

That'll work, it doesn't have to be a local HTTP server though, it can also be one hosted online (that'd make it simpler for you if you need to change your API key, or mapping provider without needing users to upgrade)

berkantay commented 4 years ago

That worked thanks a lot for your time.

cheers mate

Elleo commented 4 years ago

You're welcome!