Add EXIF photo importer - #72
Open
Shup04 wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Temporary-file ownership and below-sea-level altitude handling can produce failed imports or incorrect metadata.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an EXIF-based importer for geotagged JPEGs and JPEG archives.
Changes:
- Imports GPS points and photo metadata.
- Supports ZIP extraction, warnings, cache keys, and image attachments.
- Adds EXIFR and importer specs.
File summaries
| File | Description |
|---|---|
lib/spatial_features/importers/exif_photo.rb |
Implements EXIF photo importing. |
lib/spatial_features.rb |
Registers the importer. |
spatial_features.gemspec |
Adds EXIFR dependency. |
spec/lib/spatial_features/importers/exif_photo_spec.rb |
Tests importer behavior. |
Review details
- Files reviewed: 4/6 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| def self.create_all(data, **options) | ||
| Download.open_each(data, unzip: JPEG_PATTERN, tmpdir: options[:tmpdir]).map do |file| | ||
| new(file.path, **options) |
Author
There was a problem hiding this comment.
Fixed by staging JPEGS before storing their paths. Added regression tests and tested on the site itself too.
Comment on lines
+53
to
+59
| def metadata_from(photo, gps) | ||
| { | ||
| 'capture_time' => photo.date_time_original&.strftime('%Y-%m-%d %H:%M:%S'), | ||
| 'altitude' => gps.altitude&.to_s, | ||
| 'camera_model' => photo.model.presence | ||
| }.compact | ||
| end |
Author
There was a problem hiding this comment.
I checked EXIFR, and tested with a negative altitude image and it works fine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
SpatialFeatures::Importers::ExifPhotofor importing geotagged JPEGs as point features.The importer:
importable_image_paths.ImportErrorpath.Testing
Uses the real Nikon D7500 sample photos from the issue, including the five-photo ZIP.
The sample archive is approximately 42 MB and is included because the issue calls for fixtures produced by the real camera
rather than imitated files.
Follow-up
This PR only adds the importer to
spatial_features. ThePhotoMapLayer, uploader allowlists, attachment wiring,permissions, and popup will be implemented in the application repository.
Part of: https://github.com/culturecode/stolo_connect/issues/2025