Hi Beja,thanks for any explanation.n
exactly, that is all...to run the app and then open the browser and type that URL?
yes, jquery o javascritps eventHi, i am use your Examples, is exactly that i need. But need can marker click and return info to B4J code, is posible?
thanks
open a new post and I will help you, if you are Spanish-speaking, post in the Spanish forumHi, i am use your Examples, is exactly that i need. But need can marker click and return info to B4J code, is posible?
thanks
Thanks for the tip. It was very helpful. I made the recommended changes in "index.html" (see below). But now I don't even get the blank map grey box. Just the button controls.you need to go here and read it very carefully. there have been a number of changes.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Web App: Leaflet Map</title>
<link rel="stylesheet" href ="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="/b4j_ws.js"></script>
</head>
<body>
<h1>Web App: Leaflet Map example</h1>
<p>
<input type="radio" name="goto" value="0" checked>Anywhere Software<br/>
<input type="radio" name="goto" value="1">eurojams last exit<br/>
<button id="btngoto">GoTo</button></p>
<div id="map" style="width: 600px; height: 400px"></div>
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script>
var map = L.map('map');
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?
access_token={accessToken}', {
attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a
href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a
href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
tileSize: 512,
maxZoom: 18,
zoomOffset: -1,
id: 'mapbox/streets-v11',
accessToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}).addTo(map);
function gtlatlon(lat, lon, zoom, txt) {
map.setView([lat, lon], zoom); // The function goto latlon
L.marker([lat, lon]).addTo(map)
.bindPopup(txt).openPopup();
}
</script>
<script>
//connect to the web socket when the page is ready.
$( document ).ready(function() {
b4j_connect("/ws");
});
</script>
</body>
i've used mapbox for years with leaflet. when they introduced some changes,
i adopted them. i use the url shown on the link i posted. i have no problem.
i don't use the app you use, so it's difficult to comment on any possible coding errors.
sorry. everything does seem in order, however (quick glance).
i would have these suggestions:
1) make sure your key wasn't changed as part of mapbox's other changes. i don't remember if i had to get a new key.
2) create a literal url and try it on your desktop browser. do you follow what i mean? if you get a tile, then the error is somewhere in your code.
if you still don't get a tile, then the error is in the url (possibly the key...).
var map = L.map('map');
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?
access_token={accessToken}', {
attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a
href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a
href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
tileSize: 512,
maxZoom: 18,
zoomOffset: -1,
id: 'mapbox/streets-v11',
accessToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}).addTo(map);