Skip to content

make kml_export multi OS #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 15, 2019
Merged

make kml_export multi OS #171

merged 10 commits into from
Apr 15, 2019

Conversation

supertobi
Copy link
Contributor

replaced mkdir, xdg-open, xdg-user-dir

I've coded this without windows for testing.
@wpferguson or @BzKevin could you please test if this works.

replaced mkdir, xdg-open, xdg-user-dir
@BzKevin
Copy link
Contributor

BzKevin commented Feb 25, 2019

I don't use the map feature in dt at all, so I don't really know what exactly this is supposed to do or what I need (aside from ImageMagick) for this to work. If you explain a bit I can try to test sometime this week.

if not df.check_if_bin_exists("mkdir") then
dt.print_error(_("mkdir not found"))
return
end
if not df.check_if_bin_exists("convert") then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance I suspect check_if_bin_exists('convert') will fail on windows. I have always had to put a file chooser in the preferences so the user can point to the program and then perform a dt.preferences.write('executable_paths', 'someprogram', dir) for check_if_bin_exists('someprogram') to work on windows. It seems as though when installing programs on windows they are not automatically visible to dt in the way they are on linux machines.

@wpferguson please correct me if I'm wrong here as I'm not 100% certain. If there is a way around this I would love to know, as I'm currently trying to access dts exiv2 but can't figure out how.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BzKevin sounds reasonable. I'll look into that and a preference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a new version

dt.print_error(_("xdg-user-dir not found"))
return
if dt.configuration.running_os == "windows" then
if not df.check_if_bin_exists("xdg-user-dir") then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my comment above, my experience has been this will fail unless you provide the user a way to specifically define a directory for this and at some point do a dt.preferences.write.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was stupid, the right syntax must be
if dt.configuration.running_os == "linux" then

@supertobi
Copy link
Contributor Author

This script creates an KML file (XML file for google earth) with the selected images. It works only with imagers, that have GPS information.

I blogged some time ago about this script here.
https://dablogter.blogspot.com/2016/03/tutorial-creating-maps-from-geo-tagged.html

kml_export added preference for path to convert as windows programs are not by default in the PATH
the command "convert" is deprecated and replaced by "magick"
kml_export: use more utility functions as suggested by @wpferguson
@supertobi
Copy link
Contributor Author

The next step on my ToDo list is to refactor the preferences.

@wpferguson I had a change to test with Windows and it looks like we have a problem with dsys.launch_default_app(path). launch_default_app() adds double quotes around the filename and that does not work here.
start c:\temp\test.jpg works
start "c:\temp\test.jpg" does not work

@wpferguson
Copy link
Member

I almost pulled that back when I merged video_ffmpeg, because I thought that might happen. I have a fix in mind, so let me code it, test it, and I'll push it in 10 or 12 hours.

@wpferguson
Copy link
Member

Fixed, pushed, and merged.

dsys.launch_default_app(df.sanitize_filename(path))
df.mkdir(df.sanitize_filename(xportDirectory..PS..imageFoldername))
@BzKevin
Copy link
Contributor

BzKevin commented Mar 1, 2019

I can do some testing over the weekend unless @wpferguson feels like doing it sooner. I'll need some files with GPS coordinates though if you can provide some @supertobi

@supertobi
Copy link
Contributor Author

@BzKevin Thanks, I'll add some example images and my last version tomorrow.

@supertobi
Copy link
Contributor Author

@BzKevin
Copy link
Contributor

BzKevin commented Mar 3, 2019

Ok. I tested it. There is a small error I noted up already (an 'e' missing from line 103). It appears to work, however, there may be an issue. I am to unfamiliar to know. I opened the exported kml in Google Earth and the images thumbnails show up properly. However, when I click on an image I don't get a larger view, just a '?'

kmlexport example

@supertobi
Copy link
Contributor Author

@BzKevin I fixed the bug you fund and now I think it works on Windows. (If PR #184 and #185 are merged.) Next step is to test if I it still works on Linux.

@supertobi supertobi merged commit eeaa6b4 into master Apr 15, 2019
@supertobi supertobi deleted the supertobi-patch-1 branch April 15, 2019 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants