I have a map inside a Confluence wiki page, and using PocketQuery I get the addresses I want to display from my DB. What's the most direct way to do the Nominatim request and the Leaflet marker placement? I can generate code that looks like this: <script> #foreach($person in $result) $.getJSON('https://nominatim.openstreetmap.org/search/$person.strasse $person.hausnummer ,$person.plz?format=json', cbMarker); function cbMarker(data){ L.marker([data.lat, data.lon], {title: '$person.name'}).addTo(map); } #end </script>but something is wrong, it seems to crash the template and it falls back to just showing me $result as a table. asked 06 Nov '15, 10:13 HeaDCase aseerel4c26 ♦ |
Your question is difficult to understand (what is Conluence and where does PocketQuery come into it - are we supposed to know?) but your JavaScript looks like it assumes that the Nominatim response will be a hash when indeed it will be an array of search results; you probably need something like answered 13 Nov '15, 23:00 Frederik Ramm ♦ |
Is Conluence supposed to be Confluence?
... this one https://en.wikipedia.org/wiki/Confluence_%28software%29 ? @HeaDCase
Yeah, my typo there. Got it sorted in the meantime, the suggestion about using only the first element of the returned array is right on the money. Thanks!