def showLines(shapes, name): global region for each in shapes: points = each.points use = False for lng, lat in points: if _gis_.within(region, (lng, lat)): use = True break if use: print name + '\t' + '\t'.join(['%f\t%f' % (lng, lat) for lng, lat in points])
############################################################################## filename = "data/cities1000.txt" fobj = open(filename, 'r') while True: line = fobj.readline() if not line: break lineSplit = line.split('\t') if len(lineSplit) != 19: continue latitude, longitude = float(lineSplit[4]), float(lineSplit[5]) if not _gis_.within(region, (longitude, latitude)): continue cityName = lineSplit[2] cityLat = lineSplit[4] cityLng = lineSplit[5] cityRole = lineSplit[7] """ 'STLMT': 0, 'PPLW': 0, 'PPLCH': 0, 'PPLH': 1, 'PPLF': 4, 'PPLR': 5, 'PPLG': 11,