Beispiel #1
0
 def search_location(self, location):
     print location
     location, coord = googleMaps.search_location(location)
     print location
     if (location[:6] != "error="):
         self.locations[location] = coord
         self.write_locations()
     return location
Beispiel #2
0
                rc = rc + node.data
        return rc

    try:
        with open(strFileName) as f:
            fileString = unicode(f.read(), errors='ignore')
        dom = parseString(fileString)
        PlacemarkElements = dom.getElementsByTagName("Placemark")
    except Exception, excInst:
        return excInst

    for element in PlacemarkElements:
        try:
            NameElement = element.getElementsByTagName("name")[0]
            PointElement = element.getElementsByTagName("Point")[0]
            CoordElement = PointElement.getElementsByTagName("coordinates")[0]
        except:
            pass
        else:
            Coord = getText(CoordElement.childNodes).split(',')
            if len(Coord) >= 2:
                strName = getText(NameElement.childNodes)
                if lookup:
                    location, c = search_location(Coord[1] + ' ' + Coord[0])
                    if (location[:6] != "error="):
                        strName += " - " + location
                marker.append_marker((Coord[1], Coord[0], 10), strName, lookup)
                marker.refresh()
    dom.unlink()

Beispiel #3
0
    except Exception, excInst:
        return excInst

    for element in PlacemarkElements:
        try:
            NameElement = element.getElementsByTagName("name")[0]
            PointElement = element.getElementsByTagName("Point")[0]
            CoordElement = PointElement.getElementsByTagName("coordinates")[0]
        except:
            pass
        else:
            Coord = getText(CoordElement.childNodes).split(',')
            if len(Coord) >= 2:
                strName = getText(NameElement.childNodes)
                if lookup:
                    location, c = search_location(Coord[1] + ' ' + Coord[0])
                    if (location[:6] != "error="):
                        strName += " - " + location
                marker.append_marker((Coord[1], Coord[0], 10), strName, lookup)
                marker.refresh()
    dom.unlink()


def load_gpx_coords(gpxfile):
    from xml.dom.minidom import parseString

    try:
        with open(gpxfile) as f:
            fileString = unicode(f.read(), errors='ignore')
        dom = parseString(fileString)
        trkpt = dom.getElementsByTagName("trkpt")