GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Open GPS tags of images in Windows Maps App [Win10, UWP]

I really love that Windows 10 has its native UWP (Universal Plattform, simply Windows 10 apps) maps app.
It happens that i want to see locations of many images at once. I know about the Image LOCATE command, but to start an uwp app a little bit more work has to be done.
My button now allows you to transfer existing GPS tags from the selected images to the maps app.
The maps app will start, open a new tab with the name of the current folder of DOpus and the count of images containing GPS tags and display those tags with the corresponding file name on the map and it does some kind of geocoding. Default map style forced by script is sattelite ("3d"). See Maps UWP Parameters Reference for further parameters.
As far as i know this shouldn't cause any leakage of sensitve information (or at least not more than using the app itself).

This is how it looks for my trip in Norway.

And here is the code. Copy&Paste to your lister menu bar.

<?xml version="1.0"?>
<button backcol="none" display="both" hotkey="ctrl+shift+M" label_pos="right" textcol="none">
	<label>Show GPS in Windows Maps</label>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>function OnInit(initData)</instruction>
        <instruction> = &quot;Open contained GPS tags in Windows Maps&quot;;</instruction>
		<instruction>	initData.desc = &quot;Opens the Windows Maps UWP app and shows the GPS locations contained in selected images&quot;;</instruction>
		<instruction>	initData.copyright = &quot;Felix Froemel;;	</instruction>
		<instruction>	initData.version = &quot;1.0 (6.2.2020)&quot;;</instruction>
        <instruction>	initData.url= &quot;;;</instruction>
		<instruction />
		<instruction>function OnClick(clickData)</instruction>
		<instruction>	var selectedFiles = clickData.func.sourcetab.selected_files;</instruction>
		<instruction>	if(selectedFiles.count &gt;= 1)</instruction>
		<instruction>	{</instruction>
		<instruction>		var collectionPoints = &quot;&quot;; </instruction>
		<instruction>		var gpsCount = 0;</instruction>
		<instruction>		for (var fileEnum = new Enumerator(selectedFiles); !fileEnum.atEnd(); fileEnum.moveNext()) </instruction>
		<instruction>		{</instruction>
		<instruction>			var currentItem = fileEnum.item();</instruction>
		<instruction>			if (!currentItem.is_dir)</instruction>
		<instruction>			{	</instruction>
		<instruction>				var fileMeta = currentItem.metadata;</instruction>
		<instruction>				if (fileMeta == &quot;image&quot;)</instruction>
		<instruction>				{</instruction>
		<instruction>					var imageMeta = fileMeta.image;</instruction>
		<instruction>					var lat = imageMeta[&quot;latitude&quot;];</instruction>
		<instruction>					var lng = imageMeta[&quot;longitude&quot;];</instruction>
		<instruction>					if(lat == &quot;&quot; || typeof(lat) === &apos;undefined&apos; || lng == &quot;&quot; || typeof(lng) === &apos;undefined&apos;)</instruction>
		<instruction>					{</instruction>
		<instruction>						Log(currentItem .name + &quot;: GPS Meta error (&quot; + lat + &quot;|&quot; + lng + &quot;). Skipping...&quot;);</instruction>
		<instruction>					}</instruction>
		<instruction>					else</instruction>
		<instruction>					{</instruction>
		<instruction>						collectionPoints += &quot;~point.&quot; + lat + &quot;_&quot; + lng + &quot;_&quot; +;</instruction>
		<instruction>						//~point.36.116584_-115.176753_Las%20Vegas</instruction>
		<instruction>						gpsCount++;</instruction>
		<instruction>					}</instruction>
		<instruction>				}</instruction>
		<instruction>			}</instruction>
		<instruction>		}</instruction>
		<instruction>		var collectionName = clickData.func.sourcetab.path + &quot; (&quot; + gpsCount + &quot; images with GPS tag)&quot;;</instruction>
		<instruction>		</instruction>
		<instruction>		StartWindowsMapsApp(collectionName, collectionPoints);</instruction>
		<instruction>	}</instruction>
		<instruction />
		<instruction>function StartWindowsMapsApp(collectionName, collectionPoints)</instruction>
		<instruction>	//</instruction>
		<instruction>	var cmd = &quot;shell:appsFolder\\Microsoft.WindowsMaps_8wekyb3d8bbwe!App bingmaps:?collection=name.&quot;;</instruction>
		<instruction>	cmd += collectionName;</instruction>
		<instruction>	cmd += collectionPoints;</instruction>
		<instruction>	cmd += &quot;&amp;sty=3d&quot;; //3d map style, &quot;a&quot;/&quot;r&quot;/&quot;3d&quot;</instruction>
		<instruction>	DOpus.NewCommand.RunCommand(cmd);</instruction>
		<instruction />
		<instruction>function Log(msg)</instruction>
		<instruction>	DOpus.Output(msg);</instruction>


This link doesn't work.

Thanks for the button, very useful :+1:


Thanks, fixed it. Two slashes too much.
And thanks for appreciation :pray:

1 Like