Add "Copy coordinates to clipboard"

Ideas for improvements and requests for new features in XnView MP

Moderator: xnview

geoffm
Posts: 22
Joined: Fri Nov 06, 2015 6:54 pm

Add "Copy coordinates to clipboard"

Post by geoffm »

In the "Open GPS location in..." submenu, would be relevant to add a "Copy coordinates to clipboard" so we can quickly pin the location in a map of our choice. Opening a new google map window doesn't quite cut it when we're trying to add pins in a custom google earth map or if QGIS or whatnot. would save us several clicks and back and forth with the separate latitude and longitude hidden inside the properties → EXIF tab.
jkm
Posts: 562
Joined: Sat May 11, 2024 12:43 am

Re: Add "Copy coordinates to clipboard"

Post by jkm »

You can achieve a simple copy to clipboard now in a single click, and customize it if you do a little setup.

Exiftool already generates a composite tag for this. On the Exiftool tab, you'll find the "GPS Position" tag which contains everything in one value.

By default it looks like this:
31 deg 52' 59.13" N, 87 deg 36' 48.03" W

If you don't like the formatting, you can customize it, by modifying your .Exiftool_config file.
Paste this routine into an existing .Exiftool_config file, and it will define a new composite tag "GPS Position Copy" that is better formatted for some purposes:

Code: Select all

		GPSPositionCopy => {
			Desire => {
				0 => 'GPSPosition',
			},
			ValueConv => q{
				my ($a) = $prt[0];
				$a =~ s/ deg / /g;
				return $a;
			}
		}		
This "GPS Position Copy" tag will will have output that looks like this:
31 52' 59.13" N, 87 36' 48.03" W

But you can change it however you want. The function is programmed in Perl.

If you don't have an .Exiftool_config file, you can create one with the following contents, and it will do the job.

Code: Select all

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
		GPSPositionCopy => {
			Desire => {
				0 => 'GPSPosition',
			},
			ValueConv => q{
				my ($a) = $prt[0];
				$a =~ s/ deg / /g;
				return $a;
			}
		},		
	}
);
Once you have this working from the command line using Exiftool, then in XnViewMP you'll need to do a Tools->Setting:Catalog:Update Metadata.
This will repopulate all your images to include the new tag.

Here's an article if you need to know more about running a customized Exiftool with XnViewMP.
viewtopic.php?t=49746

Learn more about customizing Exiftool and creating user-defined tags here:
https://exiftool.org/faq.html#Q11

Hopefully this helps...