@@ -94,7 +94,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
94
94
95
95
dt .print_error (" Will try to export geoJSON file now" )
96
96
97
- local xportDirectory = dt .preferences .read (" geoJSON_export" ," ExportDirectory" ," string" )
97
+ local exportDirectory = dt .preferences .read (" geoJSON_export" ," ExportDirectory" ," string" )
98
98
99
99
-- Creates dir if not exsists
100
100
local imageFoldername = " files/"
@@ -106,8 +106,8 @@ local function create_geoJSON_file(storage, image_table, extra_data)
106
106
if ((image .longitude and image .latitude ) and
107
107
(image .longitude ~= 0 and image .latitude ~= 90 ) -- Sometimes the north-pole but most likely just wrong data
108
108
) then
109
- local path , filename , filetype = string.match (image , " (.-)([^\\ /]-%.?([^%.\\ /]*))$" )
110
- filename = string.upper (string.gsub (filename ," %." , " _ " ))
109
+ local path , filename , filetype = string.match (exported_image , " (.-)([^\\ /]-%.?([^%.\\ /]*))$" )
110
+ filename = string.upper (string.gsub (filename ," %.%w* " , " " ))
111
111
112
112
-- convert -size 92x92 filename.jpg -resize 92x92 +profile "*" thumbnail.jpg
113
113
-- In this example, '-size 120x120' gives a hint to the JPEG decoder that the image is going to be downscaled to
@@ -123,7 +123,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
123
123
end
124
124
125
125
-- delete the original image to not get into the kmz file
126
- os.remove (image )
126
+ os.remove (exported_image )
127
127
128
128
local pattern = " [/]?([^/]+)$"
129
129
filmName = string.match (image .film .path , pattern )
@@ -140,11 +140,24 @@ local function create_geoJSON_file(storage, image_table, extra_data)
140
140
]]
141
141
142
142
for image ,exported_image in pairs (image_table ) do
143
- filename = string.upper (string.gsub (image .filename ," %." , " _" ))
143
+ -- filename = string.upper(string.gsub(image.filename,"%.", "_"))
144
+ -- Extract filename, e.g DSC9784.ARW -> DSC9784
145
+ filename = string.upper (string.gsub (image .filename ," %.%w*" , " " ))
146
+ -- Extract extension from exported image (user can choose JPG or PNG), e.g DSC9784.JPG -> .JPG
147
+ extension = string.match (exported_image ," %.%w*$" )
144
148
145
149
if ((image .longitude and image .latitude ) and
146
150
(image .longitude ~= 0 and image .latitude ~= 90 ) -- Sometimes the north-pole but most likely just wrong data
147
151
) then
152
+
153
+ local image_title , image_description
154
+ if (image .title and image .title ~= " " ) then
155
+ image_title = image .title
156
+ else
157
+ image_title = image .filename
158
+ end
159
+ image_description = image .description
160
+
148
161
geoJSON_file = geoJSON_file ..
149
162
[[ {
150
163
"type": "Feature",
@@ -155,8 +168,8 @@ local function create_geoJSON_file(storage, image_table, extra_data)
155
168
geoJSON_file = geoJSON_file ..
156
169
[[ },
157
170
"properties": {
158
- "title": "]] .. image . title .. [[ ",
159
- "description": "]] .. image . description .. [[ ",
171
+ "title": "]] .. image_title .. [[ ",
172
+ "description": "]] .. image_description .. [[ ",
160
173
"image": "]] .. imageFoldername .. filename .. [[ .jpg",
161
174
"icon": {
162
175
"iconUrl": "]] .. imageFoldername .. " thumb_" .. filename .. [[ .jpg",
@@ -187,7 +200,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
187
200
<html>
188
201
<head>
189
202
<meta charset=utf-8 />
190
- <title>2014-05-31 Rieselfelder </title>
203
+ <title>]] .. filmName .. [[ </title>
191
204
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.2.4/mapbox.js'></script>
192
205
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.2.4/mapbox.css' rel='stylesheet' />
193
206
<style>
0 commit comments