GEOTAGS 


EXIF apg

SUBSET of the EXIF standard responsible for storing in latitude, longitude, barometric pressure and altitude parameters of the location where a photo was taken.

Geotagging can tell users the location of the content of a given picture or other media or the point of view, and conversely on some media platforms show media relevant to a given location.

The related term geocoding refers to the process of taking non-coordinate based geographical identifiers, such as a street address, and finding associated geographic coordinates, (or vice versa for reverse geocoding).

Such techniques can be used together with geotagging to provide alternative search techniques.



  1 EXERCISE   

<?php

$img 
= "E 01 Ipojuca-PE (BRASIL).jpg";
$img_file = 'img/' . $img;

/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

   Copyright: zero fernandes
              https://ed48.com/
              
   USO LIVRE
     Distribuido apenas com finalidades didáticas,
     sem nenhuma outra atribuição específica.
     
   FREE USE
     Distributed only for educational purposes,
     without any other specific assignment.
 
   - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */

function GetLatitude($imagefile)
{
$StringSep = "/";
$xf_data = exif_read_data($imagefile);
$dgr_lat = $xf_data['GPSLatitude'][0];

if (
strval($dgr_lat == 0))
{
$latitude = "0.000000000000000";
return 
$latitude;
}
else
{

$dgr = explode($StringSep, $dgr_lat);
$lat_dgr = bcdiv($dgr[0], $dgr[1], 10);
$min_lat = $xf_data['GPSLatitude'][1];
$min = explode($StringSep, $min_lat);
$lat_min = bcdiv($min[0], $min[1], 10);
$lat_min = $lat_min/60;
$sec_lat = $xf_data['GPSLatitude'][2];
$sec = explode($StringSep, $sec_lat);
$lat_sec = bcdiv($sec[0], $sec[1], 10);
$lat_sec = $lat_sec/3600; 
$lat_ref = $xf_data['GPSLatitudeRef']; 
if (
$lat_ref == "S")
{
$sig_lat = -1;
}
else
{
$sig_lat = 1;
}
$latitude = $sig_lat * ($lat_dgr + $lat_min + $lat_sec);
return 
$latitude;
}
}

# - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

function GetLongitude($imagefile)
{
$StringSep = "/";
$xf_data = exif_read_data($imagefile);
$dgr_lng = $xf_data['GPSLongitude'][0];

if (
strval($dgr_lng == 0))
{
$latitude = "0.000000000000000";
return 
$latitude;
}
else
{

$dgr = explode($StringSep, $dgr_lng);
$lng_dgr = bcdiv($dgr[0], $dgr[1], 10);
$min_lng = $xf_data['GPSLongitude'][1];
$min = explode($StringSep, $min_lng);
$lng_min = bcdiv($min[0], $min[1], 10);
$lng_min = $lng_min/60;
$sec_lng = $xf_data['GPSLongitude'][2];
$sec = explode($StringSep, $sec_lng);
$lng_sec = bcdiv($sec[0], $sec[1], 10);
$lng_sec = $lng_sec/3600; 
$lng_ref = $xf_data['GPSLongitudeRef']; 
if (
$lng_ref == "W")
{
$sig_lng = -1;
}
else
{
$sig_lng = 1;
}
$longitude = $sig_lng * ($lng_dgr + $lng_min + $lng_sec);
return 
$longitude;
}
}

# - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

echo $img . "<br><br>Ipojuca-PE (BRASIL)<br><br>";
echo 
'<img src="' . 'img/' . $img . '" alt="' . $img . 
'" title="' . $img . '" width="70%"><br><br>';

echo 
'<pre>Latitude = ' . GetLatitude($img_file);
echo 
'<br><br>Longitude = ' . GetLongitude($img_file) . '</pre>';

?>

 RESULT   

E 01 Ipojuca-PE (BRASIL).jpg

Ipojuca-PE (BRASIL)

E 01 Ipojuca-PE (BRASIL).jpg apr

Latitude = -8.4596972222222

Longitude = -34.985438888889


Ipojuca Tour 2019   

This link leads to an application designed to use geotags.