Best way to show my all photos on map offline

This post is not really about the OSM itself.

I take a lot of photos, thousands a year. I think it may be a good idea to show them all on the map by EXIF GPS position, but I can’t figure out a good way to do so.

My first idea is to create a KML or GPX file containing File-URI, and import the file into OSMAnd or Organic Map.

My script to extract all gps data as tsv:
(it still needs some work to convert tsv to gpx)

find -type f -name '*.jpg' \
| xargs -n 30 sh -c 'convert "$@" -format \
  "%f; %[exif:GPSLatitude]; %[exif:GPSLongitude]\n" info:' \
| awk -F '; |, |/' '
BEGIN { d = "/sdcard/DCIM/Camera" }
(NF>3) {
printf "%s/%s\t%.9f\t%.9f\n", d, $1, \
$8/$9+ (($(10)/$(11)) + ($(12)/$(13)/60))/60, $2/$3+ (($4/$5) + ($6/$7/60))/60
}
(NF<=3){printf "%s/%s\n", d, $1}'

Then in the apps there will be a kind of POI on map. If I expand one POI, I can click the link in the POI’s detail to show the photo.

However, both OSMAnd and Organic Map can not show <link> tag in GPX properly.

My last idea is to create a cordova app and render them as pins on the maps.

Any good ideas?

offline android gpx

1 Like

I don’t have an Android phone, but what about https://play.google.com/store/apps/details?id=com.bal.jt.picturemap&hl=en_US ?
Does that not exactly do what you want?

1 Like

Thanks, but these kind of apps does not work fine if I have too many photos.

The http://vespucci.io/ can do this too, but It takes about a 30 seconds to load 1 year of photos, and I have many years of photos.

Therefore I prefer the gpx way; read one gpx file is much easier than read thousands of image file, and read a lot files is very slow in modern android devices.

This app does not work for me. I will try some other play store app.

Update

Photos Map: crash after 5 minutes scanning
Photo Map Viewer: keep flashing and not usable

<sarcasm>
The iOS Photos map view works nicely with nearly 70‘000 photos over a bit more than 20 years ;)
</sarcasm>

2 Likes

For an overview see:

Is this way you are searching for:

Github page says the project is dead, due to changes in Android.

I’ve been using Aves Lbre for a little while, with just a bit more than a thousand photos, it’s really smooth.

I don’t have tens of thousands of photos to test, but I think it’s worth a try !

I have imported GPX files with <link> tags before into OSMAnd without issue.
An example point in such a file:

  <wpt lat="56.24527000" lon="12.85484100">
    <name>Ängelholm</name>
    <desc>...</desc>
    <link href="https://www.skaneleden.se/plats/angelholm"></link>
    <type>water</type>
    <extensions>
      <color>#001eff</color>
      <icon>amenity_drinking_water</icon>
    </extensions>
  </wpt>

So maybe you need to put the link in the href instead of between the <link> tags.

P.S. The icon names can be found as the file names in this folder

2 Likes

I figure out that I have to choose import as GPX rather than import to favorite.

Only in gpx format, the file-uri image show up properly in the detail fields, like <link href="file:///sdcard/..."> .

Android apply a linux-fuse layer to restrict app’s permission in sdcard these years, so file read and write become incredible slow, especially for a large numbers of file.

Apps like SyncThing become hardly usable now.

If your system has perl, you may want to try exiftool. It can write GPX. I changed the supplied format template gpx.fmt a bit:

#[IF]  $gpslatitude $gpslongitude
#[BODY]  <wpt lat="$gpslatitude#" lon="$gpslongitude#">
#[BODY]    <ele>$gpsaltitude#</ele>
#[BODY]    <name>$filename#</name>
#[BODY]    <time>${datetimeoriginal#;my ($ss)=/\.\d+/g;DateFmt("%Y-%m-%dT%H:%M:%SZ");s/Z/${ss}Z/ if $ss}</time>
#[BODY]  </wpt>

Now on to try with comaps. Looking forward to have this working. Cool tip! Samsung maps has this built in. Wanted that long since.

1 Like

Does it have to work on your Phone?
DigiKam for linux does exactly this, with my 700000 photos taken over 24 years (although half of that without geo information)

2 Likes

Could you use Immich to manage your photos? Demo: https://demo.immich.app/map#0.07/0/0

This is naturally not the intended purpose of the app, and it doesn’t “load” photos in the way you are implying. It maintains an internal database with meta information (mainly URI, location and cardinal direction) from the images, and on app start will build an in memory R-Tree containing the meta information so that it can efficiently render markers for the image.

What you might be seeing is that the app scans the relevant directories and Androids mediastore for new images on startup so that it can add them to above mentioned index, this will take a bit and the markers are rendered once this is done, this isn’t really an issue for the intended purpose of the app, but I would run this in parallel if the primary purpose was a gallery app.

1 Like

awk script to generate xml with pyx format.

awk '
BEGIN {
    uri_fmt = "file:///sdcard/DCIM/2025/%s"
    print "(gpx"
    print "Aversion", "1.1"
    print "Axmlns", "http://www.topografix.com/GPX/1/1" 
}
{
    path = $1
    f=$1
    sub(/^.*\//, "", f)
}
(NF == 3) {
    print "(wpt"
    print "Alon", $2
    print "Alat", $3
    print "(name"
    print "-" path
    print ")name"
    print "(link"
    print "Ahref", sprintf(uri_fmt, path)
    print ")link"
    print ")wpt"
}
END {
    print ")gpx"
}
' | xmlstarlet p2x

@IIVQ @fjordaan2021 thank you for your desktop softwares recommendation!
but I am not going to host a NAS or use a professional software.

@SimonPoole I know the app does not load the photos themself,
and I think MediaStore stored photos’ metadata like exif.
thank for your explainaion!

My script to generate GPX