Placing geodata in PDFs

I would like to make some PDF photobooks with GPS data using Adobe InDesign. Ideally, i would select a bunch of images with geodata, and have an automatized workflow, that would give me the links for alle the images. I could use QR codes already (GenerateGeoQrOnline, from the forum here), near the pictures, but i think that it doesn't look as good as having some link or link symbol near the pictures. How is Opus creating those round marks, when i use Image LOCATE=osm? Is there a way Opus could make links in that style instead opening OSM in the browser?

Opus creating those round marks

What marks? :thinking:

Is there a way Opus could make links in that style

You could repurpose the script from this discussion:

I mean those markers like in the screenshot. And thank you, i will have a look into that script.

That's an OSM feature :slight_smile:

Yes, i thought so. Your code snippet seems interesting, but where does it trigger the marker?

cmd.RunCommand("OpenStreetMap + "&mlat=" + latitude + "&mlon=" + longitude + "#map=" + zoomlevel + "/" + latitude + "/" + longitude + "/");

That's determined by the mlat and mlon parameters:

// with marker
cmd.RunCommand('https://www.openstreetmap.org/?' + '&mlat=' + lat + '&mlon=' + lon + '#map=' + zoomlevel + '/' + lat + '/' + lon);
// without marker
cmd.RunCommand('https://www.openstreetmap.org/?' +                                   '#map=' + zoomlevel + '/' + lat + '/' + lon);

Is there a chance to output the EXIFs geodata, using your code, to a link, that could be embedded in the PDFs?

What do you mean by embedded? Added as metadata to the file? Added as text or link to the pages in the pdf?

Ideally there would be some small link or link icon under or near each image. I'm not sure, since i guess this would be the InDesign part, that is creating the PDF. But having some sort of link that is capable of creating those location markers would be a good start.

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 = &apos;&apos;;</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 != &apos;image&apos;) continue;</instruction>
		<instruction />
		<instruction>        var lat = item.metadata.image.latitude;</instruction>
		<instruction>        var lon = item.metadata.image.longitude;</instruction>
		<instruction>        if (typeof lat != &apos;number&apos; || typeof lon != &apos;number&apos;) continue;</instruction>
		<instruction />
		<instruction>        tmp += &apos;https://www.openstreetmap.org/?&apos; + &apos;&amp;mlat=&apos; + lat + &apos;&amp;mlon=&apos; + lon + &apos;#map=&apos; + zoomlevel + &apos;/&apos; + lat + &apos;/&apos; + lon + &apos;\r\n&apos;;</instruction>
		<instruction>    }</instruction>
		<instruction>    if (tmp != &apos;&apos;) DOpus.SetClip(tmp);</instruction>
		<instruction>}</instruction>
	</function>
</button>

Perfect, thank you, lxp!

We will now check out in InDesign, how the link could be integrated. I will report back, how things are going, but your code is already very helpful. :beers: