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>
	<icon1>#downloads</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>function OnInit(initData)</instruction>
		<instruction>{</instruction>
        <instruction>	initData.name = &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 https://resource.dopus.com/u/Felix.Froemel/&quot;;	</instruction>
		<instruction>	initData.version = &quot;1.0 (6.2.2020)&quot;;</instruction>
        <instruction>	initData.url= &quot;https://resource.dopus.com/t/open-gps-tags-of-images-in-windows-maps-app-win10-uwp/34577&quot;;</instruction>
		<instruction>}</instruction>
		<instruction />
		<instruction>function OnClick(clickData)</instruction>
		<instruction>{</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; + currentItem.name;</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>
		<instruction />
		<instruction>function StartWindowsMapsApp(collectionName, collectionPoints)</instruction>
		<instruction>{</instruction>
		<instruction>	//https://docs.microsoft.com/en-us/windows/uwp/launch-resume/launch-maps-app#bingmaps-param-reference</instruction>
		<instruction>//collection=name.My%20Trip%20Stops~point.36.116584_-115.176753_Las%20Vegas~point.37.8268_-122.4798_Golden%20Gate%20Bridge</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>
		<instruction />
		<instruction>function Log(msg)</instruction>
		<instruction>{</instruction>
		<instruction>	DOpus.Output(msg);</instruction>
		<instruction>}</instruction>
	</function>
</button>

5 Likes

This link doesn't work.

Thanks for the button, very useful :+1:

2 Likes

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

1 Like

A neat addition to my location tools. But i wonder, and this must be some Windows Map issue, why i don't get any thumbnails for the images in the list on the left side. Also no image thumbnail when clicking on the location points. Anyway, nice!

1 Like

Thanks :slightly_smiling_face:
No I dont think that this is an issue. I am handing a string over to Maps with the locations and the captions. The content of the captions could be anything, so maps does not know how to deal with it. Even though maps would know that it is a file/image, it would need a permission to access those files which is not granted and as far as i know maps does not have the functionality to access files on your disk (except cache). But I agree with you that it would be a nice addition.

So that's why i don't get any images? Thanks for the information.

@blueroly, @abr or anyone else coming across this thread, you might be interested in a new version of this script as an internal command. It does better file handling/progress and can also handle thumbnails and images displayed at the map (but then in Google Earth) here https://resource.dopus.com/t/command-imagelocateadvanced/38030

Hi @Felix.Froemel, I have not used DO for a year for one reason or another but I'll be back on it daily within the next couple of weeks. I look forward to trying this out. Thank you.