[GRASS-user] Vector point from EXIF GPS data
Juan Miguel Garijo
saldinet at yahoo.es
Sun May 15 13:31:28 EDT 2011
Hello,
This is my 'amateur' solution:
def getXYfromFoto(foto):
proc=subprocess.Popen('exif -mt GPSLatitude '+foto,
shell=True,stdout=subprocess.PIPE)#foto: is the route to a jpg image from a
camera Sony DSC-HX5V
stdout_value = proc.communicate()[0]
da=stdout_value[0:len(stdout_value)-1]
sp=da.split(', ')
lat=float(sp[0].replace(',','.'))+float(sp[1].replace(',','.'))/60+float(sp[2].replace(',','.')[0:5])/3600
print lat
proc2=subprocess.Popen('exif -mt GPSLongitude '+foto,
shell=True,stdout=subprocess.PIPE)
stdout_value = proc2.communicate()[0]
da2=stdout_value[0:len(stdout_value)-1]
sp2=da2.split(', ')
lon=float(sp2[0].replace(',','.'))+float(sp2[1].replace(',','.'))/60+float(sp2[2].replace(',','.')[0:5])/3600
print lon
proc3=subprocess.Popen('exif -mt GPSLongitudeRef '+foto,
shell=True,stdout=subprocess.PIPE)
stdout_value = proc3.communicate()[0]
da3=stdout_value[0:len(stdout_value)-1]
print da3
if da3[0:1]=='W':
lonLat='"-'+str(lon)+' '+str(lat)+'"'
else:
lonLat='"'+str(lon)+' '+str(lat)+'"'
print lonL #in wgs84
proc4=subprocess.Popen('echo '+lonLat+' | m.proj -i --quiet',
shell=True,stdout=subprocess.PIPE)#GRASS must be running, in my case eur50
datum.
stdout_value = proc4.communicate()[0]
da4=stdout_value[0:len(stdout_value)-1]
print 'da4'
print da4
pse=da4.split(' ')
XY=pse[0].replace('\t',',')
print 'XY'
print XY
return XY# in UTM eu50 30N
hope usefull for you
Juan M. Garijo
________________________________
De: Joshua Arnott <josh at snorfalorpagus.net>
Para: grass-user at lists.osgeo.org
Enviado: sáb,14 mayo, 2011 16:55
Asunto: [GRASS-user] Vector point from EXIF GPS data
Hi everyone,
Has anyone tried to import the GPS data stored in a JPEG's EXIF metadata into
GRASS? I've had some luck, but the system I've come up with is very clunky
(mixture of python pexif module and then m.proj to assist import). I'm wondering
if anyone has come across anything more robust, maybe as a shell script with
jhead?
Josh.
_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110515/f2314bec/attachment.html
More information about the grass-user
mailing list