コード例 #1
0
ファイル: ne_10m.py プロジェクト: neoatlantis/gis
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])
コード例 #2
0
ファイル: cities1000.py プロジェクト: neoatlantis/gis
##############################################################################

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,