Replies: 2 comments 2 replies
-
|
I also ran into this and have resorted to defining the styles in my application where the URL can be configured dynamically. It would be nice to know if there is a solution to this as a quick scan of the source code didn't show up anything obvious. |
Beta Was this translation helpful? Give feedback.
-
This is my use case too. My deploy/rollback is done by promoting a DNS record, so nothing changes on the server, though it can introspect on the request.
I was mostly able to get things working with maplibre-gl-js (except for the In theory I can do a similar thing on native, transforming the style on the client side. However it's a less attractive option with mobile apps, because it means a delay in deployment while I wait for mobile clients to update. Instead, I might have a go at changing martin to inject the host/protocol into non-absolute URLs. My instinct is to use similar logic to what's done in |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Since Martin can now provide fonts, glyphs and styles together, I wonder if you can somehow set the URLs within the style.json relatively or with a placeholder so that you don't have to specify the absolute URL. (The MapLibre style spec expects an absolute URL there)
"glyphs": "https://example.com/map/font/{fontstack}/{range}",But I don't want to hard-code the domain of my server into the style.json, because I run a test server and a prod server, which have different domains. So far I had to store different style.json there (with the URL example.com and example-dev.com)
You could, for example, store the base URL in Martin's config and work with a placeholder in the URL, which Martin replaces when delivering the JSON file.
Or if you want it to be completely dynamic, Martin reads the request URL and inserts it there automatically. Then you could also run several domains in parallel without having to reconfigure Martin.
With placeholder
"glyphs": "{BASE_URL}/map/font/{fontstack}/{range}",or simply a relative URL wich will be completed by martin
"glyphs": "/map/font/{fontstack}/{range}",Beta Was this translation helpful? Give feedback.
All reactions