Experience of Cass and Cmap in topographic map editing

*Note: please indicate the source for reprint*

In the process of topographic mapping, cad is the most classic processing software. Now there are many cad based secondary development software for topographic mapping, and all kinds of software have their own scope of application. In the process of in-house processing, due to the lax and unskilled mapping methods of personnel, many small problems will appear in the process of results, or simple problems cannot be processed, standardized and convenient. Here, the processing experience and means of some key nodes are recorded here for self correction and self inspection, so as to speed up the production speed and ensure the production quality. This time, only the following three cases are not comprehensively summarized: same line connection; Handling of conflicts between points and lines; Add elevation points to closed contours. If there is any experience in speeding up the production process in other aspects, we will continue to make up for it at that time. We also welcome all bloggers to share their experience and let the author step on the shoulders of giants to make progress with you.

Not much to say,

Split line-----------------------------------------------------------------------------------------------------------------------

 

(1) Same line connection: due to the contour line splicing and other problems caused by multi person task allocation, there will be multiple sections of the same contour line. Connect multiple contour lines according to the specification, i.e. connect them into one contour line. Before J-line connection, it should be noted that layer CL - will not be able to carry out this operation. If [DGX] has been classified as [CL - first curve] layer in advance, it is necessary to change [CL - first curve] to [CL first curve] (remove the short horizontal line -), and then carry out J-line connection (the layer can be changed back after completion). After the connection of line J, some elevation values may be wrong. Next, check the contradiction between points and lines (so there is an operational sequence between the connection of line J and the contradiction between lines).

(2) Double checking of point line contradiction: point line contradiction is nothing more than point error or improper line position (pix4d production line often produces a large number of nearly one-third of the wrong points). It is divided into two steps: the first step is to manually correct the error that is clearly inappropriate line position. This kind of line is often very close to the adjacent point. For the correction of line, No matter whether the topological relationship of manually repaired points and lines is appropriate or not, CM software judges that the modification is correct and automatically deletes the corresponding error point (a bug, the error is automatically eliminated after cm repair, but it is not necessarily correct, which is obviously inappropriate in practice). Therefore, it is necessary to check the points and lines after repair. After the second check, start to correct the point error. If there are too many point errors, the code can be used to delete the error points (the code is attached below). The input data required by the script are the original elevation point data and error layer data (currently only txt format is supported). The work before the code is as follows:

In cass →[ engineering application ]→[ elevation point generation data file ]→[ elevation point without code ], export both the elevation point and the error layer, and then change it to csv format, Ensure that the elevation digits of the two types of files are consistent (two digits at 1:500 and one digit at 1:2000) (the rounddown function takes the digits, and the round function is rounded. The specific function depends on whether the attribute value of the original elevation point is rounded or retained).

Delete the first sequence number column in the two files (the same sequence number line of the two files is not the same point data and has no corresponding relationship, so it is necessary to delete the sequence number column), and then save the two csv files as txt.

Input the corresponding input file (absolute path + file name and suffix) and output path according to the script instruction to obtain the point position result after elimination (New_GCD). Then convert it to csv format, delete the original elevation points in cass, re expand the elevation points and expand them into new_ GCD is enough.

It should be noted that due to the bug (incompleteness) of CMAP point and line duplicate checking, it needs to check the duplicate for many times before it can be completely modified.

The code principle is to find the absolute complement of subset A in U, ∁ uA (very simple). The specific code and operation interaction instructions are as follows:

#-*-coding:UTF-8-*-
"""
Function: in A Delete from file A And B The subset part of, that is, the search set B In collection A Absolute complement in (commonly used for deletion function after point and line duplicate checking).
Date:2021.1.21
Author:Kiki
"""

def TXT2LIST(A_file, B_file):
    global las1_table
    global las2_table
    las1_table =[]  #List of A files for reading
    las2_table =[]   #List of B files for reading
    f=open(A_file,"r",encoding='utf-8')
    line = f.readline()  #Read line by line
    print("START!!")
    while line:
        txt_data = eval(line) #Convert data to list form
        las1_table.append(txt_data)  #Data storage list
        line = f.readline() #Read the next line of data
    print("las1_table is finished")   #A the file list has been saved
    #print("las1_table:" + str(las1_table))
    f.close() 

    f=open(B_file,"r",encoding='utf-8')
    line = f.readline()
    while line:
        txt_data = eval(line)
        las2_table.append(txt_data)
        line = f.readline()
    print("las1_table is finished")   #B. the file list has been saved
    #print("las2_table:" + str(las2_table))
    f.close()
    return las1_table, las2_table


#Define a function to extract a subset of the two files   
def REMOVE_SAME_ELEM(list1, list2):
    set1 = set(list1)
    set2 = set(list2)
    iset = set1.intersection(set2)
    lst = list(iset)
    print("The intersection is over")
    #print(lst)

    for i in lst:
        las1_table.remove(i)   #Remove subset from A
        las2_table.remove(i)   #Remove subset from B
    global New_las1,New_las2
    New_las1 = las1_table
    New_las2 = las2_table
    print("TheBigFile and TheSmallFile have updated completely!")
    #print("new las1_table:"+str(New_las1))
    #print("new las2_table:"+str(New_las2))

    




#Output results
def EXPORT(Output_path, Output_name):
    t=''
    file = open(Output_path + Output_name, 'w')  #Create file and start writing
    with file as q:
        for i in New_las1:                
            print(str(i)+"Start Storing")
            for e in range(len(New_las1[0])-1):
                #print(e)
                t=t+str(i[e])+','
            t=t+str(i[e+1])  #There is no comma at the end of each line
            q.write(t.strip(' '))
            q.write('\n')
            t=''
    print("Finished!!")
    file.close()


print("Before starting this function, you will type two input files to be processed and one result file to be created")
A_file = input("Please enter the large file path and file name(as C:\\BigFile.txt): \n")
B_file = input("Please enter the small file path and file name(as C:\\SmallFile.txt): \n")
Output_path = input("Please enter the path of the generated file(as C:\\): \n")
Output_name = input("Please enter a new file name(as New.txt): \n")  #Output file name

TXT2LIST(A_file,B_file)
REMOVE_SAME_ELEM(las1_table, las2_table)
EXPORT(Output_path, Output_name)

 

Figure # deleted code

Before starting this function, you will type two input files to be processed and one result file to be created
 Please enter the large file path and file name(as C:\BigFile.txt): 

Please enter the small file path and file name(as C:\SmallFile.txt): 

Please enter the path of the generated file(as C:\): 

Please enter a new file name(as New.txt): 

 

Fig.:: interactive instructions

(3) Closed loop supplement elevation points: due to the dilution steps of elevation points (1:500 elevation point spacing 8m, 1:2000 elevation point spacing 32m), there will be a lack of elevation points in some closed contour coils. The lack of elevation points will make it impossible to judge whether the interior of the closed loop is concave terrain or convex terrain, resulting in the lack of terrain information. Therefore, adding elevation points inside the closed coil is the standard process of topographic map making, and the added elevation points are derived from the original elevation points (before dilution), so the problem is how to find out all the smallest closed coils (there are no other closed coils in the coil). The process is as follows:

Based on the general situation of the topographic map, given the contour area threshold, quickly select the closed coil whose area is less than the given threshold. This will lead to the emergence of sleeves and coils. The external coils of sleeves and coils will be deleted in the new engineering documents, and only the smallest closed coil will be retained, and the results will be saved as standby;

Load the known closed coil and the original point cloud data into GIS, extract the original point cloud inside the closed coil according to the location selection, export a new file (Point Cloud Collection in the coil) and remove the original point cloud data layer. At this moment, all elevation points will be located in the closed coil. In the next step, an elevation point data will be selected in each closed coil as the internal point of the closed coil;

Add xy data to all points to make them have coordinate position (xyz). Turn the closed loop elements into points, and assign the attribute value (xyz) of the elevation point closest to the closed point to the closed point with [spatial connection], and the extracted attribute value of the nearest and only point is the elevation point in the required closed loop;

Export the attribute table of the closed point to dbf, open it in excel, keep the xyz column, and expand the elevation points into cass. At this time, some existing elevation points in the closed coil need to be selected in the final inspection (take one of the adjacent elevation points).

 

Welcome to leave a message and exchange. If you have new experience, you will make up for it.

Added by BigTime on Wed, 02 Feb 2022 02:48:48 +0200