•  » Extensions
  •  » Get gps data from file to OSM plugin

#1 2019-02-11 21:10:09


Get gps data from file to OSM plugin


I bought a gps receiver for my camera only a short time ago and used it the first time a few days ago for a series of around 120 photos. The gps data are in the exif data of each file; exif (from exiftools) can „see“ them. The OSM plugin cannot. The files are in Piwigo's batch manager and additionally in an internal album I use for uploads.

System: Debian GNU/Linux 9 (Stretch) with nginx/1.10.3, PHP 7.0 (php7.0-fpm);
mysql: MariaDB Ver 15.1 Distrib 10.3.12-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
current version of Piwigo 2.9.4;
Plugins: OSM, Photo Update, (later) Exiftools GPS (and others that do not matter here);

Piwigo URL:
– Attn: the already gps tagged photos that can be seen publicly have been tagged manually using the OSM plugin.
Only this album contains photos with gps data in the exif:
(No. 1 - 3 without gps receiver; No. 4 with manually set gps data)

Camera: Canon EOS 750D with gps receiver Canon GP-E2

What I already tried:

* installed Exiftools GPS (nothing happenend);

* updated one of the photos using the Photo Update plugin after installation of Exiftools GPS with the idea that the gps data might only get read in the upload process, but it did not help;

* tried to upload one of the photos again, but the photo_add got stuck for an unknown reason;

* tried synchronizing the meta data, but it said it processed 0 photos (dry mode and real mode) and – changed nothing.

This is what /tools/metadata.php shows:


    [FileName] => sample.jpg
    [FileDateTime] => 1549748832
    [FileSize] => 193818
    [FileType] => 2
    [MimeType] => image/jpeg
    [SectionsFound] => ANY_TAG, IFD0, EXIF, MAKERNOTE
    [COMPUTED] => Array
            [html] => width="1200" height="800"
            [Height] => 800
            [Width] => 1200
            [IsColor] => 1
            [ByteOrderMotorola] => 0
            [ApertureFNumber] => f/10.0
            [Copyright] => CC-BY-NC-SA

    [Make] => Canon
    [Model] => Canon EOS 750D
    [Orientation] => 1
    [XResolution] => 72/1
    [YResolution] => 72/1
    [ResolutionUnit] => 2
    [DateTime] => 2019:02:09 20:09:09
    [Artist] => Atari-Frosch
    [YCbCrPositioning] => 2
    [Copyright] => CC-BY-NC-SA
    [ExposureTime] => 1/60
    [FNumber] => 10/1
    [ExposureProgram] => 3
    [ISOSpeedRatings] => 100
    [ExifVersion] => 0230
    [DateTimeOriginal] => 2019:02:09 15:41:11
    [DateTimeDigitized] => 2019:02:09 15:41:11
    [ComponentsConfiguration] => 
    [ShutterSpeedValue] => 393216/65536
    [ApertureValue] => 434176/65536
    [ExposureBiasValue] => 0/1
    [MeteringMode] => 5
    [Flash] => 0
    [FocalLength] => 18/1

This is what exif (command line) shows for the same file:


EXIF tags in '20190209-154111_1854.jpg' ('Intel' byte order):
Tag                 |Value
Manufacturer        |Canon
Model               |Canon EOS 750D
Orientation         |Top-left
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Date and Time       |2019:02:09 15:41:11
Artist              |Atari-Frosch
YCbCr Positioning   |Co-sited
Copyright           |CC-BY-NC-SA (Photographer) - [None] (Editor)
Compression         |JPEG compression
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Exposure Time       |1/60 sec.
F-Number            |f/10.0
Exposure Program    |Aperture priority
ISO Speed Ratings   |100
Exif Version        |Exif Version 2.3
Date and Time (Origi|2019:02:09 15:41:11
Date and Time (Digit|2019:02:09 15:41:11
Components Configura|Y Cb Cr -
Shutter Speed       |6.00 EV (1/64 sec.)
Aperture            |6.62 EV (f/9.9)
Exposure Bias       |0.00 EV
Metering Mode       |Pattern
Flash               |Flash did not fire
Focal Length        |18.0 mm
Maker Note          |8634 bytes undefined data
User Comment        |
Sub-second Time     |75
Sub-second Time (Ori|75
Sub-second Time (Dig|75
FlashPixVersion     |FlashPix Version 1.0
Color Space         |sRGB
Pixel X Dimension   |6000
Pixel Y Dimension   |4000
Focal Plane X-Resolu|6718.925
Focal Plane Y-Resolu|6734.007
Focal Plane Resoluti|Inch
Custom Rendered     |Normal process
Exposure Mode       |Auto exposure
White Balance       |Manual white balance
Scene Capture Type  |Standard
GPS Tag Version     |
North or South Latit|N
Latitude            |51, 11.9230,  0
East or West Longitu|E
Longitude           | 6, 50.3127,  0
Altitude Reference  |Sea level
Altitude            |62.2
GPS Time (Atomic Clo|13:40:41.01
GPS Satellites      |12
GPS Receiver Status |A
GPS Measurement Mode|3
Measurement Precisio|3.0
Geodetic Survey Data|WGS-84
GPS Date            |2019:02:09
Interoperability Ind|R98
Interoperability Ver|0100
EXIF data contains a thumbnail (13448 bytes).

I took the exif output from my home system, not from the server with the Piwigo installation, because on the server the output is in German, but it contains the same data including gps data.

nginx gave me the following messages in the error.log when I tried to sync the metadata:

2019/02/11 19:51:31 [error] 13266#13266: *755283 FastCGI sent in stderr: "PHP message: PHP Warning:  Invalid argument supplied for for each() in /srv/atarifrosch-media/plugins/exiftool_gps/ on line 23" while reading response header from upstream, client: […], server:, request: "GET /admin.php?page=photo-15248-properties&sync_metadata=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "", referrer: ""

Additionally it gave this message when checking the sample.jpg:

2019/02/11 20:31:56 [error] 13266#13266: *755668 FastCGI sent in stderr: "PHP message: PHP Warning:  read_exif_data(sample.jpg): IFD data bad offset: 0xFFFFFD3C length 0x21A2 in /srv/atarifrosch-media/tools/metadata.php on line 93" while reading response header from upstream, client: […], server:, request: "GET /tools/metadata.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: ""

So, how can I get the gps data from the files into the database so that the OSM plugin can make use of them?



#2 2019-03-02 11:15:55


Re: Get gps data from file to OSM plugin

I believe there is something wrong with your metadata.  I don't know what, but if you strip out the none gps data, the photo loads fine in PIWIGO, with the photo placed correctly on a map.

I'm using Ubuntu 18.1

exiftool -*= -tagsfromfile @ -gps:* /{pathtofile}/20190209-130541_17572.jpg

This strips out the none GPS data.
The modified photo and it's location can be seen here. … 69&map




#3 2019-03-02 18:37:05

Only trying to help

Re: Get gps data from file to OSM plugin

Might be the PHP bug with makernote data, try with
[extension by ramack] Exiftool GPS or
[extension by ZeBe] ImageMagick GPS

Running Piwigo at


  •  » Extensions
  •  » Get gps data from file to OSM plugin

Board footer

Powered by FluxBB

github twitter newsletter Donate © 2002-2023 · Contact