Skip to content

Commit 45009ae

Browse files
authored
Merge pull request darktable-org#68 from wpferguson/clear_gps_data
clear GPS data
2 parents f69455b + 870ba65 commit 45009ae

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

contrib/clear_GPS.lua

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
--[[
2+
3+
clear_GPS.lua - export and edit with GIMP
4+
5+
Copyright (C) 2016 Bill Ferguson <[email protected]>.
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
]]
20+
--[[
21+
clear_GPS - clear GPS data from selected image(s)
22+
23+
This shortcut removes the GPS coordinate data from the selected images.
24+
25+
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
26+
* None
27+
28+
USAGE
29+
* require this script from your main lua file
30+
* select an image or images
31+
* click the shortcut, clear GPS data
32+
33+
BUGS, COMMENTS, SUGGESTIONS
34+
* Send to Bill Ferguson, [email protected]
35+
36+
CHANGES
37+
]]
38+
39+
local dt = require "darktable"
40+
local gettext = dt.gettext
41+
42+
-- not a number
43+
local NaN = 0/0
44+
45+
dt.configuration.check_version(...,{3,0,0})
46+
47+
48+
-- Tell gettext where to find the .mo file translating messages for a particular domain
49+
gettext.bindtextdomain("clear_GPS",dt.configuration.config_dir.."/lua/")
50+
51+
local function _(msgid)
52+
return gettext.dgettext("clear_GPS", msgid)
53+
end
54+
55+
local function clear_GPS(images)
56+
for _, image in ipairs(images) do
57+
-- set the location information to Not a Number (NaN) so it displays correctly
58+
image.elevation = NaN
59+
image.latitude = NaN
60+
image.longitude = NaN
61+
end
62+
end
63+
64+
65+
dt.gui.libs.image.register_action(
66+
_("clear GPS data"),
67+
function(event, images) clear_GPS(images) end,
68+
"clear GPS data"
69+
)
70+
71+
dt.register_event(
72+
"shortcut",
73+
function(event, shortcut) clear_GPS(dt.gui.action_images) end,
74+
"clear GPS data"
75+
)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3+
# This file is distributed under the same license as the PACKAGE package.
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: PACKAGE VERSION\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2016-09-07 22:25-0400\n"
12+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13+
"Last-Translator: Bill Ferguson <[email protected]>\n"
14+
"Language-Team: LANGUAGE <[email protected]>\n"
15+
"Language: \n"
16+
"MIME-Version: 1.0\n"
17+
"Content-Type: text/plain; charset=CHARSET\n"
18+
"Content-Transfer-Encoding: 8bit\n"
19+
"X-Generator: Poedit 1.5.4\n"
20+
"Language: de_DE\n"
21+
"X-Poedit-SourceCharset: UTF-8\n"
22+
"X-Poedit-KeywordsList: gettext;dgettext:2;dcgettext:2ngettext:1,2;"
23+
"dngettext:2,3\n"
24+
"X-Poedit-Basepath: .\n"
25+
26+
#: clear_GPS.lua:62
27+
msgid "clear GPS data"
28+
msgstr "löschen GPS-Daten"

0 commit comments

Comments
 (0)