-
-
Notifications
You must be signed in to change notification settings - Fork 438
Description
Created from:
Closely related to:
Problem
Maputnik currenlly does request /font/%7Bfontstack%7D/%7Brange%7D
to query for fonts if ran against maplibre/martin
.
This is the case because the orinal font url is /font/{fontstack}/{range}
.
As the .pbf
ending that maputnik assumes does not exist, the replacement on line 30 below does not happen.
Related PR on martins side which we did not get done yet:
Maputnik expects to recieve an array of possible fontstacks.
Feature Request
would it be possible to request these 3 URLs in paralel and accept the first successfull response or would the overhead be too high on the maputnik side?:
- (idk which software this is) original URL
- (idk which software this is, its not tileserver-gl)
/fontstack.json
- (tileserver-gl)
replace(normPathPart, '.json')
- (martin)
/catalog
Alternatives
We could handle this in martin. I am unsure what is the best option here.
A hybrid approach would be to drop the .pbf
requirement in below code and implement serving under the replace(normPathPart, '.json')
-Url in martin
Additional Context
Lines 20 to 35 in c6174a5
export function downloadGlyphsMetadata(urlTemplate: string, cb: (...args: any[]) => void) { | |
if(!urlTemplate) return cb([]) | |
// Special handling because Tileserver GL serves the fontstacks metadata differently | |
// https://github.com/klokantech/tileserver-gl/pull/104#issuecomment-274444087 | |
const urlObj = npmurl.parse(urlTemplate); | |
const normPathPart = '/%7Bfontstack%7D/%7Brange%7D.pbf'; | |
if(urlObj.pathname === normPathPart) { | |
urlObj.pathname = '/fontstacks.json'; | |
} else { | |
urlObj.pathname = urlObj.pathname!.replace(normPathPart, '.json'); | |
} | |
const url = npmurl.format(urlObj); | |
loadJSON(url, [], cb) | |
} |
Note
PS: I have a bit of time in my cristmas break to look into implementing this.
I think I am missing a bit of context as the code relevant seems a bit strange