-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add support for downloading remote images for icon-image handling #65
Conversation
@rstcruzo thank you for putting this together! A few questions first:
I haven't done an exhaustive read of the docs for Adding support to use I would like to avoid adding image download capabilities to I think we could use |
Let's say the style is this one:
We need
@brendan-ward I agree that allowing locally-available images would be a nice feature too. But it doesn't accommodate to our use case. We are using images uploaded by users. Those images are hosted on our server. We would need to send an image to the Let me know your thoughts :) |
@rstcruzo are the images small enough that they could be base64 encoded instead of passed around as image files? Then the images parameter could take as input a data structure that is either a lookup to locations on disk or strings of base64 encoded data. Are the requests to We should probably look into how mapbox.com handles user-uploaded icon images, to see if that is inspirational here. It is possible that the platform creates sprites for user-uploaded images and hosts them alongside the other style assets and sidesteps need to load the images. |
@brendan-ward images could be of any size. Requests to mbgl-renderer are originated from server. I didn't think downloading an image would be undesirable since the renderer is already downloading sprites, image sources, etc. with Hope this PR helps someone else anyways :) |
Superseded by #83 @rstcruzo I spliced your changes here in with the ability to load base64 encoded images (we needed for our use case); thank you so much for the good start on this, and apologies it took so long to work these changes in! Note: the final API is a little different than what you proposed here.
|
We are using mapbox-gl-renderer and it's great. But had an issue when trying to use
icon-image
, it doesn't work because the image is not available and there is not a way to specify an url there, just an image name.This PR is to solve that use case. I added a
images
parameter to the server so that it downloads all the images first.I am not that experienced with javascript so I will be very happy to get some feedback :)