GPS機能が付いているスマホやカメラで写真を撮る時に、GPSを切らずに撮影すると撮影時の位置情報がjpegファイルに記載される。また、GPS情報以外の情報も載ってくるのでみてみる。
今回は、jheadと呼ばれるjpegファイルの情報を表示するコマンドを利用する。
jhead
http://www.sentex.net/~mwandel/jhead/
Exif header 5332 bytes long
Exif section in Motorola order
(dir has 11 entries)
Make = "Sony"
Model = "SO-04E"
Orientation = 1
XResolution = 72/1
YResolution = 72/1
ResolutionUnit = 2
Software = "10.3.1.B.2.42_3_f600"
DateTime = "2015:06:22 23:11:06"
YCbCrPositioning = 1
ExifOffset = 224
Exif Dir:(dir has 24 entries)
ExposureTime = 10/320
FNumber = 24/10
ISOSpeedRatings = 320
ExifVersion = "0220"
DateTimeOriginal = "2015:06:22 23:11:06"
DateTimeDigitized = "2015:06:22 23:11:06"
ComponentsConfiguration = "?"
ShutterSpeedValue = 500/100
ExposureBiasValue = 0/3
MeteringMode = 2
LightSource = 0
Flash = 25
FocalLength = 410/100
FlashPixVersion = "0100"
ColorSpace = 1
ExifImageWidth = 1920
ExifImageLength = 1080
InteroperabilityOffset = 608
Interop Dir:(dir has 2 entries)
InteropIndex = "R98"
InteropVersion = "0100"
CustomRendered = 0
ExposureMode = 0
WhiteBalance = 0
DigitalZoomRatio = 100/100
SceneCaptureType = 3
SubjectDistanceRange = 0
GPS Dir offset = 640
GPS info dir:(dir has 6 entries)
GPSLatitudeRef ="N"
GPSLatitude =34/1, 41/1, 14345/1000, 41/1, 14345/1000, 135/1, 14345/1000, 135/1, 31/1
GPSLongitudeRef ="E"
GPSLongitude =135/1, 31/1, 34651/1000, 31/1, 34651/1000, 14/1, 34651/1000, 14/1, 11/1
GPSTimeStamp =14/1, 11/1, 6/1, 11/1, 6/1, 842019125/976238138, 6/1, 842019125/976238138, 842137600/459011 GPSDateStamp ="2015:06:22"
Continued directory (dir has 7 entries)
Compression = 6
Orientation = 1
XResolution = 72/1
YResolution = 72/1
ResolutionUnit = 2
ThumbnailOffset = 912
ThumbnailLength = 4412
Thumbnail size: 4412 bytes
Approximate quality factor for qtable 0: 93 (scale 14.08, var 1.37)
Approximate quality factor for qtable 1: 93 (scale 14.40, var -2.73)
JPEG image is 1920w * 1080h, 3 color components, 8 bits per sample
File name : /home/marseille/DSC_1260.jpg
File size : 408873 bytes
File date : 2015:06:23 23:34:40
Camera make : Sony
Camera model : SO-04E
Date/Time : 2015:06:22 23:11:06
Resolution : 1920 x 1080
Flash used : Yes (auto)
Focal length : 4.1mm
Exposure time: 0.031 s (1/32)
Aperture : f/2.4
ISO equiv. : 320
Whitebalance : Auto
Metering Mode: center weight
GPS Latitude : N 34d 41m 14.345s
GPS Longitude: E 135d 31m 34.651s
位置情報以外として、カメラのメーカーやモデル、解像度、ファイルサイズ、撮影時間等の情報が取得できる。
また、位置情報として以下の項目から確認できる。
GPSLatitudeRef ="N"
GPSLatitude =34/1, 41/1, 14345/1000, 41/1, 14345/1000, 135/1, 14345/1000, 135/1, 31/1
GPSLongitudeRef ="E"
GPSLongitude =135/1, 31/1, 34651/1000, 31/1, 34651/1000, 14/1, 34651/1000, 14/1, 11/1
GPS Latitude : N 34d 41m 14.345s
GPS Longitude: E 135d 31m 34.651s
Latitude及びLongitudeに関する決まりは以下の通り
GPSLatitude(緯度)
Indicates the latitude. The latitude is expressed as three RATIONAL values giving the degrees, minutes, and seconds, respectively. If latitude is expressed as degrees, minutes and seconds, a typical format would be dd/1,mm/1,ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format would be dd/1,mmmm/100,0/1.
GPSLongitude(経度)
Indicates the longitude. The longitude is expressed as three RATIONAL values giving the degrees, minutes, and seconds, respectively. If longitude is expressed as degrees, minutes and seconds, a typical format would be ddd/1,mm/1,ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format would be ddd/1,mmmm/100,0/1.
参考:http://exif.org/Exif2-2.PDF
googleMapを利用して位置を確認するためには、分・秒を10進数に変換し、度を足す必要がある。
計算式としては、以下の通りとなる。
34+(41/60)+((14345/1000)/3600)
= 34.6873
135+(31/60)+((34651/1000)/3600)
= 135.5263
でてきた値を「,」で連結して入力すればgoogleMap上でマッピングされる。