Skip to content

Commit e14b474

Browse files
committed
add mapping via MapQuest and Waze
Also: - fix near-zero coordinates handling - simplify/improve mapping via Bing Maps - fix wording in action descriptors - make minor README amendments
1 parent adfdec5 commit e14b474

12 files changed

+164
-33
lines changed

README.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ for plotting GPS position thereof using various online mapping services
1414
https://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2023-E[Exif] is a standard, specified{nbsp}/ issued
1515
by JEIDA{nbsp}/ https://www.jeita.or.jp/english/[JEITA]{nbsp}/ https://www.cipa.jp/e/index.html[CIPA], that defines
1616
formats for media files, as well as ancillary metadata tags, to be used by digital cameras{nbsp}/ scanners and sound
17-
recorders. MPEG video formats also allow containing metadata in media files. This metadata, besides various camera and
18-
shooting mode information, such as the camera model and make, aperture, shutter speed, focal length, ISO speed, etc.,
19-
may also contain geolocation information.
17+
recorders. MPEG video formats also allow containing metadata in media files. This metadata, besides various technical
18+
image information, such as camera make and model, aperture, shutter speed, focal length, ISO speed, etc., may also
19+
contain geolocation information.
2020

2121
https://github.com/linuxmint/nemo[Nemo] is the file manager for the https://github.com/linuxmint/cinnamon[Cinnamon]
2222
desktop environment, the primary one for https://linuxmint.com/[Linux Mint].
@@ -68,7 +68,7 @@ A release archive contains the following files:
6868
│ │ : using 'exif' utility
6969
│ ├─ exif_metadata_list_exiftool.nemo_action : ... for displaying Exif metadata
7070
│ │ : using 'exiftool' utility
71-
│ └─ exif_metadata_mapping_*.nemo_action : ... for displaying GPS position in
71+
│ └─ exif_metadata_mapping_*.nemo_action : ... for displaying GPS position using
7272
│ : various online mapping services
7373
7474
├─ readme/
@@ -85,7 +85,7 @@ A release archive contains the following files:
8585
```
8686
8787
The approach with scripts separation from related actions into a nested folder was borrowed from
88-
https://github.com/smurphos/nemo_actions_and_cinnamon_scripts[smurphos 'Nemo Actions & Cinnamon Scripts' repo].
88+
https://github.com/smurphos/nemo_actions_and_cinnamon_scripts[GitHub : smurphos : Nemo Actions & Cinnamon Scripts].
8989
9090
### Usage
9191
@@ -134,7 +134,7 @@ The solution currently has the following provisions for internationalization:
134134
* `LANGUAGE` variable defined in `exif_metadata__settings.bash`:
135135
** overrides{nbsp}/ shadows similar user profile variable;
136136
** defaults to shortened language-code-only user profile setting as `"${LANGUAGE/_*/}"`;
137-
** has effect on language settings of the utilities and on online mapping services;
137+
** has effect on language settings of the utilities and of online mapping services;
138138
* context menu item names and comment lines for metadata display actions, specified in related action descriptors.
139139

140140
#### Browser for displaying GPS position in online mapping services

nemo/actions/action_scripts/exif_metadata__functions.bash

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
# - altitude : shared 'altitude' variable
1515
obtain_gps_position_using_exif () {
1616
# obtain specific GPS-related metadata
17-
local latitude=$(exif --machine-readable --ifd=GPS --tag GPSLatitude "$1")
17+
local latitude=$(LC_NUMERIC=POSIX exif --machine-readable --ifd=GPS --tag GPSLatitude "$1")
1818
local latitude_ref=$(exif --machine-readable --ifd=GPS --tag GPSLatitudeRef "$1")
19-
local longitude=$(exif --machine-readable --ifd=GPS --tag GPSLongitude "$1")
19+
local longitude=$(LC_NUMERIC=POSIX exif --machine-readable --ifd=GPS --tag GPSLongitude "$1")
2020
local longitude_ref=$(exif --machine-readable --ifd=GPS --tag GPSLongitudeRef "$1")
2121
altitude=$(exif --machine-readable --ifd=GPS --tag GPSAltitude "$1")
2222

2323
# if GPS position is present, convert to degrees
2424
if [ -n "${latitude}" ] ; then
2525
local latitude_tokens=(${latitude//, / })
2626
local longitude_tokens=(${longitude//, / })
27-
local latitude_degrees=$(echo "scale=6 ; ${latitude_tokens[0]} + ${latitude_tokens[1]} / 60 + ${latitude_tokens[2]//,/.} / 3600" | bc)
28-
local longitude_degrees=$(echo "scale=6 ; ${longitude_tokens[0]} + ${longitude_tokens[1]} / 60 + ${longitude_tokens[2]//,/.} / 3600" | bc)
27+
local latitude_degrees=$(echo "scale=6 ; ${latitude_tokens[0]} + ${latitude_tokens[1]} / 60 + ${latitude_tokens[2]} / 3600" | bc | sed 's/^\./0./')
28+
local longitude_degrees=$(echo "scale=6 ; ${longitude_tokens[0]} + ${longitude_tokens[1]} / 60 + ${longitude_tokens[2]} / 3600" | bc | sed 's/^\./0./')
2929
gps_position="${latitude_degrees}${latitude_ref}, ${longitude_degrees}${longitude_ref}"
3030
else
3131
gps_position=''

nemo/actions/action_scripts/exif_metadata_mapping_bing.bash

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,13 @@
1414
#
1515
# See https://social.msdn.microsoft.com/Forums/en-US/1ee6dfc4-b4cd-4bfc-a3ad-71acf80c61c3/bing-maps-beta-how-do-i-create-an-http-link-to-bring-up-the-address-on-a-bing-map?forum=vemapcontroldev
1616
# for discussions on Microsoft forum
17+
#
18+
# Still experiments suggest that the simplest 'q=' query is the most efficient...
1719
#-----------------------------------------------------------------------------------------------------------------------
1820

19-
# source the script file with reusable function definitions
20-
. "$(dirname "$0")/exif_metadata__functions.bash"
21-
2221
# define specific function for URL formatting, specified in 'exif_metadata__mapping.bash'
2322
format_url () {
24-
# obtain coordinates in numeric signed format
25-
declare lat_signed lng_signed ; coordinates_as_numeric_signed lat_signed lng_signed "$1"
26-
27-
if [ -n "${lat_signed}" ] ; then
28-
# one of possible implementation options: use 'rtp' url param;
29-
# looks reliable, but displays an unnecessary 'Directions' pane for route planning
30-
url="https://www.bing.com/maps?setLang=${LANGUAGE}&rtp=pos.${lat_signed}_${lng_signed}"
31-
32-
# another possible implementation option: use 'cp' and 'sp' url params;
33-
# unfinished, as currently produces no visible point/marker on the map
34-
# url="https://www.bing.com/maps?setLang=${LANGUAGE}&cp=${lat_signed}~${lng_signed}&sp=point.${lat_signed}_${lng_signed}_titleString_notesString_linkURL_photoURL"
35-
else
36-
# make an attempt to display error message in the browser address line
37-
url="https://_/ERROR: unexpected GPS position syntax: [$1]"
38-
fi
23+
url="https://www.bing.com/maps?setLang=${LANGUAGE}&q=${1/, /%2C+}"
3924
}
4025

4126
# source/call the generic script for handling GPS locations or for action condition evaluation
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /bin/bash
2+
#-----------------------------------------------------------------------------------------------------------------------
3+
# Script to implement rendering of GPS locations from Exif metadata in MapQuest mapping service
4+
# and for evaluation of conditions for related Nemo action to be displayed in the context menu.
5+
#-----------------------------------------------------------------------------------------------------------------------
6+
7+
# source the script file with reusable function definitions
8+
. "$(dirname "$0")/exif_metadata__functions.bash"
9+
10+
# define specific function for URL formatting, specified in 'exif_metadata__mapping.bash'
11+
format_url () {
12+
# obtain coordinates in numeric signed format
13+
declare lat_signed lng_signed ; coordinates_as_numeric_signed lat_signed lng_signed "$1"
14+
15+
if [ -n "${lat_signed}" ] ; then
16+
url="https://www.mapquest.com/latlng/${lat_signed}%2C${lng_signed}"
17+
else
18+
# make an attempt to display error message in the browser address line
19+
url="https://_/ERROR: unexpected GPS position syntax: [$1]"
20+
fi
21+
}
22+
23+
# source/call the generic script for handling GPS locations
24+
. "$(dirname "$0")/exif_metadata__mapping.bash"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /bin/bash
2+
#-----------------------------------------------------------------------------------------------------------------------
3+
# Script to implement rendering of GPS locations from Exif metadata in Waze mapping service
4+
# and for evaluation of conditions for related Nemo action to be displayed in the context menu.
5+
#-----------------------------------------------------------------------------------------------------------------------
6+
7+
# source the script file with reusable function definitions
8+
. "$(dirname "$0")/exif_metadata__functions.bash"
9+
10+
# define specific function for URL formatting, specified in 'exif_metadata__mapping.bash'
11+
format_url () {
12+
# obtain coordinates in numeric signed format
13+
declare lat_signed lng_signed ; coordinates_as_numeric_signed lat_signed lng_signed "$1"
14+
15+
if [ -n "${lat_signed}" ] ; then
16+
url="https://www.waze.com/${LANGUAGE}/live-map/directions?latlng=${lat_signed}%2C${lng_signed}"
17+
else
18+
# make an attempt to display error message in the browser address line
19+
url="https://_/ERROR: unexpected GPS position syntax: [$1]"
20+
fi
21+
}
22+
23+
# source/call the generic script for handling GPS locations
24+
. "$(dirname "$0")/exif_metadata__mapping.bash"

nemo/actions/exif_metadata_mapping_google.nemo_action

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Active=true
1919

2020
# The name to show in the menu, locale supported with standard desktop spec.
2121
Name[en]=Display GPS position in 'Google Maps'
22-
Name[ru]=Показать GPS-позицию в сервисе '2ГИС'
22+
Name[ru]=Показать GPS-позицию в сервисе 'Google Карты'
2323

2424
# Tool tip, locale supported (Appears in the status bar)
25-
Comment[en]=Display GPS position for '%f' in '2GIS' online mapping service
25+
Comment[en]=Display GPS position for '%f' in 'Google Maps' online mapping service
2626
Comment[ru]=Показать GPS-позицию для файла '%f' в онлайн-сервисе 'Google Карты'
2727

2828
# What to run. Enclose in < > to run an executable that resides in the actions folder.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[Nemo Action]
2+
#-----------------------------------------------------------------------------------------------------------------------
3+
# A Nemo action file to display GPS location from media file Exif metadata in MapQuest mapping service.
4+
#
5+
# See 'https://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2023-E' for Exif 3.0 metadata specification.
6+
#-----------------------------------------------------------------------------------------------------------------------
7+
# See 'https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action' for a sample of
8+
# Nemo action file with detailed comments.
9+
#-----------------------------------------------------------------------------------------------------------------------
10+
# NOTE on debugging:
11+
#
12+
# Run Nemo in debug mode using with NEMO_DEBUG set to include 'Actions', i.e.:
13+
# $ nemo --quit
14+
# $ NEMO_DEBUG=Actions nemo --debug
15+
#-----------------------------------------------------------------------------------------------------------------------
16+
17+
# Whether this action is active. For troubleshooting.
18+
Active=true
19+
20+
# The name to show in the menu, locale supported with standard desktop spec.
21+
Name[en]=Display GPS position in 'MapQuest'
22+
Name[ru]=Показать GPS-позицию в сервисе 'MapQuest'
23+
24+
# Tool tip, locale supported (Appears in the status bar)
25+
Comment[en]=Display GPS position for '%f' in 'MapQuest' online mapping service
26+
Comment[ru]=Показать GPS-позицию для файла '%f' в онлайн-сервисе 'MapQuest'
27+
28+
# What to run. Enclose in < > to run an executable that resides in the actions folder.
29+
Exec=<action_scripts/exif_metadata_mapping_mapquest.bash %F>
30+
31+
# Icon name to use in the menu - must be a theme icon name
32+
Icon-Name=view-pin-symbolic
33+
34+
# What type selection: [s]ingle, [m]ultiple, any, notnone, none (background click), or
35+
# a number representing how many files must be selected to display.
36+
Selection=s
37+
38+
# What mime-types to display on - this is an array, end with a semicolon
39+
Mimetypes=image/jpeg;video/mp4;
40+
41+
# Dependencies - program executables required for this action to work.
42+
# This is an array, separate entries with semi-colon, and terminate with a semicolon.
43+
#Dependencies=exiftool;
44+
45+
# Conditions - semicolon-separated array of special conditions
46+
Conditions=exec <action_scripts/exif_metadata_mapping_mapquest.bash %F --condition>;
47+
48+
# Run in terminal - set to true to execute the Exec line in a spawned terminal window.
49+
#Terminal=false

nemo/actions/exif_metadata_mapping_openstreetmap.nemo_action

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Nemo Action]
22
#-----------------------------------------------------------------------------------------------------------------------
3-
# A Nemo action file to display GPS location from media file Exif metadata in 2GIS mapping service.
3+
# A Nemo action file to display GPS location from media file Exif metadata in OpenStreetMap mapping service.
44
#
55
# See 'https://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2023-E' for Exif 3.0 metadata specification.
66
#-----------------------------------------------------------------------------------------------------------------------

nemo/actions/exif_metadata_mapping_vk.nemo_action

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Nemo Action]
22
#-----------------------------------------------------------------------------------------------------------------------
3-
# A Nemo action file to display GPS location from media file Exif metadata in 2GIS mapping service.
3+
# A Nemo action file to display GPS location from media file Exif metadata in VK Maps.
44
#
55
# See 'https://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2023-E' for Exif 3.0 metadata specification.
66
#-----------------------------------------------------------------------------------------------------------------------
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[Nemo Action]
2+
#-----------------------------------------------------------------------------------------------------------------------
3+
# A Nemo action file to display GPS location from media file Exif metadata in Waze mapping service.
4+
#
5+
# See 'https://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2023-E' for Exif 3.0 metadata specification.
6+
#-----------------------------------------------------------------------------------------------------------------------
7+
# See 'https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action' for a sample of
8+
# Nemo action file with detailed comments.
9+
#-----------------------------------------------------------------------------------------------------------------------
10+
# NOTE on debugging:
11+
#
12+
# Run Nemo in debug mode using with NEMO_DEBUG set to include 'Actions', i.e.:
13+
# $ nemo --quit
14+
# $ NEMO_DEBUG=Actions nemo --debug
15+
#-----------------------------------------------------------------------------------------------------------------------
16+
17+
# Whether this action is active. For troubleshooting.
18+
Active=true
19+
20+
# The name to show in the menu, locale supported with standard desktop spec.
21+
Name[en]=Display GPS position in 'Waze'
22+
Name[ru]=Показать GPS-позицию в сервисе 'Waze'
23+
24+
# Tool tip, locale supported (Appears in the status bar)
25+
Comment[en]=Display GPS position for '%f' in 'Waze' online mapping service
26+
Comment[ru]=Показать GPS-позицию для файла '%f' в онлайн-сервисе 'Waze'
27+
28+
# What to run. Enclose in < > to run an executable that resides in the actions folder.
29+
Exec=<action_scripts/exif_metadata_mapping_waze.bash %F>
30+
31+
# Icon name to use in the menu - must be a theme icon name
32+
Icon-Name=view-pin-symbolic
33+
34+
# What type selection: [s]ingle, [m]ultiple, any, notnone, none (background click), or
35+
# a number representing how many files must be selected to display.
36+
Selection=s
37+
38+
# What mime-types to display on - this is an array, end with a semicolon
39+
Mimetypes=image/jpeg;video/mp4;
40+
41+
# Dependencies - program executables required for this action to work.
42+
# This is an array, separate entries with semi-colon, and terminate with a semicolon.
43+
#Dependencies=exiftool;
44+
45+
# Conditions - semicolon-separated array of special conditions
46+
Conditions=exec <action_scripts/exif_metadata_mapping_waze.bash %F --condition>;
47+
48+
# Run in terminal - set to true to execute the Exec line in a spawned terminal window.
49+
#Terminal=false

0 commit comments

Comments
 (0)