Skip to content
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

possible improvment: Allow setting self-hosted sources in style #24

Open
moan0s opened this issue Sep 28, 2024 · 1 comment
Open

possible improvment: Allow setting self-hosted sources in style #24

moan0s opened this issue Sep 28, 2024 · 1 comment

Comments

@moan0s
Copy link
Contributor

moan0s commented Sep 28, 2024

I believe this might not be possible but maybe it is, that's why I wanted to raise this issue :)

I host versatiles, including the frontend at https://tiles.hyteck.de . Therefore I adjusted the basic example to use the style from my self-hosted server.

<script src="[https://tiles.hyteck.de/assets/maplibre-gl/maplibre-gl.js](view-source:https://tiles.hyteck.de/assets/maplibre-gl/maplibre-gl.js)"></script>
<link href="[https://tiles.hyteck.de/assets/maplibre-gl/maplibre-gl.css](view-source:https://tiles.hyteck.de/assets/maplibre-gl/maplibre-gl.css)" rel="stylesheet"/>

[...]

<script>
    let map = new maplibregl.Map({
        container: 'map',
        style: 'https://tiles.hyteck.de/assets/styles/colorful.json',
        center: [10.49, 50.68],

I expected this would also lead to using my own versatiles server. I then discovered, that the sources are hard-coded in the style like this:

	"glyphs": "https://tiles.versatiles.org/assets/fonts/{fontstack}/{range}.pbf",
	"sprite": "https://tiles.versatiles.org/assets/sprites/sprites",
	"sources": {
		"versatiles-shortbread": {
			"tilejson": "3.0.0",
			"attribution": "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors",
			"tiles": [
				"https://tiles.versatiles.org/tiles/osm/{z}/{x}/{y}"
			],

So what I did is, I copied the file to the application that uses the map & adjusted the style to use my versatiles server. That works, but it feels unintuitive, copying a style just to adjust a three lines at the start.

So my question is: Is there a better way to do this? If not, totally fair, then it might follow up with a PR to the docu so that other people are not as puzzeld as I was ;)

@MichaelKreil
Copy link
Member

Sorry for the late reply, but I'm drowning in issues and todos. :/

We have provided a way to create a style in the frontend. You can change all the urls and also the language and colours:
Create styles in the web browser)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants