Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Feature request: Allow file URLs for the "sprite" property of styles #1123

Closed
picciano opened this issue Mar 26, 2015 · 6 comments
Closed

Feature request: Allow file URLs for the "sprite" property of styles #1123

picciano opened this issue Mar 26, 2015 · 6 comments

Comments

@picciano
Copy link

Currently only http:// and https:// URLs appear to be supported as URLs in the "sprite" property of a style. It would be very useful to also allow file:/// URLs so that spite JSON and PNG files could be bundled with the app rather than hosted externally.

@kkaefer
Copy link
Contributor

kkaefer commented Mar 27, 2015

This works by specifying asset://, which is relative to Resource bundle of the application. We intentionally didn't use file:// since asset:// isn't directly mapped to the file system: on some systems like Android, it refers to the APK bundle (which is a zip file). Does this work for you?

@picciano
Copy link
Author

It does. I will confirm it's working Monday. Thank you.

@picciano
Copy link
Author

Works for now. I can get the path of the sprite resources, strip off the extension, then load the style dictionary and set the "sprite" attribute to "asset://" + absolute runtime path to resource. Much better than loading from a URL.

p.s. Just in case you don't hear it often enough, you guys are doing a great job with this project!

@kkaefer
Copy link
Contributor

kkaefer commented Mar 30, 2015

Works for now.

If there's anything that you think should change about the API, please create a ticket.

@picciano
Copy link
Author

I think there are already some open issues that capture this, but I think splitting out the sprite sheet from the style would improve things a lot. One of the most typical uses of the map would be to use an existing style, but add custom annotations. Either the style needs to be able to support multiple sprite asset sheets, or there needs to be a way to set display properties to the annotation itself, either as vector drawing in a UIView (preferable) or bitmap. It's unfortunate that we are drawing a beautiful vector-based maps, then plunking down bitmap images of icons on top.

Related to #941 and even #1152 and maybe #925

@incanus
Copy link
Contributor

incanus commented Mar 31, 2015

Yeah, #941 is the canonical spot for user-provided sprite imagery at runtime. It wasn't yet on my radar to think about vectors, just bitmaps, but stay tuned as we build that out.

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

No branches or pull requests

3 participants