What Is a Batch Report?
Batch, also known as batch script. As its name implies, batch processing is the batch processing of certain objects. It is generally considered as a simplified scripting language, which is used in DOS and Windows systems. Batch files have the extension bat. At present, the more common batch processing includes two types: DOS batch processing and PS batch processing. PS batch processing is based on the powerful picture editing software Photoshop, which is used to batch process picture scripts; DOS batch processing is based on DOS commands, which is used to automatically execute DOS commands in batch to achieve specific operations. For more complicated situations, you need to use if, for, goto and other commands to control the running process of the program, just like high-level languages such as C and Basic. If you need to implement more complex applications, it is necessary to use external programs, which include external commands provided by the system itself and tools or software provided by third parties. Although a batch program is run in a command line environment, not only can it use command line software, any program that can be run under the current system can be run in a batch file.
- Batch processing is a simplified
- The following code is a batch code that outputs "hello world":
- @echo off
- echo hello world
- pause & exit
- Similar to the C language, batch processing also has its statement structure. The batch statement structure mainly has
- Batch processing has very powerful string processing capabilities, and its functions are by no means lower than the C string function set. The string processing functions that can be implemented in batch processing include the functions of intercepting the content of strings, replacing specific fields of strings, merging strings, and expanding strings. Each of these functions is explained below.
- The numerical calculation function in batch processing is weak. It can only perform integer calculations and ignore the decimal part of floating-point numbers. At the same time, the range of numerical calculations is also limited by the number of system bits. For current 32-bit machines, numerical calculation The range of values that can be processed is 0x80000000h ~ 0x7FFFFFFFh, which is -2147483648 ~ + 2147483647.
- For numerical calculations, you need to use the set command. The specific format is "set / a expression". Where expression represents calculation
- Learn some trivial but valuable knowledge about batch processing. Only after using this knowledge can you better realize the functions of batch processing, and it can make batch processing out of the black and white world and appear more colorful. .
- Do nt tell me that you do nt know what batch processing is. When faced with a lot of data that needs to be repeated, it often makes us feel big. At this time, we will think of batch processing [2] , what does ArcGIS provide for everyone The batch method, let us wait and see.
- Suppose we need to create a buffer for the road, and the designed tool is Buffer.
- In the first case, different features in a layer create buffers of different sizes.
- For different types of roads, we need to establish buffers of different sizes, for example, a 10-meter buffer zone for a first-level road, a 15-meter buffer zone for a second-level road, and a 20-meter buffer zone for a third-level road.
- step:
- 1. First, you should ensure that there is an attribute field in your road data to store the buffer width information.
- 2. Apply the Buffer tool and select the corresponding field at the corresponding parameter position.
- In the second case, different layers create buffers of different sizes.
- Suppose there are other different data, not just roads, these layers all need to build buffers.
- step:
- 1. Find the Buffer tool, right-click, and select Batch to open the batch panel. From this panel, we can find that the parameters are the same as the parameters we opened the Buffer. At this time, can we consider editing them in EXCEL and then copying them over?
- 2. Edit the required data in Excel.
- 3. Copy the data edited in Excel to the batch panel of Buffer. Note here that if you want to copy 10 rows of data, you need to first select 10 rows in the batch processing panel, right-click, and select "paste".
- 4. Click OK.
- If you want the buffer width of each type of data in each layer to be different, how to deal with it? This is for you to try. The principle is very simple, just find the parameter position and write the corresponding field. .
- Third case, Python implements batch processing
- If you find the above method more cumbersome and more demanding, you can consider applying Python to handle it.
- step:
- 1.Write code
- import arcpy, os
- inFCs = arcpy.GetParameterAsText (0)
- outWS = arcpy.GetParameterAsText (1)
- dist = arcpy.GetParameterAsText (2)
- inFCs = inFCs.split (";")
- for inFC in inFCs:
- fileName = os.path.split (inFC) [1]
- arcpy.Buffer_analysis (inFC, outWS + "\\" + fileName, str (dist) + "meter")
- The above code requires the user to set the input data, output data, and buffer width (in meters). The name of the output buffer data is the same as the name of the input data. If you do not want this, you can further modify the code.
- 2. Next, add this code to ArcToolbox. The steps are relatively simple and will not be repeated here.
- The place to note is the last parameter setting part. The "MutiValue" property of "Input Data" is set to "Yes". (There are more parameter settings in this section than in the box, you need to compare with your code)
- 3. When finished, the tools will be added to your own toolbox. Open the tool, you will see that the interface is the same as the interface of a common tool. There can be many input data settings, but the buffer size of all layers of this tool must be the same.