removed isnan
This commit is contained in:
@@ -27,12 +27,10 @@ local dt = require "darktable"
|
|||||||
dt.configuration.check_version(...,{2,0,1})
|
dt.configuration.check_version(...,{2,0,1})
|
||||||
table = require "table"
|
table = require "table"
|
||||||
|
|
||||||
function isnan(x) return x ~= x end
|
|
||||||
|
|
||||||
local function selectWithGPS()
|
local function selectWithGPS()
|
||||||
local selection = {}
|
local selection = {}
|
||||||
for _,image in ipairs(dt.database) do
|
for _,image in ipairs(dt.database) do
|
||||||
if (not isnan(image.longitude) and not isnan(image.latitude)) then
|
if (image.longitude and image.latitude) then
|
||||||
table.insert(selection,image)
|
table.insert(selection,image)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -42,7 +40,7 @@ end
|
|||||||
local function selectWithoutGPS()
|
local function selectWithoutGPS()
|
||||||
local selection = {}
|
local selection = {}
|
||||||
for _,image in ipairs(dt.database) do
|
for _,image in ipairs(dt.database) do
|
||||||
if (isnan(image.longitude) and isnan(image.latitude)) then
|
if (not image.longitude and not image.latitude) then
|
||||||
table.insert(selection,image)
|
table.insert(selection,image)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ USAGE
|
|||||||
local dt = require "darktable"
|
local dt = require "darktable"
|
||||||
dt.configuration.check_version(...,{2,0,1})
|
dt.configuration.check_version(...,{2,0,1})
|
||||||
|
|
||||||
local function isnan(x) return x ~= x end
|
|
||||||
|
|
||||||
local function spairs(_table, order) -- Code copied from http://stackoverflow.com/questions/15706270/sort-a-table-in-lua
|
local function spairs(_table, order) -- Code copied from http://stackoverflow.com/questions/15706270/sort-a-table-in-lua
|
||||||
-- collect the keys
|
-- collect the keys
|
||||||
local keys = {}
|
local keys = {}
|
||||||
@@ -147,7 +145,7 @@ local function create_kml_file(storage, image_table, extra_data)
|
|||||||
for image,_ in pairs(image_table) do
|
for image,_ in pairs(image_table) do
|
||||||
filename = string.upper(string.gsub(image.filename,"%.", "_"))
|
filename = string.upper(string.gsub(image.filename,"%.", "_"))
|
||||||
|
|
||||||
if ((not isnan(image.longitude) and not isnan(image.latitude)) and
|
if ((image.longitude and image.latitude) and
|
||||||
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
||||||
) then
|
) then
|
||||||
kml_file = kml_file.." <Placemark>\n"
|
kml_file = kml_file.." <Placemark>\n"
|
||||||
@@ -196,7 +194,7 @@ local function create_kml_file(storage, image_table, extra_data)
|
|||||||
kml_file = kml_file.." <coordinates>\n"
|
kml_file = kml_file.." <coordinates>\n"
|
||||||
|
|
||||||
for image,_ in spairs(image_table, function(t,a,b) return t[b] < t[a] end) do
|
for image,_ in spairs(image_table, function(t,a,b) return t[b] < t[a] end) do
|
||||||
if ((not isnan(image.longitude) and not isnan(image.latitude)) and
|
if ((image.longitude and image.latitude) and
|
||||||
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
||||||
) then
|
) then
|
||||||
kml_file = kml_file.." "..string.gsub(tostring(image.longitude),",", ".")..","..string.gsub(tostring(image.latitude),",", ".")..",0\n"
|
kml_file = kml_file.." "..string.gsub(tostring(image.longitude),",", ".")..","..string.gsub(tostring(image.latitude),",", ".")..",0\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user