StreetComplete icon indicating copy to clipboard operation
StreetComplete copied to clipboard

Notes with pictures -preserve compass direction (and coordinates) in EXIF

Open mnalis opened this issue 3 years ago • 12 comments

Use case Many mobile devices when taking pictures store GPS coordinates as well as compass orientation in EXIF tags of JPEG picture. That information in geotagged photos is useful for mappers, and should be preserved (currently in v31.3, pictures are resized and all EXIF information is stripped before they're uploaded to StreetComplete servers).

Proposed Solution As noted in https://github.com/streetcomplete/StreetComplete/issues/2871#issuecomment-839745472 it would be useful if StreetComplete would preserve Compass direction (as well as GPS lat/lon) in EXIF of JPEG pictures when uploading them to server.

mnalis avatar May 13 '21 11:05 mnalis

GPS position should still be stripped, but compass direction would be ok

westnordost avatar May 13 '21 11:05 westnordost

Out of interest, why do you think the GPS position should be stripped? I can only think of "privacy" argument, but since that photo is linked with OSM Note that contains that same GPS position, I do not think it would accomplish anything privacy-wise.

The reason why I think both should be present is that I am not sure if most apps handling geotagged-enabled photos (like JOSM etc) would work correctly if only direction EXIF tag is included, but lat/lon are not.

mnalis avatar May 13 '21 13:05 mnalis

Yes, privacy. Yes, the photo is linked to the note, but the implicit position is thus only known in conjunction with the note. I think privacy wise, that is a little bit better

westnordost avatar May 13 '21 15:05 westnordost

And actually, maybe better than EXIF data for rotation, it would be better to render a little compass on top of that photo

westnordost avatar May 13 '21 15:05 westnordost

And actually, maybe better than EXIF data for rotation, it would be better to render a little compass on top of that photo

or maybe both could be done (EXIF + compass overlay)?

I agree that compass overlay might help users who are using tools which are not capable of parsing EXIF tags, but the need for mental reorienting "in which direction is picture pointing " is probably much more taxing for user than JOSM doing it by automatically. Also, compass might possibly might cover useful part of the picture (probably wont in majority of cases, though)

As for the privacy, I still think the privacy gains are negligible - it's like if the OSM Notes on the map didn't show OSM username, but instead shows numeric user id, and than you had separate file which linked usernames to ids. It just adds a lot of hassle to users, without really improving privacy at all. (But if you feel strongly about it, sure, even just EXIF direction is better than nothing)

mnalis avatar May 14 '21 14:05 mnalis

It is possible to crawl the images uploaded on westnordost.de because they are just numbered in ascending order.

Crawling notes+photos is much more difficult

westnordost avatar May 15 '21 12:05 westnordost

It is trivial to download all notes (including all links to images). Even if images on westnorost.de had random names, it would not really improve the privacy situation. Eg.:

curl -s https://planet.openstreetmap.org/notes/planet-notes-latest.osn.bz2 | bzip2 -dc |  fgrep westnordost.de/p/

If fact, that is what I'm already doing on https://my-notes.osm-hr.org/ (for a different purpose, though).

(Not that there should have been much expectation on privacy in the first place, when one is willingly uploading public georeferenced notes with images for everyone to see). Also, images are usually short lived on westnordost.de, so it even reduces the time they're available (as opposed to OSM Notes coordinates, which remain there forever).

mnalis avatar May 15 '21 12:05 mnalis

Maybe a minimap could also be rendered. I think this would be easier to understand the compass orientation and then you got also some privacy unproblematic information about the position.

tiptoptom avatar May 19 '21 10:05 tiptoptom

You could leave a setting where the user can choose whether to leave the compass, co-ordinates or both intact in the metadata, which would perhaps reduce privacy concerns, since people would be choosing to enable it. One could even allow for changes on a note-by-note basis.

10992-osm avatar Jun 29 '21 21:06 10992-osm

choose whether to leave the compass, co-ordinates or both intact […] on a note-by-note basis.

This would go nicely with https://github.com/streetcomplete/StreetComplete/issues/2497 — those options could be shown on the preview screen.

smichel17 avatar Jun 29 '21 22:06 smichel17

Agree, would like to include exif stuff in the pics :)

carstenhag avatar Aug 11 '21 19:08 carstenhag

At some point I've written a script to fetch my images and geotag them - https://github.com/mnalis/sc-notes-images so I could easily use it in JOSM.

However it would still be nicer if that were to happen automatically.... but even if not (due to mentioned privacy fears), at least adding/preserving EXIF compass direction in pictures taken by SC would be useful (and not privacy-problematic).

mnalis avatar Sep 17 '22 01:09 mnalis

Implemented because it is just a few lines of code. However, I wasn't able to test it because my smartphone doesn't seem to specify the GPSImgDirection exif attribute when taking a photo.

westnordost avatar Jan 10 '23 15:01 westnordost

Yeah, this does not seem to be enough. I've tried with few different phones (e.g. https://www.openstreetmap.org/note/3516481) and I always get Orientation: Unknown (0). Did anyone have better luck?

mnalis avatar Jan 27 '23 03:01 mnalis

I think SC should read the direction sensor itself, and then record that data in Orientation EXIF field, then it should work

mnalis avatar Jan 27 '23 04:01 mnalis

Not possible, as SC does not take the photo itself but lets the camera app do that. It is the camera app which needs to fill in this EXIF field value.

westnordost avatar Jan 27 '23 12:01 westnordost

For the parties interested, this works quite nicely in the end if one puts some effort into setup! So, I though I'd add instructions for those not wanting to experience the joy of experimenting on their own :smile: :

  • One first needs camera app which saves direction. I've tried with OpenCamera and it works (my stock EMUI12 camera and several others that I tried didn't)
  • then one should enable the EXIF functionality in that camera app (for OpenCamera, go to settings / Location settings and turn on all of them)
  • StreetComplete always uses Android default camera, so you need to change that in your Android settings. For EMU12, that: is pull down from top of the screen to open drawer / :gear: / Apps / Default apps / More defaults / Camera and select OpenCamera.
  • now you should be ready - go around, and with StreetComplete (or SCEE) take Notes with pictures as usual (you'll notice it uses your new default camera app). The pictures will now have GPS Direction tags included in their EXIF header.

You can use them as-is by e.g. loading .jpg files in JOSM, but it will only show azimuth angle overlayed on picture and you'll have to orient that in your head.

Much more user-friendly way however is to add (or retain) GPS location back to the picture:

  • You could use this script https://github.com/mnalis/sc-notes-images to simply & automatically re-add GPS location (from Notes location opened by your OSM username or area) to .jpg files in your notes.
  • or, you could use some other method for geotagging JPG file - see https://wiki.openstreetmap.org/wiki/Geotagging_Source_Photos
  • or, you may use SCEE fork for taking notes, as it allows (in Setting / Notes / Get full size photos) to download unredacted .jpg files which contain GPS location too (with additional bonus of not needing to use extra Internet, and getting full-size instead of quality-reduced pictures. It also allows for taking of local notes/pictures if you don't want to upload them publicly)

If you do that, then JOSM will show a nice icon at correct location with direction arrow, which is much easier to use:

exif_direction

mnalis avatar Jun 11 '23 13:06 mnalis