Пример #1
0
    linecount = 0
    blocknum = 1
    
    if compress_temp_files:
        nodefile=bz2.BZ2File(scratchSpace+'/nodeblock'+str(blocknum)+'.dat','w')
    else:
        nodefile=open(scratchSpace+'/nodeblock'+str(blocknum)+'.dat','w')
        
    while True:
        # Read the next line from the OSM file
        uline = osmFile.getNextTag()

        if uline == '':
            break
        
        element = osmFile.getElement()
        linecount += 1

        if linecount % 2000000 == 0:
            AddMsgAndPrint(str(nodecount) +' Vertices   '+str(waycount)+' Ways     ' + str(taggednodecount) +' Tagged Nodes     '+str(nodetagcount)+ ' Node Tags')

        if element=='node':
            ftype = fieldType.unknown
            ftags = []
            node = osmFile.returnNode()
              
            # Make sure lat/long make sense before continuing
            if (math.fabs(float(node[1])) > 180) or (math.fabs(float(node[2])) > 90):
                continue
                
            ftype = fieldType.node
Пример #2
0
    if compress_temp_files:
        nodefile = bz2.BZ2File(
            scratchSpace + '/nodeblock' + str(blocknum) + '.dat', 'w')
    else:
        nodefile = open(scratchSpace + '/nodeblock' + str(blocknum) + '.dat',
                        'w')

    while True:
        # Read the next line from the OSM file
        uline = osmFile.getNextTag()

        if uline == '':
            break

        element = osmFile.getElement()
        linecount += 1

        if linecount % 2000000 == 0:
            AddMsgAndPrint(
                str(nodecount) + ' Vertices   ' + str(waycount) +
                ' Ways     ' + str(taggednodecount) + ' Tagged Nodes     ' +
                str(nodetagcount) + ' Node Tags')

        if element == 'node':
            ftype = fieldType.unknown
            ftags = []
            node = osmFile.returnNode()

            # Make sure lat/long make sense before continuing
            if (math.fabs(float(node[1])) > 180) or (math.fabs(float(node[2]))