"Office Automation" Land Classification of Territory "Three adjustments", "One key" to Nanjing Classification

Posted by tpc on Sat, 20 Jun 2020 04:56:20 +0200

Recently, the practical village planning under the system of territorial spatial planning has been expanded in a large area, "three-tone" data is directly facing the problem of converting the current land use. Today, we will talk about the method of "one key" conversion through code.

1. Explanation of Land Use Standards

According to the classification of the third national land survey, land used in the "three adjustments" is classified into 12 first-level land classes and 73 second-level land classes.

According to the Guidelines for Classification of Basic Classifications and Uses of Urban and County Land Spatial Planning (trial, draft for comments), the land spatial planning is divided into 28 first-level land classes, 102 second-level land classes and 39 third-level land classes.

In March 2020, the Technical Guidelines for the Compilation of Village Planning in Nanjing City (Trial Implementation) (2020 Edition) was based on the Guidelines for Classification of Basic Zones and Uses of Urban and County Land Spatial Planning (Trial Implementation, Delivery for Review) issued by the Ministry of Natural Resources for the classification of land spatial uses in China, and some classifications were refined according to the actual common situations.It is divided into 25 first-class, 71 second-class and 38 third-class categories.
This conversion standard is temporarily based on the Technical Guidelines for the Compilation of Village Planning in Nanjing (Trial Implementation) (2020 Edition).Changes will be updated in time

2. Explanation of land conversion

Land conversion is based on the classification instructions for the purposes of territorial spatial planning attached to the Guidelines for Basic Zoning and Use Classification of Urban and County Land Spatial Planning (Trial, Delivered for Review), the docking work of the third and third adjustments, and the tables of classification docking listed.There are four types to explain:

**One-to-one correspondence type:** A secondary land class of "three-tone" land can have a clear correspondence with the land used for national spatial planning, and can be converted directly.
**One-to-many type:** A secondary land class of "three-level" land can be converted to multiple land spatial planning categories. To ensure conversion efficiency, it will be converted to the most common first-level land class. The specific classification needs to be adjusted manually according to the current research situation.For example, 08H2 land for science, education, culture and sanitation can be converted to 0702 land for culture, 0703 land for education, 0704 land for sports, 0705 land for medical and health care, 0706 land for social welfare, and 0707 land for scientific research. We have unified conversion to 07 land for public facilities in the first class.
**Many-to-one: ** The secondary land classes of multiple "three-tone" land can be converted into one category of land spatial planning, which can be converted directly.For example, 0101 paddy field, 0102 irrigated land and 0103 dry land are all converted to 01 cultivated land.
No corresponding type: There is no corresponding type of idle space in the "three adjustments". It needs to be adjusted manually according to the current situation of research and converted to 00 idle space by default.
Detailed land use comparison table:

3. Operation instructions

In GIS, open the attribute table, add the field layer, type text;

Pull to the end, right-click the Layer layer to open the Field Calculator..., load the expression cal file (acquired later), remember to click Python above after loading, then click OK, and the data generated by Layer is automatically converted.

By exporting CAD, a map layer for territorial spatial planning is formed in CAD.

4. Generating Code

Since the code is very long, code generation code is specifically provided so that code can be pasted directly into the GIS

import pandas as pd
url = "sandiao-gb.xlsx" #Your excel address
#Read EXCEL comparison table
df = pd.read_excel(url,dtype='object')  #Force object so that all data becomes strings

#Generate definition function, convert land with class K, wrap with \n, note the format after wrapping
cord = 'def plan_name(name): \n    if \'K\' in name:\n        name = name[:-1]\n' 

#Loop Generation Judgement Code
for i in range(df.shape[0]):
    name = df.iloc[i,2]+df.iloc[i,3]
    if i  == 0 :
        cord = cord + '    if name == \'%s\' : \n        return \'%s\' \n' %(df.iloc[i,0], name)
    else:
        cord = cord + '    elif name == \'%s\' : \n        return \'%s\' \n' %(df.iloc[i,0], name)
        
#Generate end of code, error in gis without end of else        
cord = cord  +'    else:\n        return \'check\' \n'

print(cord)

The generated Python code is as follows and can be used directly. Code generation is very convenient!

def plan_name(name): 
    if 'K' in name:     #Special use with K, remove K
        name = name[:-1]
     #Match by code, excluding different named sites such as callable sites.
    if name == '0303' :  
        return '1701 Mangrove Land' 
    elif name == '0304' : 
        return '1702 Swamp' 
    elif name == '0306' : 
        return '1702 Swamp' 
    elif name == '0402' : 
        return '1702 Swamp' 
    elif name == '0603' : 
        return '1602 Salt Field' 
    elif name == '1105' : 
        return '170301 Coastal Beach' 
    elif name == '1106' : 
        return '170302 Inland Beach' 
    elif name == '1108' : 
        return '1702 Swamp' 
    elif name == '0101' : 
        return '01 Cultivated land' 
    elif name == '0102' : 
        return '01 Cultivated land' 
    elif name == '0103' : 
        return '01 Cultivated land' 
    elif name == '0201' : 
        return '02 Garden plot' 
    elif name == '0202' : 
        return '02 Garden plot' 
    elif name == '0203' : 
        return '02 Garden plot' 
    elif name == '0204' : 
        return '02 Garden plot' 
    elif name == '0301' : 
        return '03 woodland' 
    elif name == '0302' : 
        return '03 woodland' 
    elif name == '0305' : 
        return '03 woodland' 
    elif name == '0307' : 
        return '03 woodland' 
    elif name == '0401' : 
        return '04 Grassland' 
    elif name == '0403' : 
        return '04 Grassland' 
    elif name == '0404' : 
        return '1805 Other grasslands' 
    elif name == '05H1' : 
        return '0708 Commercial land' 
    elif name == '0508' : 
        return '09 Land for storage' 
    elif name == '0601' : 
        return '08 Industrial Land' 
    elif name == '0602' : 
        return '1601 Mining land' 
    elif name == '0603' : 
        return '1602 Salt Field' 
    #It's too long to omit some code here
    else:
        return 'check'    
        #If a check layer appears, check that the land code is not in the control table

Students who need to load the expression CALS file, pay attention to the public number, reply to "Convert", send links automati cal ly
Students who need to use land conversion to compare Excel tables, pay attention to the public number, reply to the "comparison table", send links automatically


Pay attention to planning sauce, and be efficient together!

Topics: Excel Python Attribute calculator