gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

Obtain GPS data from camera

Open dufd2304 opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Using libgphoto2 module / gphoto cli for astrophotography. Works beautifully overall; some instability related to bulb mode with random failed captures but minimally problematic. Many models of camera include an internal GPS or have capacity for an external GPS module, geotagging pictures in the EXIF data. GPS data is quite useful in astrophotography, telling a computerized mount where to expect certain features of the sky at a given date/time.

Describe the solution you'd like CLI option to obtain the stored GPS location from the camera (I personally use a Nikon D5300 which has an internal GPS)

Describe alternatives you've considered Having a routine set upon connecting the USB cable to the camera, based on device USB ID, to trigger a capture-and-download, then use a few routines serially to extract GPS location from the stored EXIF data, thereafter updating the location in kstars (or other similar application) and deleting the captured image. Requires the camera to be open a certain amount of time prior to plugging in the USB cable to acquire satellite data, whereas a gphoto command could be called upon whenever starting INDI server (usually way after first connecting all cables)

Additional context Add any other context or screenshots about the feature request here.

dufd2304 avatar Feb 07 '21 05:02 dufd2304

you could write a small shellscript with gphoto2 and exif , eg. like:

gphoto2 --capture-image-and-download exif|grep GPS ...

msmeissn avatar Feb 07 '21 08:02 msmeissn

That is likely the avenue I'll be taking at the moment. Being able to obtain the data directly would be preferable eventually, as this shortcut has the side effect of increasing shutter count every time, although +1 shutter count per imaging session is a negligible increase, and EKOS, using the libgphoto2 libs to query/modify dSLR settings, would have access to the data directly (at least I can now have dSLR > RPi > telescope mount time/date sync once the D5300 is connected, with accurate time from the GPS instead of the no RTC from the RPi or somewhat inaccurate time from the mount due to old or cold RTC battery).

More importantly, it requires processes to happen in a specific order, ie: once EKOS is running, it connects to the camera which therefore is unavailable to the gphoto2 shell command. If the shell script is called before the camera is connected, nothing happens. A script called upon USB connect would require the connection to happen while the Pi is powered up, but a boot script would require the dSLR to be already connected at boot. I guess the proper way to do it at the moment would be to modify the kstars launch script for EKOS to first call up gphoto2 to acquire a capture, then pipeline the gps data from exif to the dummy gps file, then start EKOS (not that good in coding yet), or to write a script that calls up this function and kstars simultaneously (usually kstars is started using Remote Desktop/VNC once everything is set up outside), but that would be awfully specific to my work process.

Another way would be to turn on the gps logging function of D5300 (dunno if gphoto2 can modify that setting value, I don't think so), mount the D5300 as a drive, poll the last line from the track/log file and pipe the output to the GPS dummy file. Benefit: no shutter use/delay/download time. Downside: more commands, the possibility of the random unresponsive state from the dSLR which has happens to me once in a while when going from one type of connection to the PC to another (ie: mounted drive to unmounted drive, or drive to camera), which in the past required has required a cold reset - unplugging USB, removing battery, then replugging everything. At -20 outside at night right now, that's a really cold reset.

dufd2304 avatar Feb 15 '21 04:02 dufd2304

The trail of this ticket goes cold in 2021. Any follow-up? Is this a feature request then ?

luzpaz avatar Jul 11 '23 12:07 luzpaz