I don't know how to program InDesign, but how about copying the links to the clipboard for easy pasting?
// https://resource.dopus.com/t/placing-geodata-in-pdfs/41279
// 2022-05-19
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
cmd.deselect = false;
var zoomlevel = 18;
var tmp = '';
for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
var item = e.item();
if (item.metadata != 'image') continue;
var lat = item.metadata.image.latitude;
var lon = item.metadata.image.longitude;
if (typeof lat != 'number' || typeof lon != 'number') continue;
tmp += 'https://www.openstreetmap.org/?' + '&mlat=' + lat + '&mlon=' + lon + '#map=' + zoomlevel + '/' + lat + '/' + lon + '\r\n';
}
if (tmp != '') DOpus.SetClip(tmp);
}
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
<label>OSM Link</label>
<tip>Copy GPS to OSM link, one line per file</tip>
<icon1>#copyfilenames</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>// https://resource.dopus.com/t/placing-geodata-in-pdfs/41279</instruction>
<instruction />
<instruction>// 2022-05-19</instruction>
<instruction />
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> var tab = clickData.func.sourcetab;</instruction>
<instruction> cmd.deselect = false;</instruction>
<instruction />
<instruction> var zoomlevel = 18;</instruction>
<instruction />
<instruction> var tmp = '';</instruction>
<instruction> for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {</instruction>
<instruction> var item = e.item();</instruction>
<instruction />
<instruction> if (item.metadata != 'image') continue;</instruction>
<instruction />
<instruction> var lat = item.metadata.image.latitude;</instruction>
<instruction> var lon = item.metadata.image.longitude;</instruction>
<instruction> if (typeof lat != 'number' || typeof lon != 'number') continue;</instruction>
<instruction />
<instruction> tmp += 'https://www.openstreetmap.org/?' + '&mlat=' + lat + '&mlon=' + lon + '#map=' + zoomlevel + '/' + lat + '/' + lon + '\r\n';</instruction>
<instruction> }</instruction>
<instruction> if (tmp != '') DOpus.SetClip(tmp);</instruction>
<instruction>}</instruction>
</function>
</button>