Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 686081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:59:16+00:00 2026-05-14T01:59:16+00:00

I would like to extract the GPS EXIF tag from pictures using php. I’m

  • 0

I would like to extract the GPS EXIF tag from pictures using php.
I’m using the exif_read_data() that returns a array of all tags + data :

GPS.GPSLatitudeRef: N
GPS.GPSLatitude:Array ( [0] => 46/1 [1] => 5403/100 [2] => 0/1 ) 
GPS.GPSLongitudeRef: E
GPS.GPSLongitude:Array ( [0] => 7/1 [1] => 880/100 [2] => 0/1 ) 
GPS.GPSAltitudeRef: 
GPS.GPSAltitude: 634/1

I don’t know how to interpret 46/1 5403/100 and 0/1 ? 46 might be 46° but what about the rest especially 0/1 ?

angle/1 5403/100 0/1

What is this structure about ?

How to convert them to “standard” ones (like 46°56′48″N 7°26′39″E from wikipedia) ? I would like to pass thoses coordinates to the google maps api to display the pictures positions on a map !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:59:17+00:00Added an answer on May 14, 2026 at 1:59 am

    According to http://en.wikipedia.org/wiki/Geotagging, ( [0] => 46/1 [1] => 5403/100 [2] => 0/1 ) should mean 46/1 degrees, 5403/100 minutes, 0/1 seconds, i.e. 46°54.03′0″N. Normalizing the seconds gives 46°54′1.8″N.

    This code below should work, as long as you don’t get negative coordinates (given that you get N/S and E/W as a separate coordinate, you shouldn’t ever have negative coordinates). Let me know if there is a bug (I don’t have a PHP environment handy at the moment).

    //Pass in GPS.GPSLatitude or GPS.GPSLongitude or something in that format
    function getGps($exifCoord)
    {
      $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
      $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0;
      $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0;
    
      //normalize
      $minutes += 60 * ($degrees - floor($degrees));
      $degrees = floor($degrees);
    
      $seconds += 60 * ($minutes - floor($minutes));
      $minutes = floor($minutes);
    
      //extra normalization, probably not necessary unless you get weird data
      if($seconds >= 60)
      {
        $minutes += floor($seconds/60.0);
        $seconds -= 60*floor($seconds/60.0);
      }
    
      if($minutes >= 60)
      {
        $degrees += floor($minutes/60.0);
        $minutes -= 60*floor($minutes/60.0);
      }
    
      return array('degrees' => $degrees, 'minutes' => $minutes, 'seconds' => $seconds);
    }
    
    function gps2Num($coordPart)
    {
      $parts = explode('/', $coordPart);
    
      if(count($parts) <= 0)// jic
        return 0;
      if(count($parts) == 1)
        return $parts[0];
    
      return floatval($parts[0]) / floatval($parts[1]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to extract the year from the current date using Python. In
I would like to extract from a general HTML page, all the text (displayed
I have a full MS SQL Backup file that I would like to extract
I would like to know if it is possible, To extract the userid from
I would like to sort an array in ascending order using C/C++ . The
I would like to extract portion of a text using a regular expression. So
I would like to extract items from this sample html, more specificly, i would
I would like to extract some lines from a text file, I have started
I would like to extract pdf field names from a locked pdf file. When
I would like to extract two fields from a PNG file. Namely, the geometry

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.