Agricultural variable prescription map dynamic matching method and device based on agricultural machine real-time positioning and storage medium
By converting agricultural variable prescription files into structured data and performing coordinate transformation and color filling, the problems of inefficient data processing and coordinate adaptation were solved, enabling real-time positioning and synchronous execution of agricultural machinery, improving the accuracy and timeliness of agricultural operations, and promoting the development of precision agriculture.
Patent Information
- Application Number
- CN202511304869.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2025-12-12
AI Technical Summary
In existing technologies, agricultural variable prescription maps suffer from inefficient data processing, coordinate adaptation problems, insufficient visualization and interaction, and missing fill rules and color mapping, which prevents precision agriculture technologies from being applied efficiently and accurately.
Unstructured agricultural variable prescription files are converted into structured data, coordinate system transformation is performed, and a lightweight 2D planar map component is constructed. Color gradient and odd-even fill rules are used to fill the field application area with color, and the field application area is matched based on the real-time positioning data of agricultural machinery to achieve highlighting and synchronous execution.
It improves data storage and retrieval efficiency, ensures accurate matching of location information, enhances data visualization, improves the accuracy and timeliness of agricultural operations, reduces resource waste, and promotes the intelligent and refined development of agriculture.
Smart Images

Figure CN121113084A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application mainly relates to the field of agricultural information processing technology, in particular to a method and device for dynamically matching an agricultural variable prescription map based on real-time positioning of agricultural machinery and a storage medium. BACKGROUND
[0002] A variable prescription map is an important tool in precision agriculture, used to achieve precision in soil and crop management. Precision agriculture is an agricultural model that uses advanced technology and information technology to achieve fine management of farmland, aiming to improve the efficiency of farmland resource utilization, reduce production costs, and increase the yield of agricultural products. In the past practice of precision agriculture, the generation and application of variable prescription maps have always been a key research direction. A variable prescription map can determine the agricultural measures that should be applied in different areas, such as fertilization, pesticide spraying, and seeding, according to factors such as soil properties, vegetation coverage, and crop requirements in different plots, in order to achieve targeted agricultural production management.
[0003] Current agricultural production is developing towards precision and intelligence, and the demand for agricultural variable prescription operations is increasing, but there are the following pain points: Data processing is inefficient: Agricultural variable prescription files are mostly unstructured (such as scattered documents and custom formats), and it is difficult to directly associate and call key data such as plot coordinates and application values, which hinders the flow of precision operation data.
[0004] Coordinate adaptation is difficult: Agricultural machinery positioning and plot geographic information are often based on different coordinate systems (WGS-84, ECEF, ENU, etc.), and there is a lack of unified conversion logic, resulting in large matching errors between mechanical positions and plot areas, affecting operation accuracy.
[0005] Visualization and interaction are insufficient: Traditional prescription information presentation methods (such as tables and static maps) cannot intuitively display plot application distribution, and during agricultural machinery operation, it is difficult to synchronize position and prescription data in real time, making it difficult for operation personnel to quickly obtain current application requirements, and the execution mechanism cannot efficiently link.
[0006] Filling rules and color mapping are missing: There is no standardized scheme for color filling of plot application areas, and nested plots (such as farmland containing ditches and road sub-areas) are prone to color conflicts, making it difficult to visually distinguish application differences and increasing the difficulty of operation decision-making.
[0007] The above pain points result in the inability of agricultural variable prescription maps to be efficiently and accurately applied on embedded devices, restricting the large-scale promotion of precision agriculture technology. SUMMARY
[0008] The present application mainly relates to the field of agricultural information processing technology, in particular to a method and device for dynamically matching an agricultural variable prescription map based on real-time positioning of agricultural machinery and a storage medium.
[0009] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A method for dynamic matching of agricultural variable prescription maps based on real-time positioning of agricultural machinery, comprising: S1. Convert unstructured agricultural variable prescription files into structured data, wherein the structured data includes WGS-84 geodetic coordinates with field shape association, field application values, and attribute boundary intervals; S2. Convert the WGS-84 geodetic coordinate system latitude, longitude, and altitude coordinates to ECEF geocentric-earth-fixed coordinate system coordinates, and then convert the ECEF geocentric-earth-fixed coordinate system coordinates to ENU northeast-sky coordinate system coordinates. S3. Construct a 2D planar map component based on the lightweight map component, convert the ENU Northeast Celestial Coordinate System coordinates into the drawing path object of the 2D planar map component, draw the polygonal boundaries of the fields based on the drawing path object, and obtain multiple field application areas bound to the field application value. S4. Based on the attribute boundary interval and color gradient formula, determine the color corresponding to the application value of each field. Use the odd-even filling rule to determine whether the application area of each field should be filled with color. If the determination result is to fill, fill the corresponding application area of the field with color according to the determined color to obtain the agricultural variable prescription map. S5. Based on the real-time positioning data of agricultural machinery, match the application area of the field where the machinery is currently located in the agricultural variable prescription map, obtain the corresponding application value of the field based on the application area of the field where the machinery is located, highlight the application value of the field and send it to the agricultural operation execution agency for synchronous execution.
[0010] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A dynamic matching device for agricultural variable prescription maps based on real-time positioning of agricultural machinery, comprising: The file parsing module is used to convert unstructured agricultural variable prescription files into structured data, which includes WGS-84 geodetic coordinates with field shape association, field application values, and attribute boundary intervals. The geographic coordinate transformation module is used to convert the latitude, longitude and altitude coordinates of the WGS-84 geodetic coordinate system into the ECEF geocentric geofixed coordinate system coordinates, and then convert the ECEF geocentric geofixed coordinate system coordinates into the ENU northeast-sky coordinate system coordinates. The map processing module is used to: construct a 2D planar map component based on a lightweight map component, convert the ENU northeast-sky coordinate system coordinates into a drawing path object of the 2D planar map component, draw the polygonal boundaries of the fields based on the drawing path object, and obtain multiple field application areas bound to the field application values. Based on the attribute boundary interval and color gradient formula, the color corresponding to the application value of each field is determined. The odd-even filling rule is used to determine whether the application area of each field should be filled with color. If the determination result is to fill, the corresponding application area of the field is filled with color according to the determined color to obtain the agricultural variable prescription map. The synchronization module is used to match the application area of the field where the current machine is located in the agricultural variable prescription map based on the real-time positioning data of the agricultural machinery, obtain the corresponding application value of the field based on the application area of the field, highlight the application value of the field and send it to the agricultural operation execution agency for synchronous execution.
[0011] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: an agricultural variable prescription map dynamic matching device based on real-time positioning of agricultural machinery, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the agricultural variable prescription map dynamic matching method based on real-time positioning of agricultural machinery as described above.
[0012] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described method for dynamic matching of agricultural variable prescription maps based on real-time positioning of agricultural machinery.
[0013] The beneficial effects of this invention are as follows: By converting unstructured agricultural variable prescription files into structured data, the storage, retrieval, and analysis of data become more efficient and orderly, providing a solid data foundation for subsequent operations. The coordinate system conversion accurately adapts to the location information needs of different scenarios, ensuring a close correlation between the location of agricultural machinery operations and farmland geographic information. The 2D planar map component built based on lightweight map components reduces system resource consumption and quickly and intuitively presents the application area of fields, greatly improving data visualization. Using attribute boundary intervals and color gradient formulas to fill field colors allows farmers or operators to easily distinguish differences in application rates across different fields, effectively improving the accuracy of operational decisions. The real-time positioning of agricultural machinery and the matching and highlighting of the prescription map not only help operators know the location of the machinery and the corresponding application rate in real time, but also synchronize relevant information to the execution mechanism, achieving efficient linkage from data processing to precision operations. This significantly improves the accuracy and timeliness of agricultural operations, effectively reduces resource waste, helps reduce costs and increase efficiency in agricultural production, and promotes the intelligent and refined development of agriculture. Attached Figure Description
[0014] Figure 1 A flowchart of the dynamic matching method for agricultural variable prescription maps provided in this embodiment of the invention; Figure 2 A flowchart illustrating the breakdown of agricultural variable prescription map processing provided in this embodiment of the invention; Figure 3 A schematic diagram of the module of the dynamic matching device for agricultural variable prescription maps provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of another module of the dynamic matching device for agricultural variable prescription maps provided in an embodiment of the present invention. Detailed Implementation
[0015] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0016] Example 1: As Figure 1 , Figure 2 As shown, this embodiment of the invention provides a method for dynamic matching of agricultural variable prescription maps based on real-time positioning of agricultural machinery, including: S1. Convert unstructured agricultural variable prescription files into structured data, wherein the structured data includes WGS-84 geodetic coordinates with field shape association, field application values, and attribute boundary intervals; S2. Convert the WGS-84 geodetic coordinate system latitude, longitude, and altitude coordinates to ECEF geocentric-earth-fixed coordinate system coordinates, and then convert the ECEF geocentric-earth-fixed coordinate system coordinates to ENU northeast-sky coordinate system coordinates. S3. Construct a 2D planar map component based on the lightweight map component, convert the ENU Northeast Celestial Coordinate System coordinates into the drawing path object of the 2D planar map component, draw the polygonal boundaries of the fields based on the drawing path object, and obtain multiple field application areas bound to the field application value. S4. Based on the attribute boundary interval and color gradient formula, determine the color corresponding to the application value of each field. Use the odd-even filling rule to determine whether the application area of each field should be filled with color. If the determination result is to fill, fill the corresponding application area of the field with color according to the determined color to obtain the agricultural variable prescription map. S5. Based on the real-time positioning data of agricultural machinery, match the application area of the field where the machinery is currently located in the agricultural variable prescription map, obtain the corresponding application value of the field based on the application area of the field where the machinery is located, highlight the application value of the field and send it to the agricultural operation execution agency for synchronous execution.
[0017] In the above embodiments, by converting unstructured agricultural variable prescription files into structured data, the storage, retrieval, and analysis of data become more efficient and orderly, providing a solid data foundation for subsequent operations. The coordinate system conversion accurately adapts to the location information needs of different scenarios, ensuring a close correlation between the location of agricultural machinery operations and farmland geographic information. The 2D planar map component built based on lightweight map components reduces system resource consumption and quickly and intuitively presents the application area of fields, greatly improving data visualization. Using attribute boundary intervals and color gradient formulas to fill field colors allows farmers or operators to easily distinguish differences in application rates across different fields, effectively improving the accuracy of operational decisions. The real-time positioning of agricultural machinery and the matching and highlighting of the prescription map not only help operators know the location of the machinery and the corresponding application rate in real time, but also synchronize relevant information to the execution mechanism, achieving efficient linkage from data processing to precision operations. This significantly improves the accuracy and timeliness of agricultural operations, effectively reduces resource waste, helps reduce costs and increase efficiency in agricultural production, and promotes the intelligent and refined development of agriculture.
[0018] Preferably, S1, converting unstructured agricultural variable prescription files into structured data includes: Read the agricultural variable prescription file in ESRIShapefile format, check whether the agricultural variable prescription file meets the requirements of completeness and compliance. If it does, extract the shape of each field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates from the agricultural variable prescription file, and identify whether each field shape has nested shapes. If they do, store the outer shape of the field and the corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates of the nested shapes as a two-dimensional array. If they do not, store the non-nested shape of the field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates as a one-dimensional array. Then, aggregate the field shapes into a three-dimensional array based on all the one-dimensional and two-dimensional arrays. The attribute values of each attribute field are extracted from the agricultural variable prescription file according to the field shape index. Numerical fields related to agricultural variable operations are filtered from the attribute values of all attribute fields, and the three-dimensional array is bound to the field application value corresponding to the filtered numerical fields. Sort the application values of the bound fields to obtain the maximum and minimum application values of the fields, and store the maximum and minimum application values of the fields as attribute boundary intervals.
[0019] In this embodiment, the integrity verification of the ESRI Shapefile format prescription file, basic information reading, and geometric shape and attribute field parsing are completed to generate structured data (three-dimensional shape array, attribute value boundary) to provide data support for subsequent coordinate transformation and rendering.
[0020] Specifically, S11. File format verification and exception handling File composition check: The ESRI Shapefile format must contain 4 core files (.shp stores geometry, .shx stores shape index, .dbf stores attribute fields, and .prj stores projection information). First, check whether these 4 files are complete and in the correct format.
[0021] Error handling mechanism: If a missing file (e.g., missing .prj file) or a format error (e.g., corrupted .shp file) is detected, error handling is immediately triggered, prompting the user with "file error" and terminating the subsequent parsing process to avoid unnecessary calculations and resource consumption.
[0022] S12. Basic Information Retrieval Core information extraction: After confirming the compliance of the file, read the geometric shape type (in agricultural scenarios, focus on "polygon (SHPT_POLYGON)" to represent field boundaries), the number of shapes, and the name (such as "fertilizer amount" and "crop type") and type (such as Int, Double) of the attribute fields.
[0023] Data filtering logic: Only retain valid information related to agricultural variable operations, and filter out non-polygonal geometric data (such as point and line types) to reduce data redundancy.
[0024] S13. Geometric Shape Analysis and Structured Storage Vertex coordinate extraction: For each polygon, extract the latitude, longitude and altitude coordinates of the vertices (based on the WGS-84 coordinate system), and use part information to determine whether there are nested shapes inside the polygon (such as special areas within a field).
[0025] 3D array model construction: Define a VertexCoor data structure to store the latitude, longitude, and elevation coordinates of a single vertex, serving as the smallest unit of shape.
[0026] Use a two-dimensional array to store a single shape: the elements of the one-dimensional array represent non-nested shapes within the shape, with element 0 fixed as the outermost shape and the remaining elements as nested shapes.
[0027] Append all the two-dimensional arrays of shapes to form a three-dimensional array, ensuring that the coordinate data of each shape and its nested structure is complete and traceable.
[0028] S14. Attribute Field Parsing and Boundary Calculation Attribute value reading and storage: Parse the record values of all attribute fields in the .dbf file (such as the fertilizer application rate of a certain field is 20kg / mu), classify and store them into a two-dimensional array according to the field type (Int, Double, etc.), and the array index corresponds one-to-one with the three-dimensional array index of the geometric shape to realize the "shape-attribute" association.
[0029] Numerical boundary calculation: For Int and Double type attribute fields, the maximum value (max) and minimum value (min) are extracted using a sorting algorithm to determine the boundary range of the attribute values. This range will serve as the "total range" for subsequent color gradient algorithms, ensuring the accuracy of color mapping.
[0030] S15. Rendering Field Selection and Algorithm Model Generation User interaction selection: Since the prescription file may contain multiple attribute fields (such as "fertilizer amount" and "irrigation amount"), the system prompts the user to select the target field to be rendered (such as the user selecting "fertilizer amount" for variable fertilization operations).
[0031] Field type validation: Validates whether the selected field type is suitable for rendering (only numeric fields such as Int and Double are supported, string fields are not supported). If they do not match, the user is prompted to select again.
[0032] Gradient algorithm model generation: Based on the [min, max] boundary range of the selected field, the basic parameters of the color gradient algorithm are automatically initialized (such as Step=max-min+1) to prepare for color calculation in the subsequent rendering stage.
[0033] In this embodiment, by selectively reading ESRIShapefile format files and strictly verifying their integrity and compliance, the reliability of the prescription data source is ensured, avoiding errors in subsequent processing due to file anomalies. A hierarchical storage method of "one-dimensional array (no nesting) - two-dimensional array (nested) - three-dimensional array (aggregated)" is adopted for field shapes (including nested shapes), accurately preserving the hierarchical relationship between field shapes and the correlation with WGS-84 latitude and longitude coordinates, solving the problem of chaotic data storage for nested fields. Attribute fields are extracted by field shape index and numerical fields related to agricultural variable operations are filtered, achieving precise binding between field geometric data and application rates, avoiding interference from irrelevant data. The maximum / minimum application rates are obtained by sorting and stored as attribute boundary intervals, directly providing basic parameters for color gradient calculations in subsequent steps without requiring additional professional software for secondary processing. This reduces dependence on third-party resources, shortens the data preprocessing cycle, and improves the overall efficiency, accuracy, and adaptability of converting unstructured data to structured data, laying a high-quality data foundation for subsequent coordinate transformation, map rendering, and other steps.
[0034] Preferably, S2, converting the WGS-84 geodetic coordinate system latitude, longitude, and altitude coordinates to ECEF geocentric-earth-fixed coordinate system coordinates, and then converting the ECEF geocentric-earth-fixed coordinate system coordinates to ENU northeast-northeast-sky coordinate system coordinates, includes: The ECEF coordinate components are calculated using the following formula: , , , Where X is the eastward component, Y is the northward component, Z is the celestial component, and R is the radius of curvature of the zonal loop. ,in, The square of the eccentricity R is the square of the latitude, h is the vertex elevation, and R+h is the projected distance along the latitude direction. Will The ECEF coordinates of each field vertex are used and stored in association with the field shape index; The initial positioning point's latitude, longitude, and altitude coordinates in the WGS-84 geodetic coordinate system are obtained from the initial positioning data of agricultural machinery. The ECEF coordinates of the initial positioning point are calculated according to the ECEF coordinate component calculation formula. ; ECEF coordinates of each field vertex Calculate its ECEF coordinates relative to the initial positioning point. The difference is used to obtain the relative position of the field vertex in the ECEF geocentric geofixed coordinate system with respect to the initial positioning point. : , , , Latitude based on the initial positioning point ,longitude Construct the rotation matrix M for transforming the ECEF geocentric Earth-fixed coordinate system to the ENU northeast-sky coordinate system. The rotation matrix M is expressed as: , Relative position of ECEF geocentric and Earth-fixed coordinate system Multiplying by the rotation matrix M yields the ENU northeast-sky coordinates for each field.
[0035] In this embodiment, the latitude, longitude, and altitude coordinates of the WGS-84 geodetic coordinate system are transformed into planar coordinates of the ENU Northeast Atlas Coordinate System through the ECEF geocentric coordinate system, thus solving the problem of coordinate accuracy and intuitiveness on embedded devices.
[0036] Specifically, S21. Coordinate system selection basis Input coordinate system: Use WGS-84 geodetic coordinate system (a globally universal geographic coordinate system) to ensure the universality of the original coordinate data of the prescription map.
[0037] Target coordinate system: The ENU Northeast Celestial Center coordinate system is selected. Compared with the UTM projection coordinate system commonly used in traditional GIS software, its advantages are: Based on the observation station (origin), it focuses on the relative motion of objects within a local area (such as the movement of agricultural machinery in a field), resulting in higher precision.
[0038] The "northeast-sky" directional feature aligns with the intuitive understanding of agricultural operation scenarios (e.g., "eastward is the direction of operation"), improving users' efficiency in understanding the map.
[0039] S22. Three-stage implementation of coordinate transformation Phase 1: Definition of basic parameters for WGS-84 to ECEF coordinate system transformation: Based on the WGS-84 ellipsoid parameters (major radius a = 6378137.0, polar flattening f = 1 / 298.257223565), the reciprocal of the polar flattening f is introduced. reciprocal =1 / f, and the improved formula for calculating eccentricity is derived as follows: , To avoid calculation errors caused by the precision limitations of double.
[0040] Coordinate calculation logic: using the improved The values are combined with the standard conversion formula from WGS-84 to ECEF to calculate the ECEF space rectangular coordinates (x, y, z) of each vertex, ensuring coordinate accuracy.
[0041] Phase 2: ECEF Relative Distance Calculation Origin setting: Select the "Initial Positioning Data" of the positioning module as the origin of the ENU coordinate system (such as the GPS positioning point when agricultural machinery starts). If the user needs to reset the origin, they can switch to "Current Positioning Data".
[0042] Relative distance calculation: Using the ECEF coordinates of the origin as a reference, calculate the difference between the ECEF coordinates of all other vertices and the coordinates of the origin to obtain the "ECEF relative distance", thus eliminating redundant information in the global coordinates.
[0043] Phase 3: ECEF relative distance → ENU plane coordinate transformation Application of the conversion formula: Substitute into the ENU coordinate system conversion formula to convert the relative distance between ECEF and ENU into ENU plane coordinates relative to the origin (east x, north y, and sky z; in agricultural operations, x and y plane coordinates are mainly used).
[0044] Unit mapping: The "meter (m)" unit of ENU coordinates is mapped to the "pixel (px)" unit required for subsequent rendering according to a preset ratio (e.g., 1 meter = 2 pixels), ensuring that the map is displayed correctly on the embedded device screen.
[0045] In this embodiment, by clarifying the calculation formula for ECEF coordinate components and introducing the curvature radius parameter of the tropic axis, and combining the characteristics of the WGS-84 ellipsoid, the coordinate transformation logic is accurately derived, ensuring the accuracy of the transformation from geodetic coordinates to geocentric coordinates. The ECEF coordinates of the initial positioning point are calculated based on the initial positioning data of agricultural machinery, and the relative position of the field vertex is obtained through difference calculation, providing a local reference that fits the agricultural machinery operation scenario for the subsequent transformation to the ENU coordinate system, avoiding the accumulation of errors in the global coordinate transformation. Based on the latitude and longitude of the initial positioning point, a dedicated rotation matrix is constructed to realize the transformation from ECEF to ENU, making full use of the directional characteristics of the "northeast-sky" coordinate system and the advantages of local high precision, adapting to the short-distance and highly interactive needs in agricultural operations. Moreover, the entire transformation process does not rely on third-party GIS libraries, but is implemented through native formulas and steps, reducing the resource consumption of embedded devices. This not only ensures the accuracy and adaptability of coordinate transformation, but also provides a unified and accurate coordinate foundation for subsequent field application area matching and map rendering.
[0046] Preferably, S3, a 2D planar map component is constructed based on a lightweight map component, the ENU northeast-north-sky coordinate system coordinates are converted into a drawing path object of the 2D planar map component, and the field polygon boundaries are drawn based on the drawing path object to obtain multiple field application areas bound to the field application values, including: A 2D planar map component is constructed based on a lightweight map component. The 2D planar map component includes a background layer for drawing grid lines and a field layer for drawing the boundaries of field polygons. The coordinate units are converted to pixel units according to the preset mapping ratio, and the origin of the ENU Northeast Sky Coordinate System is mapped to the screen reference point of the 2D planar map component. Indexed by field shape, read the ENU northeast-north-sky coordinates of a single field, convert them to pixel-level vertices according to a preset mapping ratio, and add the vertex coordinates sequentially to the polygon based on the polygon construction function.
[0047] For non-nested shapes, a single polygon is added to the PainterPath object. For nested shapes, several polygons are generated sequentially from the outside in and added to the PainterPath object in order. Finally, corresponding PainterPath objects are generated for all shapes and stored in a shape path array after being associated with the shape index of each shape.
[0048] Based on the field shape index, the application rate value of each field is bound to the corresponding application rate area, resulting in multiple application rate areas bound to the application rate value of the field.
[0049] In this embodiment, a 2D planar map is constructed based on a lightweight map component. It does not rely on a complex third-party GIS library, but uses native drawing capabilities. This can adapt to the limited CPU and memory resources of agricultural machinery embedded devices, avoid redundant functions occupying resources, and ensure smooth operation. By converting ENU coordinates to pixel units and mapping the ENU origin to the screen reference point through a preset mapping ratio, the coordinate system and map display are accurately adapted, providing a clear position reference for drawing field boundaries. The PainterPath drawing path object is generated by indexing the field shape. This not only preserves the geometric features of the field (including nested shapes) but also binds the application value through the field shape index, ensuring a one-to-one correspondence between the "field boundary and the application value" without any errors. The entire process, from component construction to region generation, takes into account lightweightness, accuracy, and relevance, providing a map carrier with a clear structure and adaptability to embedded scenarios for subsequent color filling and real-time region matching.
[0050] Preferably, S4, based on the attribute boundary interval and color gradient formula, the color corresponding to the application value of each field is determined, and the odd-even fill rule is used to determine whether the application area of each field should be filled with color. If the determination result is to fill, the corresponding application area of the field is filled with color according to the determined color to obtain an agricultural variable prescription map, including: Based on the attribute boundary intervals and the field application area bound to the field application value, determine multiple base colors and interval proportions for segmented gradients. The total step size is calculated based on the maximum (max) and minimum (min) values of the attribute boundary intervals. ; The attribute boundary intervals are divided according to the aforementioned interval proportions to obtain multiple sub-intervals. Then, the sub-interval to which each field application value belongs is identified, and the starting and ending colors from the base colors are selected accordingly. These colors are then substituted into the color gradient formula to calculate the unique RGB color corresponding to the field application value. The color gradient formula is as follows: , in, S represents the application rate per field, A represents the starting color, and B represents the ending color. Starting from the point to be judged, draw an infinitely extending ray in the field layer using the odd-even fill rule. Count the number of intersections between the ray and all boundaries of the field. If the number of intersections is odd, the intersection point is determined to be within the effective interior of the field application area and needs to be filled with color. If the number of intersections is even, the intersection point is determined to be outside the area or inside a nested shape and the current field application area is not filled with color. After judging all intersection points, the agricultural variable prescription map is obtained.
[0051] In this embodiment, the segmented gradient is optimized as follows: four colors are used to divide the gradient into three intervals, with an interval ratio of {0.2:0.6:0.2} (e.g., color sequence: red → yellow → green → blue). The advantage is that: Reduce the color proportion of extreme dosage values (such as max and min) to make their colors more prominent (e.g., max corresponds to blue, min corresponds to red) to facilitate quick identification by users.
[0052] The intermediate application rate (60%) results in a more even color distribution and richer layers (such as a gradient transition from yellow to green), avoiding color breaks.
[0053] The color filling process is as follows: Interval step size calculation: Based on the [min, max] of the attribute field and the segment ratio, calculate the step size of each sub-interval (e.g., if the total Step=100, the step sizes of the 3 sub-intervals are 20, 60, and 20 respectively).
[0054] Application rate matching interval: Obtain the application rate value for the corresponding field through shape index, and calculate... Determine the gradient sub-interval to which the application value belongs. Color generation and filling: Based on the A and B values corresponding to the sub-interval, substitute them into the formula to calculate the Gradient and generate the color for the application value; set the color to the brush and fill it synchronously when drawing the PainterPath.
[0055] Nested shape processing: Use the odd-even fill rule to exclude the internal areas of nested shapes (such as small areas within a field) to ensure that the color fill of the outer shape and the child shape do not overlap and are error-free.
[0056] For example, it is divided into 3 gradual intervals with an interval ratio of {0.2:0.6:0.2}.
[0057] The attribute boundary interval is divided into 3 sub-intervals based on proportion: Assume that the attribute boundary interval obtained from S1 is "minimum application rate 10 kg / mu, maximum application rate 50 kg / mu", with a total range of 40 kg / mu. The range of each sub-interval is calculated based on the proportions of the 3 intervals {0.2:0.6:0.2}: Sub-interval 1 (accounting for 20%): span = 40 × 0.2 = 8 kg / mu, corresponding to an application rate range of 10-18 kg / mu; Sub-interval 2 (accounting for 60%): span = 40 × 0.6 = 24 kg / mu, corresponding to an application rate range of 19-42 kg / mu; Sub-interval 3 (accounting for 20%): span = 40 × 0.2 = 8 kg / mu, corresponding to an application rate range of 43-50 kg / mu.
[0058] Determine which sub-interval the application rate value of a single field falls into: Obtain the application rate value of each field from S3 (e.g., application rate value of 20 kg / mu for field A, application rate value of 45 kg / mu for field B), and compare it with the range of the three sub-intervals one by one: The 20 kg / mu of field A falls within sub-interval 2 of 19-42 kg / mu; The 45 kg / mu of field B falls within sub-interval 3 of 43-50 kg / mu.
[0059] This determination clarifies the "starting reference color" and "ending reference color" corresponding to the application rate for each field (e.g., sub-interval 2 corresponds to the reference color "yellow → green", and sub-interval 3 corresponds to "green → blue"), laying the foundation for the next step of substituting into the color gradient formula to calculate the unique RGB color. In the above embodiments, firstly, the base color and interval proportion of the segmented gradient are determined based on the attribute boundary interval. Combined with the color gradient formula, the unique RGB color corresponding to the field application value is calculated. This segmented design makes the colors of extreme application values more prominent and the color levels of regular application values richer. It also achieves accurate mapping between application values and colors, improves visualization differentiation, and facilitates operators to quickly identify application differences. Secondly, an odd-even filling rule is adopted. The number of boundary intersections is counted by the ray method to determine whether to fill. This effectively solves the color filling conflict of nested fields (such as outer fields and inner sub-shapes), ensuring that the filling area is accurate and avoiding distortion of application information caused by color coverage or omission. Moreover, the entire process relies on native algorithms and drawing logic, without relying on third-party rendering libraries, and adapts to the resource limitations of agricultural machinery embedded devices. While ensuring the accuracy of color matching and the standardization of filling, it provides a clear and accurate visual prescription map foundation for subsequent real-time positioning and matching of agricultural machinery and synchronous display of actuators.
[0060] Preferably, based on real-time positioning data of agricultural machinery, the application area of the field where the machinery is currently located is matched in the agricultural variable prescription map. The corresponding application value for the field is obtained based on the application area, and the application value is highlighted and sent to the agricultural operation execution agency for synchronous execution, including: Real-time positioning data is obtained from the positioning module of the agricultural machinery, and the positioning data includes the latitude, longitude and altitude coordinates of the current position of the machinery in the WGS-84 geodetic coordinate system. The machine's current location in the WGS-84 geodetic coordinate system is converted to the ENU Northeast Atlas Coordinate System. The converted coordinates are then mapped to the map's screen display coordinate system using a dynamic interactive matrix in the 2D planar map component, in order to determine the machine's real-time location on the map. The system calls the area detection interface of the 2D planar map component to determine the field application area to which the real-time location of the machinery belongs. If a matching field application area is found, the system associates the stored field application value with the field shape index and highlights the application value on the planar map. The system then encapsulates the data into a data message according to a preset standardized format and sends the encapsulated data message to the agricultural operation execution agency for synchronous execution via the CAN communication protocol.
[0061] In the above embodiments, firstly, after obtaining the WGS-84 latitude, longitude, and altitude coordinates from the agricultural machinery positioning module, the coordinate transformation logic described above is reused to convert them into ENU coordinates and mapped to the map screen coordinate system through a dynamic interactive matrix. This ensures that the real-time position of the agricultural machinery is accurately aligned with the prescription map coordinates, avoiding regional matching deviations caused by coordinate system differences. Secondly, the regional detection interface of the 2D planar map component is called to quickly determine the field application area to which the positioning point belongs. Combined with the highlighted application value display, this allows operators to intuitively grasp the application value of the current work area. Thirdly, the application value is quickly associated through the field shape index, the data is encapsulated in a standardized format, and sent to the actuator using the CAN communication protocol. This ensures the consistency of "current field area on the map - application value" and achieves efficient data synchronization, avoiding information lag. The entire process relies on native positioning data processing, map interaction, and communication logic, without depending on third-party positioning or communication libraries. It adapts to the resource limitations of embedded agricultural machinery devices, ensuring accurate positioning and intuitive display while realizing a closed loop of "positioning-matching-displaying-execution," providing real-time and reliable data support for precision agriculture operations.
[0062] Example 2: As Figure 3 , Figure 4 As shown, this embodiment of the invention also provides a dynamic matching device for agricultural variable prescription maps based on real-time positioning of agricultural machinery, comprising: The file parsing module is used to convert unstructured agricultural variable prescription files into structured data, which includes WGS-84 geodetic coordinates with field shape association, field application values, and attribute boundary intervals. The geographic coordinate transformation module is used to convert the latitude, longitude and altitude coordinates of the WGS-84 geodetic coordinate system into the ECEF geocentric geofixed coordinate system coordinates, and then convert the ECEF geocentric geofixed coordinate system coordinates into the ENU northeast-sky coordinate system coordinates. The map processing module is used to: construct a 2D planar map component based on a lightweight map component, convert the ENU northeast-sky coordinate system coordinates into a drawing path object of the 2D planar map component, draw the polygonal boundaries of the fields based on the drawing path object, and obtain multiple field application areas bound to the field application values. Based on the attribute boundary interval and color gradient formula, the color corresponding to the application value of each field is determined. The odd-even filling rule is used to determine whether the application area of each field should be filled with color. If the determination result is to fill, the corresponding application area of the field is filled with color according to the determined color to obtain the agricultural variable prescription map. The synchronization module is used to match the application area of the field where the current machine is located in the agricultural variable prescription map based on the real-time positioning data of the agricultural machinery, obtain the corresponding application value of the field based on the application area of the field, highlight the application value of the field and send it to the agricultural operation execution agency for synchronous execution.
[0063] Preferably, converting unstructured agricultural variable prescription files into structured data includes: Read the agricultural variable prescription file in ESRIShapefile format, check whether the agricultural variable prescription file meets the requirements of completeness and compliance. If it does, extract the shape of each field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates from the agricultural variable prescription file, and identify whether each field shape has nested shapes. If they do, store the outer shape of the field and the corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates of the nested shapes as a two-dimensional array. If they do not, store the non-nested shape (i.e., closed shape) of the field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates as a one-dimensional array. Then, aggregate the field shapes into a three-dimensional array based on all the one-dimensional arrays and two-dimensional arrays. Extract the attribute values of each attribute field from the agricultural variable prescription file according to the field shape index, filter out the numerical fields related to agricultural variable operations from all attribute field values, and bind the three-dimensional array with the filtered numerical fields and the corresponding field application values; Sort the application values of the bound fields to obtain the maximum and minimum application values of the fields, and store the maximum and minimum application values of the fields as attribute boundary intervals.
[0064] Example 3: This embodiment of the invention also provides a dynamic matching device for agricultural variable prescription maps based on real-time positioning of agricultural machinery, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the dynamic matching method for agricultural variable prescription maps based on real-time positioning of agricultural machinery as described above.
[0065] Example 4: This embodiment of the invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the above-described method for dynamic matching of agricultural variable prescription maps based on real-time positioning of agricultural machinery.
[0066] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0067] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0068] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0069] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0070] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for dynamic matching of agricultural variable prescription maps based on real-time positioning of agricultural machinery, characterized in that, include: S1. Convert unstructured agricultural variable prescription files into structured data, wherein the structured data includes WGS-84 geodetic coordinates with field shape association, field application values, and attribute boundary intervals; S2. Convert the WGS-84 geodetic coordinate system latitude, longitude, and altitude coordinates to ECEF geocentric-earth-fixed coordinate system coordinates, and then convert the ECEF geocentric-earth-fixed coordinate system coordinates to ENU northeast-sky coordinate system coordinates. S3. Construct a 2D planar map component based on the lightweight map component, convert the ENU Northeast Celestial Coordinate System coordinates into the drawing path object of the 2D planar map component, draw the polygonal boundaries of the fields based on the drawing path object, and obtain multiple field application areas bound to the field application value. S4. Based on the attribute boundary interval and color gradient formula, determine the color corresponding to the application value of each field. Use the odd-even filling rule to determine whether the application area of each field should be filled with color. If the determination result is to fill, fill the corresponding application area of the field with color according to the determined color to obtain the agricultural variable prescription map. S5. Based on the real-time positioning data of agricultural machinery, match the application area of the field where the machinery is currently located in the agricultural variable prescription map, obtain the corresponding application value of the field based on the application area of the field where the machinery is located, highlight the application value of the field and send it to the agricultural operation execution agency for synchronous execution.
2. The method for dynamic matching of agricultural variable prescription maps according to claim 1, characterized in that, S1. Convert unstructured agricultural variable prescription files into structured data, including: Read the agricultural variable prescription file in ESRIShapefile format, check whether the agricultural variable prescription file meets the requirements of completeness and compliance. If it does, extract the shape of each field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates from the agricultural variable prescription file, and identify whether each field shape has nested shapes. If they do, store the outer shape of the field and the corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates of the nested shapes as a two-dimensional array. If they do not, store the non-nested shape of the field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates as a one-dimensional array. Then, aggregate the field shapes into a three-dimensional array based on all the one-dimensional and two-dimensional arrays. Extract the attribute values corresponding to each attribute field from the agricultural variable prescription file according to the field shape index, filter out the numerical fields related to agricultural variable operations from all attribute field values, and bind the three-dimensional array to the field application value corresponding to the filtered numerical fields; Sort the application values of the bound fields to obtain the maximum and minimum application values of the fields, and store the maximum and minimum application values of the fields as attribute boundary intervals.
3. The method for dynamic matching of agricultural variable prescription maps according to claim 2, characterized in that, S2. Convert the WGS-84 geodetic coordinate system latitude, longitude, and altitude coordinates to ECEF geocentric-earth-fixed coordinate system coordinates, and then convert the ECEF geocentric-earth-fixed coordinate system coordinates to ENU northeast-sky coordinate system coordinates, including: The ECEF coordinate components are calculated using the following formula: , , , Where X is the eastward component, Y is the northward component, Z is the celestial component, and R is the radius of curvature of the zonal loop. ,in, The square of the eccentricity R is the square of the latitude, h is the vertex elevation, and R+h is the projected distance along the latitude direction. Will The ECEF coordinates of each field vertex are used and stored in association with the field shape index; The initial positioning point's latitude, longitude, and altitude coordinates in the WGS-84 geodetic coordinate system are obtained from the initial positioning data of agricultural machinery. The ECEF coordinates of the initial positioning point are calculated according to the ECEF coordinate component calculation formula. ; ECEF coordinates of each field vertex Calculate its ECEF coordinates relative to the initial positioning point. The difference is used to obtain the relative position of the field vertex in the ECEF geocentric geofixed coordinate system with respect to the initial positioning point. : , , , Latitude based on the initial positioning point ,longitude Construct the rotation matrix M for transforming the ECEF geocentric Earth-fixed coordinate system to the ENU northeast-sky coordinate system. The rotation matrix M is expressed as: , Relative position of ECEF geocentric and Earth-fixed coordinate system Multiplying by the rotation matrix M yields the ENU northeast-sky coordinates for each field.
4. The method for dynamic matching of agricultural variable prescription maps according to claim 1, characterized in that, S3. Construct a 2D planar map component based on a lightweight map component, convert the ENU Northeast Celestial coordinate system coordinates into a drawing path object for the 2D planar map component, and draw the polygonal boundaries of the fields based on the drawing path object to obtain multiple field application areas bound to the field application values, including: Build a 2D planar map component based on lightweight map components; The coordinate units are converted to pixel units according to the preset mapping ratio, and the origin of the ENU Northeast Sky Coordinate System is mapped to the screen reference point of the 2D planar map component. Indexed by field shape, read the ENU northeast-north-sky coordinates of a single field, convert them to pixel-unit vertices according to a preset mapping ratio, and add the vertex coordinates to the polygon in sequence based on the polygon construction function; For non-nested shapes, a single polygon is added to the PainterPath drawing path object. For nested shapes, several polygons are generated sequentially from the outside to the inside and added to the PainterPath drawing path object in order. Finally, all the shapes are generated into corresponding PainterPath drawing path objects, which are then associated with the shape index of the shape and stored in the shape path array. Based on the field shape index, the application rate value of each field is bound to the corresponding application rate area, resulting in multiple application rate areas bound to the application rate value of the field.
5. The method for dynamic matching of agricultural variable prescription maps according to claim 4, characterized in that, S4. Based on the attribute boundary interval and color gradient formula, determine the color corresponding to the application value of each field. Use the odd-even fill rule to determine whether to fill the application area of each field with color. If the determination result is to fill, fill the corresponding application area of the field with color according to the determined color to obtain an agricultural variable prescription map, including: Based on the attribute boundary intervals and the field application area bound to the field application value, determine multiple base colors and interval proportions for segmented gradients. The total step size is calculated based on the maximum (max) and minimum (min) values of the attribute boundary intervals. ; The attribute boundary intervals are divided according to the aforementioned interval proportions to obtain multiple sub-intervals. Then, the sub-interval to which each field application value belongs is identified, and the starting and ending colors from the base colors are selected accordingly. These colors are then substituted into the color gradient formula to calculate the unique RGB color corresponding to the field application value. The color gradient formula is as follows: , in, S represents the application rate per field, A represents the starting color, and B represents the ending color. Starting from the point to be judged, draw an infinitely extending ray in the field layer using the odd-even fill rule. Count the number of intersections between the ray and all boundaries of the field. If the number of intersections is odd, the intersection point is determined to be within the effective interior of the field application area and needs to be filled with color. If the number of intersections is even, the intersection point is determined to be outside the area or inside a nested shape and the current field application area is not filled with color. After judging all intersection points, the agricultural variable prescription map is obtained.
6. The method for dynamic matching of agricultural variable prescription maps according to claim 4, characterized in that, Based on real-time positioning data of agricultural machinery, the application area of the current field where the machinery is located is matched in the agricultural variable prescription map. The corresponding application value for the field is obtained based on the application area, and this value is highlighted and sent to the agricultural operation execution agency for synchronous execution, including: Real-time positioning data is obtained from the positioning module of the agricultural machinery, and the positioning data includes the latitude, longitude and altitude coordinates of the current position of the machinery in the WGS-84 geodetic coordinate system. The machine's current location in the WGS-84 geodetic coordinate system is converted to the ENU Northeast Atlas coordinate system. The converted coordinates are then mapped to the map's screen display coordinate system using a dynamic interactive matrix in the 2D planar map component, in order to determine the machine's real-time location on the map. The 2D planar map component's area detection interface is called to determine the field application area to which the real-time location of the machinery belongs. If a matching field application area is found, the field application value is associated with the stored field shape index, highlighted on the planar map, and encapsulated into a data message according to a preset standardized format. The encapsulated data message is then sent to the agricultural operation execution agency for synchronous execution via the CAN communication protocol.
7. A dynamic matching device for agricultural variable prescription maps based on real-time positioning of agricultural machinery, characterized in that, include: The file parsing module is used to convert unstructured agricultural variable prescription files into structured data, which includes WGS-84 geodetic coordinates with field shape association, field application values, and attribute boundary intervals. The geographic coordinate transformation module is used to convert the latitude, longitude and altitude coordinates of the WGS-84 geodetic coordinate system into the ECEF geocentric geofixed coordinate system coordinates, and then convert the ECEF geocentric geofixed coordinate system coordinates into the ENU northeast-sky coordinate system coordinates. The map processing module is used to: construct a 2D planar map component based on a lightweight map component, convert the ENU northeast-sky coordinate system coordinates into a drawing path object of the 2D planar map component, draw the polygonal boundaries of the fields based on the drawing path object, and obtain multiple field application areas bound to the field application values. Based on the attribute boundary interval and color gradient formula, the color corresponding to the application value of each field is determined. The odd-even filling rule is used to determine whether the application area of each field should be filled with color. If the determination result is to fill, the corresponding application area of the field is filled with color according to the determined color to obtain the agricultural variable prescription map. The synchronization module is used to match the application area of the field where the current machine is located in the agricultural variable prescription map based on the real-time positioning data of the agricultural machinery, obtain the corresponding application value of the field based on the application area of the field, highlight the application value of the field and send it to the agricultural operation execution agency for synchronous execution.
8. The dynamic matching device for agricultural variable prescription maps according to claim 7, characterized in that, Converting unstructured agricultural variable prescription files into structured data includes: Read the agricultural variable prescription file in ESRIShapefile format, check whether the agricultural variable prescription file meets the requirements of completeness and compliance. If it does, extract the shape of each field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates from the agricultural variable prescription file, and identify whether each field shape has nested shapes. If they do, store the outer shape of the field and the corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates of the nested shapes as a two-dimensional array. If they do not, store the non-nested shape of the field and its corresponding WGS-84 geodetic coordinate system latitude, longitude and height coordinates as a one-dimensional array. Then, aggregate the field shapes into a three-dimensional array based on all the one-dimensional and two-dimensional arrays. Extract the attribute values corresponding to each attribute field from the agricultural variable prescription file according to the field shape index, filter out the numerical fields related to agricultural variable operations from all attribute field values, and bind the three-dimensional array to the field application value corresponding to the filtered numerical fields; Sort the application values of the bound fields to obtain the maximum and minimum application values of the fields, and store the maximum and minimum application values of the fields as attribute boundary intervals.
9. A dynamic matching device for agricultural variable prescription maps based on real-time positioning of agricultural machinery, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the dynamic matching method for agricultural variable prescription maps based on real-time positioning of agricultural machinery as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for dynamic matching of agricultural variable prescription maps based on real-time positioning of agricultural machinery as described in any one of claims 1 to 6.