-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remixing sprites #8
Comments
The intended way to solve this use case is to use
Which pixel ratio do you pull from https://maputnik.github.io/osm-liberty/sprites/osm-liberty:
Would it be possible to serve a higher pixel ratio with |
OK, after re-reading it, you gave the answer for the use case with
|
So I think you'd just pull the |
Hmmm that raises good point, since we're just taking the png, I guess we could be missing a ratio. I guess 2 options here we could just decrease the pixel ratio until we find one that matches. Then scale up those images, they'll be blurry (unscaled) but it's probably better that it works. I guess we could also throw an error, although then you'd get no images, so it's probably better it works poorly than not at all. |
A problem I'm having at the moment is reusing a base style, osm-liberty for example, while adding my own symbol layers on top. This is currently hard because I'd have to regenerate the osm-liberty stylesheet to include my images. If osm-liberty updates it's spritesheet I need to be aware of that and regenerate the spritesheet again. This is a massive pain and make reusing styles hard.
I believe this library can improve this experience by remixing stylesheets. I think we can do this by adding a
type
to our images definition. So where as currently we can pull in only imagesWe'd also be able to pull in any sprite. An example might be
This would pull in all the images from
https://maputnik.github.io/osm-liberty/sprites/osm-liberty
repackaging them along with the other images into a new spritesheet.The caching etag would also now be generated from both the definition (shown above) and the JSON source of the
https://maputnik.github.io/osm-liberty/sprites/osm-liberty
endpoint. This means that if the sprites change at the external endpoint we'll send a 304 not modified.I think we can do this with a combined hash of all the resources, concatinating the hashes with a
|
char (or something better)So we resolve definition like so
Then we'd remove any
spritesheet
's from the definition so we'd now have 2 sets of resources.Now the HTTP request has passed a
If-None-Match
to match against our etag we'll split by our|
and pass theIf-None-Match
to each resource on request. An example the HTTP request to our server comes with the followingIf-None-Match
headerWe make requests to each resource passing the hash via the
If-None-Match
which will in turn return a 304 if matched.Although you could pull from multiple external resources that is probably unlikely. However if you do if one request
304
's and the other doesn't. Then you'd need to re-request the data from the endpoint that returned304
to get the body of the content.The idea of all of this is that we're passing on the least work as we can to our down stream servers, letting the browser or CDN cache return the cached response.
The text was updated successfully, but these errors were encountered: