sugestion,create an tag that returns the gps geocode itself,not string
i've made an function thar convert the parameters ("GPS GPSLatitude" and "GPS GPSLatitudeRef") or ("GPS GPSLongitude" and "GPS GPSLongitudeRef") to an float value usable into google mpas api or other gps functions
def convertMetaInCood(gps, quadrante): cood = {} regexHour = re.compile(r"\[(\d+)\,") regexMinute = re.compile(r"\, (\d+)\,") regexSecond = re.compile(r"\,\ (\d+)\/") regexSecondDivisor = re.compile(r"\/(\d+)\]") cood["hour"] = re.findall(regexHour, str(gps))[0] cood["minute"] = re.findall(regexMinute, str(gps))[0] cood["second"] = re.findall(regexSecond, str(gps))[0] cood["secondDivisor"] = re.findall(regexSecondDivisor, str(gps))[0] cood["total"] = float(int(cood["hour"]) + ( (int(cood["minute"]) * 60) + (int(cood["second"])) / int(cood["secondDivisor"])) / 3600) if str(quadrante) == "S" or str(quadrante) == "W": cood["total"] = cood["total"] * -1 return cood["total"]
I would consider this outside the scope of this library.
However I will not close this ticket so others may find it more easily.
no return in case of non West or South data so empty results for E and N coordinates. Corrected below:
def convertMetaInCood(gps, quadrante):
cood = {}
regexHour = re.compile(r"\[(\d+)\,")
regexMinute = re.compile(r"\, (\d+)\,")
regexSecond = re.compile(r"\,\ (\d+)\/")
regexSecondDivisor = re.compile(r"\/(\d+)\]")
cood["hour"] = re.findall(regexHour, str(gps))[0]
cood["minute"] = re.findall(regexMinute, str(gps))[0]
cood["second"] = re.findall(regexSecond, str(gps))[0]
cood["secondDivisor"] = re.findall(regexSecondDivisor, str(gps))[0]
cood["total"] = float(int(cood["hour"]) + ( (int(cood["minute"]) * 60) + (int(cood["second"])) / int(cood["secondDivisor"])) / 3600)
if str(quadrante) == "S" or str(quadrante) == "W":
cood["total"] = cood["total"] * -1
return cood["total"]
else:
return cood["total"]
Btw thank you @mzramna