This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Pages: 1 - Last Post: 15 Jan 25, 16:55 Last Post By: Laza
thomaskr

Posts: 4
Registered: 14-Dec-2024
How to use fallback to OpenStreetMap?
Posted: 15 Jan 25, 10:40
 
  Click to reply to this thread Reply
jAlbum newbie question: I'd like to use OSM for the map on the contact page. Not providing an API key in Plain settings "...the skin will use the Open Street Map Service."

Putting the GPS coordinates into the contact page only the darkened Google Maps show up.
Any hint what I'm missing or doing wrong?

see on https://kruegerfoto.jalbum.net/Stamps/Contact.html
JeffTucker

Posts: 7,937
Registered: 31-Jan-2006
Re: How to use fallback to OpenStreetMap?
Posted: 15 Jan 25, 12:32   in response to: thomaskr in response to: thomaskr
 
  Click to reply to this thread Reply
Just a quick confirmation. You're not doing anything wrong. The fallback to OSM works fine for individual images, but not for the Contact page.

Should be an easy fix for Laza. I can say that because it's not my skin, so I'm not the one who has to fix it.
thomaskr

Posts: 4
Registered: 14-Dec-2024
Re: How to use fallback to OpenStreetMap?
Posted: 15 Jan 25, 13:20   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks a lot Jeff!

In fact the code for OSM is in the file main.js, but I don't know how to link it or add it to the template Contact (htt or inc). Meanwhile I switch to the maps of Google.

<%-- Creating map with OSM --%>
	async function setMap(canvas, latLng) {
		const pos = { lat: parseFloat(latLng[0]), lng: parseFloat(latLng[1]) };
		canvas.id = "map";
		map = L.map('map').setView([parseFloat(latLng[0]), parseFloat(latLng[1])], ${mapZoom}); 
		L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
			maxZoom: 	${mapZoom},
			attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'
		}).addTo(map);
		L.control.scale({
			imperial: 	true, 
			metric: 	true
		}).addTo(map); 
		L.marker(pos).addTo(map);
	};


Edited by: kruegerfoto on 15 Jan 2025, 13:20

Edited by: kruegerfoto on 15 Jan 2025, 13:22
Laza

Posts: 1,527
Registered: 6-Sep-2005
Re: How to use fallback to OpenStreetMap?
Posted: 15 Jan 25, 16:55   in response to: thomaskr in response to: thomaskr
 
  Click to reply to this thread Reply
Yes, the contact page template was taken over from my other skin, which has only Google Maps as a map option. I will have to find a way to make OSM work on Plain's Contact page.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums