def reading_line_features_vertices(gp, inputFC, field_peilgebied_id, peilgebieden_centroides_dict):
    ''' leest de vertices van een line feature en plaatst de coordinaten in een dictionary. per peilgebied worden de knopen afzonderlijk
    opgeslagen:
    outputdictionary = { GPGIDENT: {1:'x1 y1',2:x2 y2'}}
    '''
    vertex_dict = {}

    inDesc = gp.describe(inputFC)
    inRows = gp.searchcursor(inputFC)
    inRow = inRows.next()

    while inRow:
        peilgebied_shapefile = inRow.getValue(field_peilgebied_id)
        if peilgebieden_centroides_dict.has_key(peilgebied_shapefile):
            #de gpgident uit de waterlijnenshape komt voor in de dictionary peilgebieden met centroides
            feat = inRow.GetValue(inDesc.ShapeFieldName)
            partnum = 0
            partcount = feat.partcount
            while partnum < partcount:
                part = feat.getpart(partnum)
                part.reset()
                pnt = part.next()
                pnt_count = 0
                while pnt:
                    if not vertex_dict.has_key(peilgebied_shapefile):
                        vertex_dict[peilgebied_shapefile] = {}
                    vertex_dict[peilgebied_shapefile][pnt_count] = pnt
                    pnt = part.next()
                    pnt_count += 1

                partnum += 1
        inRow = inRows.next()

    return vertex_dict
def reading_line_features_nodes(gp, inputFC):
    nodes_dict = {}
    ''' leest de nodes van een line feature in en plaatst de coordinaten in een dictionary.'''
    inDesc = gp.describe(inputFC)
    inRows = gp.searchcursor(inputFC)
    inRow = inRows.next()
    temp_dict = {}

    row_id = 0
    while inRow:
        feat = inRow.GetValue(inDesc.ShapeFieldName)
        row_id += 1
        partnum = 0
        partcount = feat.partcount
        while partnum < partcount:
            part = feat.getpart(partnum)
            part.reset()
            pnt = part.next()
            pnt_count = 0
            while pnt:
                key = str(row_id) + "__" + str(pnt_count)
##                if not nodes_dict.has_key(row_id):
##                        nodes_dict[row_id] = {}
##                nodes_dict[row_id][pnt_count] = str(pnt.x) + " " + str(pnt.y)
                #key_coord = '%.5f' % (pnt.x) + " " + '%.5f' % (pnt.y)
                if temp_dict.has_key(pnt):
                    nodes_dict[key] = pnt
                temp_dict[pnt] = key

                pnt = part.next()
                pnt_count += 1

            partnum += 1
        inRow = inRows.next()

    return nodes_dict