Software Design of Distribution Map Generation for Soil Parameters Based on VC++

. Software system on distribution map generation of soil parameters was developed based on VC++. With the help of MapX control, soil spatial data could be edited, analyzed, generated distribution maps and so on. Soil parameter scatter graph was displayed and classified by equal count method, equal range method, natural break method and standard deviation method. In the software system soil parameter statistics data was also calculated and a new perimeter and area algorithm was developed. After comparison of different interpolation methods, Inverse Distance Weighted (IDW) method was selected to generate the soil parameter contour map and soil parameter iso-surface. At the same time the system gave the legend color and drawing method. These maps could also be saved as vector graphics. Finally a distribution map generation of soil parameters for soil moisture and total nitrogen was conducted by the soil samples from Xiangtang apple orchard in Beijing suburb, including scatter graph, contour map and iso-surface. The errors of perimeter and area were less than 3.72% and 3.01%, respectively. The result shows that the system has perfect function and stable performance.


Introduction
Soil is the basis of agricultural production, human has continued to research and analysis soil in the recent years. According to the theory of soil science, soil has two main functions: the first function is used to store water and supply crops; the second is to maintain the healthy growth of crop root. In order to describe the two functions, human use several parameters such as soil moisture, soil total nitrogen, soil fertility and many other parameters [1][2][3][4] . At the same time, domestic and foreign scholars have obtained a lot of results on the rapid detection of soil parameters [5][6][7][8][9][10] . As a kind of new management ideas and modern agriculture, precision agriculture requires precise scientific fertilization and nutrient management [11][12] . In order to achieve the crop production in the process of scientific regulation measures of investment and management decisions, it must implement the precise fertilization decision-making. As a result it is particularly important to generating high precised soil parameter distribution map. Currently, combinations of GIS tool software and visualization technology integrated have become the mainstream of the GIS application [13,14] . This article discussed the development of soil parameter distribution map system based on VC ++. With the help of MapX control [14][15][16] , it could display soil data, scatter plot and generate soil parameter distribution map.
2 The structure of soil parameter distribution map system

Experimental Samples
According to the system requirement, soil parameter distribution generation system mainly included the following modules: basic operation module, data import module, data statistics module and parameter map generation module. Figure 1 is the overall hierarchy diagram of soil parameter distribution generation system. In VC + + 6.0 environment, the system has realized the import of soil parameter information, statistics and mapping, and other functions with MapX control.

Data binding
Soil parameter information included soil moisture value, soil total nitrogen and soil GPS coordinates. Data binding is the process of soil parameter data from the data source into MapX [15]. In the MapX control, every map was corresponded to the multiple layers (the layers), and each layer (layer) have datasets, which contains a dataset object. Datasets with some properties and methods were mainly used to add and remove the dataset object in the collection.
Soil parameter data mainly included GPS location information of soil and soil parameters attribute values. Then the binding layer type was set to miBindLayerTypeXY, which could realize to WGS54 coordinates X and Y coordinates of points. Figure 2 shows the imported the scatter plot after binding the soil moisture data.

Data classification and statistics
After the soil data was binded to the soil layer, it could be classified by four methods, such as the counting method, the same range method, the nature devision method and the standard devision method. Figure 3  It was said that soil and crop information always has a certain statistical regularity, although sometimes it does not get the distribution function of random variables. In this system the soil parameters could be calculate by maximum, minimum, the statistics of the mean and standard deviation. The mean value and mean square error of the calculation formula were shown in (1) and (2).
Where:  was the data standard deviation value, v was the average of the data, n was the number of data points, k was the data point number, k v was the first k data of soil parameters.

3.3Perimeter and area calculation
This system designed an algorithm to calculate perimeter and area with the direct use of GPS handheld device data. And projection method was directly to gaussian zoning projection. The center was east longitude 116 °, projection of 40°.
MapX control provided map.distance method. This method could be used to calculate the linear distance between two points. Along the land border manually choose some key points, and then map.distance method was used repeatedly in sequence. Finally the perimeter was obtained accumulation. The system adopts the offset compensation method to calculate polygon area. Figure 4 was area calculation flow chart.

Soil parameter distribution map generation
With the steps of data binding, scatter plot, interpolation, contour map, soil parameter distribution map could be generated. By comparing the different types of spatial data interpolation methods, inverse distance weighting spatial data interpolation algorithm was finally chosen. After the original data interpolation was completed, the contour map was generated by the contour generating function provided by Contour.OCX control. Both the corresponding smoothness and Contour interval could be set. And finally the map could be saved format of SHP. Figure 5 was the distribution of soil parameters generated dialog.  To test the soil parameter distribution generation system efficiency, different sets of import test data was used. Choose the five sets of data, each group data included the number, soil parameter value latitude and longitude location information. Figure 6 is data import speed test results. It could be seen from the figure 6, when import external data, this system increased with the amount of data. The consumption of time required to import the data were linearly increasing trend. When the data points was 2000 sets (the amount of data with 8000), the system took 1344 ms. From the perspective of the function of angle and speed of system, functions could be fully realized, moderate speed in data quantity could meet the needs of practical application.

Perimeter and area validation
In order to test this system the perimeter area of the accuracy of the algorithm, experiments were carried out in Beijing changping apple orchards with GPS handheld instrument G738CM and the system. After sample the apple orchard with the device, the perimeter and area were calculated by the system. Table 1 and table 2 were the perimeter and area calculation error, respectively. Key points directly affect the precision of the result. The more the key point was, the higher precision was. The error of the system was less than 3.72% and 3.01%, respectively. It could satisfy practice.

Soil parameter distribution map validation
In order to verify the system operation, soil moisture and total nitrogen distribution maps of changing apple orchard were generated respectively, including the scatter plot, contour map and level surface. Inverse distance weighting spatial data interpolation method was used on the original data interpolation. The results showed that the system had stable performance. Figure 7

Conclusions
Soil parameter distribution map system was developed based on VC++. The system could realized the scatter plot, contour map, contour surface generation and vector graph save function. Through the analysis of the system efficiency and perimeter area computation verification test it showed that when the data points was 2000, the timeconsuming needs 1344 ms, calculation error within 3.72% and 3.01% respectively; The results showed that the system was stable and reliable enough. It provided a new means to guide the variable rate fertilization.