Skip to content
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

Extract and store GPS data #2

Closed
hermzz opened this issue Dec 2, 2018 · 6 comments
Closed

Extract and store GPS data #2

hermzz opened this issue Dec 2, 2018 · 6 comments
Labels
good first issue Good for newcomers

Comments

@hermzz
Copy link
Contributor

hermzz commented Dec 2, 2018

I'd like to be able to display GPS data along with the rest of the photo info. It looks like there's already some code to extract the GPS data from the EXIF tags in app/Photo.php but it isn't stored or displayed anywhere (as far as I can see).

Ideally I'd like to store Longitude, Latitude, Elevation, and a textual description (eg: London, UK).

The question is, how do store the longitude/latitude? Both MySQL and MariaDB have geospatial fields in their newer versions (MySQL 8+ and MariaDB 10.2+ at least) and from a bit of quick research those seems like fairly extended releases (the LTS for both is 8.0 and 10.3 respectively). AWS provides both of those versions and so does Homestead.

Alternatively, we could store all them as DECIMAL values, but this comes with the downside of not being able to use all the fancy geospatial query functionality, like being able to find all photos within a specific range. At least not without using a third-party search engine like ElasticSearch or Lucene.

A final and more aggressive alternative (and perhaps an idea for another day) is to move all photo metadata to a JSON format and use the builtin MySQL/MariaDB JSON functions to process the data. This would provide the flexibility in the future to add metadata without creating additional fields in the photos table.

@ildyria
Copy link
Member

ildyria commented Dec 3, 2018

I'd like to be able to display GPS data along with the rest of the photo info. It looks like there's already some code to extract the GPS data from the EXIF tags in app/Photo.php but it isn't stored or displayed anywhere (as far as I can see).

Ideally I'd like to store Longitude, Latitude, Elevation, and a textual description (eg: London, UK).

Indeed this is not saved... We can easily make a migration to add the required column and save the desired data.

About the geospacial fields, I had a quick look.
https://medium.com/@brice_hartmann/getting-started-with-geospatial-data-in-laravel-94502dc74d55
My problem is that we lose the support of Postgresql. Laravel is database agnostic (in our case). using Geometry / multi polygons in that link forces the user to use MySQL and would annoy those: #46

I agree that using decimal would be a solution.

As for the JSON part, it is possible with Laravel: https://www.qcode.in/use-mysql-json-field-in-laravel/
I don't have a strong opinion in this case but I am a bit annoyed to lose the direct access to the attributes via the model and save(). Using JSON introduces a slight overhead but I guess it is fine.

It also seems to me that Lucene can be easily included: https://packagist.org/packages/nqxcode/laravel-lucene-search :)

@hermzz
Copy link
Contributor Author

hermzz commented Dec 4, 2018

All good points. PostgreSQL has had geospatial support for a while now as an extension and apparently so does SQLite. However, I haven't been able to find a library that supports all of them, at best only MySQL and PostgreSQL and it'd still be a bit iffy because it'd require people to install extra stuff.

The JSON handling is already builtin to Eloquent it seems but after thinking about it you're right, it's a bit of overkill right now. I'll stick to the basic DECIMAL fields and if at some point in the future it makes sense to move the metadata to another format we can tackle the issue then.

@ildyria
Copy link
Member

ildyria commented Dec 5, 2018

@hermzz you will need to update Photo::prepareData() so that Lychee-front can see it.
Also you might want to make the sidebar.js aware of those coordinates (when available).
Thanks for the PR.

@anthosz
Copy link

anthosz commented Jul 13, 2019

Hi,

Any news concerning this request?

Probably you can use https://fr.piwigo.org/ext/extension_view.php?eid=122 by example so that you extract Exif GPS data & maybe add a map..

@ildyria
Copy link
Member

ildyria commented Jul 15, 2019

@hermzz was working on it. We haven't heard from him for a while unfortunately.

@tmp-hallenser
Copy link
Contributor

#359 and #339 should have implemented the above mentioned features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants