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

How should I use user-supplied maps? #1950

Open
y20k opened this issue Oct 25, 2023 · 3 comments
Open

How should I use user-supplied maps? #1950

y20k opened this issue Oct 25, 2023 · 3 comments

Comments

@y20k
Copy link

y20k commented Oct 25, 2023

Issue Type

[x] Question

Description

I am the developer of Trackbook, a small app that records hikes. The app uses osmdroid. I recently got the request to add offline maps.

My approach:

  1. ask the user to provide a folder that contains .map files
  2. render the offline maps using MapsForgeTileSource

My problem: The files/directories, that the app receives from the system file picker, are of the type DocumentFile. MapsForgeTileSource only works with File.

I know that there is a (closed) issue #1591 for this problem. So my question rather would be:

Did I choose the right approach, given the premise, that I want to use user-supplied maps?

@spyhunter99
Copy link
Collaborator

hmm i haven't kept up with the ever changing android apis.

might want to check with the maps force folks to see if they have alternate apis that we could potentially wire in an input stream instead of file.

@y20k
Copy link
Author

y20k commented Oct 31, 2023

Hi @spyhunter99

might want to check with the maps force folks to see if they have alternate apis that we could potentially wire in an input stream instead of file.

As far as I can see the constructor for osmdroid's MapsForgeTileSource takes File[] and uses it internally to create Mapsforge MapFiles.

Mapfile also has a constructor that accepts a FileInputStream

My suggestion would be: MapsForgeTileSource should be able to accept FileInputStream[].

In my scenario this would work: You can create a MapFile from a DocumentFile. I tested that in my app. (The Android ContentResolver only lets me open an InputStream, but that can be casted to FileInputsStream, since the InputStream comes from a file.)

If implemented MapsForgeTileSource would work with the Android Storage Access Framework.

@eclectice
Copy link

eclectice commented Dec 21, 2023

Perhaps the MapsForge API implementator could use the GeoPackage API as a basis since it already has methods with DocumentFile. #1743 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants