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

Add GPS/EXIF metadata detection for rough auto-placement using lat/lon, compass, elevation #1024

Open
10 tasks
jywarren opened this issue Sep 12, 2022 · 0 comments
Labels

Comments

@jywarren
Copy link
Member

jywarren commented Sep 12, 2022

#142 introduced this awesome feature, which uses image metadata to try to place images roughly over their real-world positions on the globe. Compass data is also used to try to guess appropriate image rotation.

This section of code in MapKnitter already does this and integrates with this library:

https://github.com/publiclab/mapknitter/blob/f0f2f27ca9c4d3e6c80e2d76b356b950bb1d762f/app/assets/javascripts/mapknitter/Map.js#L215-L309

Some part of this may be complete as of #156, but we just need to fully reproduce the function from MapKnitter's code and make it both a method of the DistortableImage class and a tool that can be used from the menu.

So there are actually a few in-progress attempts here:

The MapKnitter version is very powerful code - it even fetches the known elevation from Google's ElevationService using .getElevationForLocations(), to estimate how far away the ground is by comparing this to the camera's elevation above sea level. This would be super to integrate more into the core of this library!

So there are 5 features. All are "rough" not exact placement, but all are helpful!

  • Find lat/lon and place image there
  • Find angle of rotation (i.e. from compass data) and rotate image accordingly
  • Find camera altitude and scale the image appropriately
  • Use Google's ElevationService using .getElevationForLocations() to estimate ground altitude above sea level and compare to camera altitude above sea level to correctly roughly size image based on "distance from the ground"
  • Recenter map with map.fitBounds() to display the image at center of viewer.

Again, some of this may already be in place as of https://github.com/publiclab/Leaflet.DistortableImage/blob/main/src/edit/getEXIFdata.js

image

Ideally it should be

We had used a crosshairs icon in the past for this tool.

Example images and known expected locations

I think a solution for this is already up at #421 but may need updating/refactoring. Sample images and a sample use case can be found at https://publiclab.org/notes/patcoyle/03-23-2015/using-the-mapknitter-2-image-placement-using-geotagged-images and should lead to placement as shown here:

image

Related code links

Noting related code not only at the PR above (#421) but also at:

@jywarren jywarren changed the title Add GPS/EXIF metadata detection for rough auto-placement using lat/lon and elevation Add GPS/EXIF metadata detection for rough auto-placement using lat/lon, compass, elevation Sep 12, 2022
@jywarren jywarren pinned this issue Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant