通过图片获取gps地理位置

别人说通过一张照片就可以定位你的位置,看来个视频,仔细研究了一下自己的照片没想到真的可以做到,想想真的有点可怕。

如何通过一张照片去定位这张照片的经纬度下面我以我手机中的照片为例。

我们通过python3 去读取照片的信息  下面是我用python3写的代码


import exifread
import re

def imageread():
GPS = {}
date = ''
f = open("E:\\2.jpg",'rb')
imagetext = exifread.process_file(f)
for key in imagetext: #打印键值对
print(key,":",imagetext[key])
print('********************************************************\n********************************************************')
for q in imagetext: #打印该图片的经纬度 以及拍摄的时间
if q == "GPS GPSLongitude":
print("GPS经度 =", imagetext[q],imagetext['GPS GPSLatitudeRef'])
elif q =="GPS GPSLatitude":
print("GPS纬度 =",imagetext[q],imagetext['GPS GPSLongitudeRef'])
elif q =='Image DateTime':
print("拍摄时间 =",imagetext[q])

imageread()

将这个经纬度转化一下。将转换的结果上网查一下。

以上就是通过图片进行的定位的过程。

 
 

 

 

 

posted @ 2018-10-05 20:53  时光凉&春衫薄  阅读(8940)  评论(0编辑  收藏  举报