Commercial vehicle passing prefecture matching method and device based on spatial geometry and coordinate system conversion, equipment and storage medium

By acquiring and repairing the administrative boundary data of commercial vehicles, performing nonlinear coordinate transformation and geohash coding matching, the problem of accurate matching of commercial vehicle trajectory data was solved, realizing the real-time analysis needs of large-scale fleets and improving system stability and accuracy.

CN122155453APending Publication Date: 2026-06-05DONGFENG LIUZHOU MOTOR

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DONGFENG LIUZHOU MOTOR
Filing Date
2026-02-11
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, the coordinate data output by commercial vehicle positioning devices has a non-linear deviation from the coordinate system of official domestic geographic data, resulting in inaccurate matching of administrative region boundaries. Furthermore, relying on online geocoding services makes it difficult to adapt to the real-time analysis needs of large-scale fleets, and the system is prone to crashes due to abnormal data.

Method used

By employing a method based on spatial geometry and coordinate system transformation, the boundary data of higher and lower administrative regions are obtained, geometric repair and nonlinear coordinate transformation are performed, and the matching logic is optimized by combining geohashing coding to achieve accurate matching of vehicle trajectory data.

Benefits of technology

The system resolved coordinate system bias and boundary topology errors, improved matching efficiency, reduced reliance on online services, ensured data coverage of prefecture-level cities and special administrative regions nationwide, and enhanced system stability and matching accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122155453A_ABST
    Figure CN122155453A_ABST
Patent Text Reader

Abstract

The application discloses a commercial vehicle passing city level matching method and device based on space geometry and coordinate system conversion, equipment and storage medium, relates to the vehicle trajectory data analysis technical field, and includes the following steps: obtaining upper administrative region boundary data based on a preset reference administrative division code, and extracting the upper administrative division code according to the upper administrative region boundary data; obtaining lower administrative region boundary data according to the upper administrative division code, and performing special administrative region identification processing on the lower administrative region boundary data to obtain an original administrative region boundary data set; sequentially performing geometric repair and coordinate system conversion on the original administrative region boundary data set to obtain standard administrative region boundary data; and performing batch space matching on vehicle trajectory data based on the standard administrative region boundary data to obtain trajectory data with administrative region labels, so that high-precision and high-robustness batch space matching of vehicle trajectory data and administrative region boundaries is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of vehicle trajectory data analysis technology, and in particular to a method, device, equipment, and storage medium for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation. Background Technology

[0002] With the deep integration of smart logistics and vehicle networking technology, accurate analysis of commercial vehicle trajectory data has become a core support for transportation cost accounting, route optimization and regional operation decision-making, and accurate identification of the administrative regions through which vehicles pass is a fundamental link in this process.

[0003] However, existing technical solutions face multiple bottlenecks. The coordinate data output by commercial vehicle positioning devices has a non-linear deviation from the coordinate system used by official domestic geographic data, and direct matching is prone to significant positional offsets at administrative boundaries. Public administrative boundary data is often accompanied by topological errors, leading to spatial query failures or distorted results. The traditional model relying on online geocoding services is limited by call frequency, network latency, and service costs, making it difficult to adapt to the real-time analysis needs of large-scale fleets. Furthermore, it lacks effective handling of abnormal data and is prone to system crashes due to damage to geometric data or abnormal coordinate points.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this invention is to provide a method, apparatus, device, and storage medium for matching the routes of commercial vehicles through prefecture-level cities based on spatial geometry and coordinate system transformation, aiming to solve the technical problem of inaccurate matching of administrative regions for vehicles due to coordinate system deviation, boundary topology errors, and online service dependence.

[0006] To achieve the above objectives, this invention provides a method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation. The method includes the following steps:

[0007] Obtain the boundary data of the superior administrative region based on the preset benchmark administrative division code, and extract the superior administrative division code based on the superior administrative region boundary data; Obtain the boundary data of the lower-level administrative regions based on the higher-level administrative division code, and perform special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set; The original administrative region boundary data set is sequentially subjected to geometric repair and coordinate system transformation to obtain standard administrative region boundary data; Based on the standard administrative region boundary data, batch spatial matching of vehicle trajectory data is performed to obtain trajectory data with administrative region labels.

[0008] In one embodiment, the step of obtaining the boundary data of the superior administrative region based on the preset benchmark administrative division code, and extracting the superior administrative division code based on the superior administrative division boundary data, includes: The first data request is constructed based on the preset benchmark administrative division code; The first data request is sent to the geographic data server so that the geographic data server returns the boundary data of the superior administrative region according to the first data request. The system receives the boundary data of the superior administrative region returned by the geographic data server, and extracts the provincial administrative division code and the name of the provincial administrative region from the boundary data of the superior administrative region to obtain the superior administrative division code.

[0009] In one embodiment, the step of obtaining lower-level administrative region boundary data based on the higher-level administrative division code, and performing special administrative region identification processing on the lower-level administrative region boundary data to obtain the original administrative region boundary data set includes: The code of the superior administrative division is truncated according to the preset coding derivation rules to obtain the code of the subordinate administrative division request. Construct a second data request based on the lower-level administrative division request code; The second data request is sent to the geographic data server so that the geographic data server returns the boundary data of the lower-level administrative region according to the second data request. Identify target area data in the superior administrative region boundary data that meets the preset special administrative region identification conditions, and directly use the target area data as special administrative region boundary data; The boundary data of the lower-level administrative regions and the boundary data of the special administrative regions are merged to obtain the original set of administrative region boundary data.

[0010] In one embodiment, the step of sequentially performing geometric restoration and coordinate system transformation on the original administrative region boundary data set to obtain standard administrative region boundary data includes: The geometric description information in the original administrative region boundary data set is parsed and transformed using spatial geometry processing tools to obtain the original boundary geometric objects. The original boundary geometry object is determined to have topological defects by a topological validity verification strategy. If topological defects exist, a buffer repair operation is performed on the original boundary geometry object to obtain a repaired boundary geometry object. Based on a preset nonlinear coordinate transformation model, the repaired boundary geometric object is subjected to coordinate system transformation to obtain the transformed boundary geometric object. The centroid of the transformed boundary geometric object is calculated and geohashed to generate standard administrative region boundary data.

[0011] In one embodiment, the step of performing coordinate system transformation on the repaired boundary geometric object based on a preset nonlinear coordinate transformation model to obtain the transformed boundary geometric object includes: Calculate the longitude and latitude offsets relative to the preset geographic center point based on the latitude and longitude coordinates in the repaired boundary geometric object; Based on the longitude offset, the latitude offset, the preset polynomial coefficients, and the preset trigonometric function coefficients, the coordinate correction amount is determined, wherein the coordinate correction amount includes the latitude direction correction amount and the longitude direction correction amount; The latitude radian value is calculated based on the latitude offset, and the ellipsoid correction coefficient and angle conversion coefficient are calculated based on the latitude radian value, the preset Earth equatorial radius, the preset Earth ellipsoid eccentricity, and the preset pi value. The coordinate offset of the repaired boundary geometric object is calculated based on the coordinate correction amount, the angle transformation coefficient, and the ellipsoid correction coefficient to obtain the transformed boundary geometric object.

[0012] In one embodiment, the step of performing batch spatial matching of vehicle trajectory data based on the standard administrative region boundary data to obtain trajectory data with administrative region labels includes: Read vehicle trajectory data and extract coordinate data to be matched from the vehicle trajectory data; The coordinate system of the coordinate data to be matched is transformed according to the preset nonlinear coordinate transformation model to obtain the transformed coordinate data. Candidate administrative region boundary data are selected from the standard administrative region boundary data based on the transformed coordinate data; Spatial inclusion determination is performed on the transformed coordinate data and the candidate administrative region boundary data to obtain the administrative region matching result; Based on the administrative region matching results, tags are appended to the vehicle trajectory data to obtain trajectory data with administrative region tags.

[0013] In one embodiment, the step of filtering candidate administrative region boundary data from the standard administrative region boundary data based on the transformed coordinate data includes: Generate a geohash code for the point to be matched based on the transformed coordinate data; The geohash codes of each administrative region in the standard administrative region boundary data are compared with the geohash codes of the points to be matched to obtain the first candidate administrative region set; Based on the preset adjacent area judgment rules, the region codes adjacent to the geohash codes of the point to be matched are identified, and a set of adjacent geohash codes is obtained. The adjacent geohash code set is compared with the geohash codes of each administrative region in the standard administrative region boundary data to obtain the second candidate administrative region set; The first set of candidate administrative regions and the second set of candidate administrative regions are merged and deduplicated to obtain the boundary data of candidate administrative regions. The step of performing spatial inclusion determination on the transformed coordinate data and the candidate administrative region boundary data to obtain the administrative region matching result includes: Construct a geometric object of the point to be matched based on the transformed coordinate data; Traverse the geometric objects of each administrative region boundary in the candidate administrative region boundary data, and use a spatial inclusion judgment strategy to detect the inclusion relationship between the geometric objects of the point to be matched and the current administrative region boundary geometric objects to obtain the detection results; When the detection result indicates that an inclusion relationship is found, the administrative division code and administrative division name of the corresponding administrative region are extracted as the administrative region matching result.

[0014] Furthermore, to achieve the above objectives, the present invention also proposes a matching device for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation, the device comprising: The superior data acquisition module is used to acquire superior administrative region boundary data based on a preset benchmark administrative division code, and extract superior administrative division code based on the superior administrative region boundary data; The hierarchical data acquisition module is used to obtain the boundary data of the lower-level administrative regions based on the code of the higher-level administrative division, and to perform special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set. The boundary data processing module is used to perform geometric repair and coordinate system transformation on the original administrative region boundary data set in sequence to obtain standard administrative region boundary data. The batch matching module is used to perform batch spatial matching of vehicle trajectory data based on the standard administrative region boundary data to obtain trajectory data with administrative region labels.

[0015] Furthermore, to achieve the above objectives, the present invention also proposes a commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation. The device includes: a memory, a processor, and a commercial vehicle transit through prefecture-level cities matching program based on spatial geometry and coordinate system transformation stored in the memory and executable on the processor. The commercial vehicle transit through prefecture-level cities matching program based on spatial geometry and coordinate system transformation is configured to implement the steps of the commercial vehicle transit through prefecture-level cities matching method based on spatial geometry and coordinate system transformation as described above.

[0016] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a commercial vehicle transit through prefecture-level cities matching program based on spatial geometry and coordinate system transformation. When the commercial vehicle transit through prefecture-level cities matching program based on spatial geometry and coordinate system transformation is executed by a processor, it implements the steps of the commercial vehicle transit through prefecture-level cities matching method based on spatial geometry and coordinate system transformation as described above.

[0017] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the commercial vehicle route-through-prefecture-level-city matching method based on spatial geometry and coordinate system transformation as described above.

[0018] One or more technical solutions proposed in this application have at least the following technical effects: By employing a precise nonlinear coordinate transformation model, the matching deviation problem caused by different coordinate systems is resolved. Simultaneously, geometric repair processing corrects boundary topological errors, ensuring the accuracy of spatial inclusion relationship judgments and effectively reducing the probability of misjudgments and omissions across administrative regions. Localized collection and storage of administrative region boundary data eliminates reliance on online geocoding services, removing limitations on call frequency and network latency. Furthermore, geohashing spatial indexing optimizes the matching logic, significantly improving the matching efficiency of large-scale trajectory data, adaptable to the real-time analysis needs of fleets exceeding ten thousand. A three-tiered collection strategy—upper-level, lower-level, and special administrative regions—is adopted, with dedicated processing rules developed for municipalities and special administrative regions, ensuring complete coverage of boundary data for all prefecture-level and special administrative regions nationwide, without data omissions or redundancy. A multi-level anomaly handling mechanism is constructed, including network request retry, coordinate validity judgment, and geometric judgment anomaly capture, effectively handling abnormal scenarios such as invalid data, network fluctuations, and geometric data corruption, preventing system crashes and improving operational stability. It uses a well-known text standard format to store geometric data, supports parsing and processing by mainstream spatial geometry libraries, and outputs results in a common table format, which can be directly connected to subsequent business systems such as trajectory analysis and cost accounting, reducing data integration costs. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating an embodiment of the method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation in this application. Figure 2 This is the overall system architecture diagram provided for Embodiment 1 of the matching method for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation in this application; Figure 3 This is a flowchart illustrating Embodiment 2 of the method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation in this application. Figure 4 This is a schematic diagram of the module structure of a commercial vehicle matching device for passing through prefecture-level cities based on spatial geometry and coordinate system transformation, according to an embodiment of this application. Figure 5 This is a schematic diagram of the equipment structure of the hardware operating environment involved in the matching method for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation in the embodiments of this application.

[0022] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0023] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0024] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0025] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions, such as a commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation. The following description uses a commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation as an example to illustrate this embodiment and the subsequent embodiments.

[0026] Based on this, embodiments of this application provide a method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the matching method for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation in this application.

[0027] In this embodiment, the commercial vehicle transit city matching method based on spatial geometry and coordinate system transformation includes steps S10~S40: Step S10: Obtain the boundary data of the superior administrative region based on the preset reference administrative division code, and extract the superior administrative division code according to the boundary data of the superior administrative region. The overall working process of the system is as follows Figure 2 As shown, the system of the present invention realizes the accurate matching of commercial vehicles passing through prefecture-level cities through modular design. The core includes three core modules: the urban boundary data preprocessing module, the coordinate system conversion and geometric repair module, and the batch trajectory matching module. Each module works in coordination to form a complete technical link of "data collection - preprocessing - matching - output", realizing the full-process processing from the original GPS trajectory data to the trajectory data with urban labels.

[0028] The core function of the urban boundary data preprocessing module is to obtain complete and standardized urban boundary data across the country through a hierarchical collection strategy and perform structured storage, providing high-quality basic data support for subsequent matching. The coordinate system conversion and geometric repair module is the core to solve the matching deviation and topological defect problems in the existing technology. It is divided into a coordinate system conversion sub-module and a geometric repair sub-module, realizing the conversion from the original GPS coordinates to the coordinates for matching, and the integrity repair of the urban boundary geometric data. The urban boundary geometric repair sub-module adopts the "buffer repair method" (buffer(0)) to quickly repair the geometric data for the topological errors such as self-intersection and non-closure existing in the collected urban boundary data. The batch trajectory matching module realizes the batch matching of large-scale commercial vehicle GPS trajectory data. The core is to judge whether the converted GCJ-02 coordinates are within the boundary of a certain city based on the repaired urban boundary geometric objects.

[0029] It should be noted that the preset reference administrative division code refers to the unique code used to identify the national reference administrative region, that is, 100000 in this embodiment, and this code is used as the entry identifier for data requests. Additionally, the boundary data of the superior administrative region refers to the data set containing the geometric information and attribute information of the provincial administrative region boundary, where the attribute information includes the provincial administrative division code and the provincial administrative region name, and is obtained through the geographic data open interface in this embodiment. Further, the superior administrative division code refers to the code used to uniquely identify the provincial administrative region, following the national unified coding rule, and the format is a six-digit digital code with the first two digits being the exclusive code for the province and the last four digits fixed as zero, which is expressed as the form of adcode province, that is, administrative division code provincial = AB0000 in this embodiment.

[0030] Understandably, the process involves obtaining the boundary data of higher-level administrative regions based on a preset benchmark administrative division code. This means sending a data request to the geographic data server based on the benchmark code and receiving the returned provincial-level administrative region data. The higher-level administrative division code is then extracted from the boundary data, i.e., the provincial-level administrative division code and the name of the provincial-level administrative region are parsed from the obtained data to obtain the higher-level administrative division code.

[0031] In practical implementation, taking a country as an example, suppose that the country uses a six-digit code to identify administrative regions, where the first two digits identify the first-level administrative region, and the last four digits are fixed at zero to indicate the first-level administrative level. Using the national baseline code 100000 as the entry point, the boundary data and attribute information of all first-level administrative regions in the country can be obtained. Taking a certain first-level administrative region code 320000 as an example, according to the coding derivation rules, the first two core digits 32 are extracted and padded with zeros to restore 320000. This is used to construct a request to obtain the boundary data of all second-level administrative regions within this first-level administrative region. For special administrative cities established within this country, whose administrative level is first-level but actually need to be matched as second-level, this can be automatically identified through the rule that the last four digits of the code are zero and the name matches, directly using their first-level boundary data as second-level boundary data, avoiding duplicate collection. The core fields such as administrative division code, administrative region name, and boundary geometric information are extracted from the collected boundary data at each level. These are then converted into standard geometric objects using a spatial geometry library. The centroid coordinates are calculated, and a six-bit geohash code is generated for fast spatial indexing. Finally, the data is stored as a local file in a standardized format to ensure compatibility for subsequent geometric repair and inclusion relationship determination.

[0032] In one implementation, a three-tiered data collection mechanism of "provincial level → prefecture level → special administrative region" is adopted to achieve accurate data acquisition and ensure coverage of all prefecture-level cities and special administrative regions nationwide.

[0033] Level 1: Provincial-level administrative region acquisition. Using the national baseline administrative division code (adcode=100000) as the entry point, a request URL is constructed and the interface is called to obtain the boundary data and attribute information (including provincial adcode, administrative region name, etc.) of all provincial-level administrative regions nationwide. The provincial adcode follows the nationally unified coding rules, with the following format:

[0034] In the formula, AB is a province-specific code (with a value range of 11 to 65, such as 11 representing city a, 31 representing city b, 50 representing city c, etc.), and the last four digits are fixed as 0000, which is used to identify the provincial administrative level.

[0035] Level 2: Data acquisition at the prefecture-level city level. For each provincial-level administrative region, the request code for the prefecture-level administrative region is derived from the provincial-level adcode. The specific derivation formula is as follows:

[0036] In the formula, The formula uses a rounding down sign. It extracts the first two core digits of the provincial ID code, padding them with zeros to restore the provincial base code. This base code is then used to construct the request URL, which is used to call the API to retrieve the boundary data (including the prefecture-level ID code, city name, and boundary geometry information) of all prefecture-level cities within that province. For example, if the provincial ID code is 320000, the formula derives request_code = 320000, allowing the API call to obtain the boundary data of all prefecture-level cities within that province.

[0037] Level 3: Special Administrative Region Processing. Given the unique characteristics of municipalities and special administrative regions (their administrative level is provincial, but they actually need to be matched as city-level data), their provincial boundary data is directly used as city-level boundary data. During the data collection process, these regions are automatically identified based on the rule that the last four digits of the adcode are 0000 and the name matches, eliminating the need to acquire additional prefecture-level data and avoiding data redundancy.

[0038] The collected city boundary data at various levels were structured, and core fields were extracted: adcode (unique identifier of administrative division), name (city name), and geometry (boundary geometric information). The geometry field was converted into a standard geometric object using the Shapely spatial geometry library, and the centroid coordinates (latitude and longitude) of the geometric object were calculated. A 6-bit GeoHash code (geohash6) was generated using the GeoHash encoding algorithm for subsequent rapid spatial indexing. Finally, the processed data was stored in JSON format as a local file (city_bound.json). Among them, the WKT (Well-Known Text) format is used to unify the representation of geometric data, ensuring compatibility in subsequent geometric repair and inclusion relationship determination.

[0039] In one feasible implementation, step S10 includes steps A11 to A13: Step A11: Construct the first data request based on the preset benchmark administrative division code; The preset baseline administrative division code has been explained in step S10 and will not be repeated here. It should be noted that the first data request refers to the network request instruction generated based on the preset baseline administrative division code for obtaining the boundary data of the superior administrative region. This instruction includes a request address and request parameters. In this embodiment, the request address is constructed based on the Uniform Resource Locator template, and the parameter to be filled is the administrative division code.

[0040] Understandably, the first data request is constructed based on the preset benchmark administrative division code, that is, a data acquisition instruction containing a Uniform Resource Locator and request parameters is generated according to the benchmark code. In this embodiment, 100000 is filled into the request address template to form a complete request.

[0041] Step A12: Send the first data request to the geographic data server so that the geographic data server returns the boundary data of the superior administrative region based on the first data request; It should be noted that the geographic data server refers to the server-side device that provides data storage and query services for administrative region boundaries, i.e., in this embodiment, the server-side device corresponding to the geographic data open interface. Furthermore, the boundary data of the superior administrative region has already been described in step S10 and will not be repeated here.

[0042] Understandably, the first data request is sent to the geographic data server, that is, the constructed request instruction is transmitted to the server through the network protocol, so that the server can parse the preset benchmark administrative division code in the request parameters and return the corresponding superior administrative boundary data.

[0043] Step A13: Receive the boundary data of the superior administrative region returned by the geographic data server, and extract the provincial administrative division code and the name of the provincial administrative region from the boundary data of the superior administrative region to obtain the superior administrative division code.

[0044] The geographic data server, the boundary data of the superior administrative region, the provincial administrative division code, the name of the provincial administrative region, and the superior administrative division code have all been explained in the previous steps, and will not be repeated here.

[0045] Understandably, receiving the boundary data of the superior administrative region returned by the geographic data server means receiving the response data transmitted by the server through network communication, and extracting the provincial administrative division code and the name of the provincial administrative region from the data, and combining them to obtain the superior administrative division code.

[0046] Step S20: Obtain the boundary data of the lower-level administrative regions based on the code of the higher-level administrative division, and perform special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set; It should be noted that the lower-level administrative region boundary data refers to a data set containing geometric and attribute information of prefecture-level administrative region boundaries, i.e., boundary data of administrative levels such as prefecture-level cities, regions, autonomous prefectures, and leagues. In this embodiment, the corresponding request code is obtained through a preset encoding derivation rule and then requested from the geographic data server. Additionally, the special administrative region identification processing refers to the operation of identifying and processing regions with special administrative level attributes separately. Specifically, in this embodiment, the identification processing is performed on the four municipalities directly under the central government (locations 1, 2, 3, and 4) and the two special administrative regions (locations 5 and 6). Furthermore, the original administrative region boundary data set refers to the complete data set after merging the lower-level administrative region boundary data and the special administrative region boundary data, used for subsequent geometric repair and coordinate system transformation.

[0047] Understandably, the process involves obtaining lower-level administrative region boundary data based on the higher-level administrative division code. This means calculating the lower-level administrative division request code based on the extracted provincial codes using preset coding derivation rules, and then requesting the corresponding prefecture-level administrative region data from the geographic data server. Special administrative region identification processing is then performed on the lower-level administrative region boundary data. This involves identifying target regions within the higher-level administrative region boundary data that meet the criteria of having the last four digits of the administrative division code being zero and the region name matching a preset set of special administrative region names. These target regions are then directly used as the lower-level administrative region boundary data, resulting in the original administrative region boundary data set.

[0048] In one feasible implementation, step S20 includes steps A21 to A25: Step A21: Truncate the code of the superior administrative division according to the preset coding derivation rules to obtain the code of the subordinate administrative division request; It should be noted that the preset encoding derivation rule refers to the calculation rule used to calculate the lower-level administrative division request code from the higher-level administrative division code. Specifically, in this embodiment, it is the rule for rounding down the higher-level administrative division code. This is expressed as request_code equals adcode (province), which is the administrative division code (province) divided by 10000, rounded down, and then multiplied by 10000. The rounding down symbol indicates that the value is rounded down. Furthermore, the lower-level administrative division request code refers to the encoding parameter used to request lower-level administrative division boundary data from the geographic data server, which is calculated in this embodiment using the aforementioned derivation formula.

[0049] Understandably, the code of the superior administrative division is truncated according to the preset coding derivation rules. That is, the superior code is numerically processed according to the rounding down operation rules, the first two core codes are extracted and zeros are added to restore it to the provincial base code, and the lower administrative division request code is obtained.

[0050] Step A22: Construct a second data request based on the lower-level administrative division request code; It should be noted that the second data request refers to the network request instruction generated based on the lower-level administrative division request code for obtaining the boundary data of the lower-level administrative division. In this embodiment, it is also constructed based on the Uniform Resource Locator template, where the parameter to be filled is the calculated lower-level administrative division request code.

[0051] Understandably, a second data request is constructed based on the request code of the lower-level administrative division, that is, a data acquisition instruction containing the request address and parameters is generated based on the derived request code.

[0052] Step A23: Send the second data request to the geographic data server so that the geographic data server returns the lower-level administrative region boundary data according to the second data request; The geographic data server and the boundary data of lower-level administrative regions have been explained in the previous steps and will not be repeated here.

[0053] Understandably, the second data request is sent to the geographic data server, that is, the request instruction is transmitted to the server through network communication, so that the server can return the corresponding lower-level administrative region boundary data according to the lower-level administrative region request code.

[0054] Step A24: Identify target area data in the upper-level administrative region boundary data that meets the preset special administrative region identification conditions, and directly use the target area data as the special administrative region boundary data; It should be noted that the preset special administrative region identification conditions refer to the judgment rules used to identify regions with special administrative level attributes. In this embodiment, the conditions are that the last four digits of the administrative division code are all zero and the region name matches the preset set of special administrative region names. The preset set of special administrative region names includes four municipalities directly under the central government (Location 1, Location 2, Location 3, and Location 4) and two special administrative regions (Location 5 and Location 6), with corresponding administrative division codes of 110000, 120000, 310000, 500000, 810000, and 820000, respectively. Furthermore, the target region data refers to specific region data that meets the preset special administrative region identification conditions in the higher-level administrative region boundary data. Further, the special administrative region boundary data refers to the result data where the target region data is directly used as the lower-level administrative region boundary data.

[0055] Understandably, identifying target area data that meets preset special administrative region identification conditions within the higher-level administrative region boundary data involves filtering the higher-level data to find area records that conform to specific coding rules and name characteristics. Directly using the target area data as special administrative region boundary data means that the identified data is directly incorporated into the lower-level data set without additional requests.

[0056] Step A25: Merge the boundary data of lower-level administrative regions and the boundary data of special administrative regions to obtain the original set of administrative region boundary data.

[0057] The data sets of lower-level administrative region boundaries, special administrative region boundaries, and original administrative region boundaries have all been explained in the previous steps and will not be repeated here.

[0058] Understandably, merging the boundary data of lower-level administrative regions and the boundary data of special administrative regions involves integrating the prefecture-level data obtained through requests with the identified special administrative region data into a unified data set, thus obtaining the original administrative region boundary data set.

[0059] Step S30: Perform geometric repair and coordinate system transformation on the original administrative region boundary data set in sequence to obtain standard administrative region boundary data; It should be noted that geometric repair refers to the operation of correcting boundary geometric data with topological errors. In this embodiment, the spatial geometry library Shapely is used to repair boundary data with defects such as self-intersection and non-closure. Shapely is a Python library for manipulating and analyzing planar geometric objects, providing the `is_valid` method (validity judgment method) to determine the topological validity of geometric objects, and the `buffer` method (buffering method) to perform buffer repair operations. Furthermore, coordinate system transformation refers to the process of converting coordinate data from one coordinate system to another. In this embodiment, it involves converting the original coordinate system data to the matching coordinate system data, specifically involving the conversion between the first coordinate system (WGS84 coordinate system, also known as the World Geodetic System 1984) and the second coordinate system (GCJ-02 coordinate system, also known as the State Bureau of Surveying and Mapping coordinate system). Further, standard administrative region boundary data refers to the standardized administrative region boundary data after geometric repair and coordinate system transformation, which can be directly used for spatial matching calculations. In this embodiment, it is stored in JSON format (JavaScript Object Notation), containing a textual representation of the administrative division code, administrative region name, geohash code, and boundary geometric information.

[0060] Understandably, the original administrative region boundary data set is subjected to geometric repair and coordinate system transformation in sequence. That is, the topological errors in the data set are first corrected by using spatial geometric processing tools, and then the repaired data is transformed by using a preset nonlinear coordinate transformation model to obtain standard administrative region boundary data.

[0061] In the specific implementation, to address the incompatibility issue between commercial vehicle GPS data (WGS84 coordinate system) and urban boundary data (GCJ-02 coordinate system), a nonlinear transformation model is used to achieve accurate coordinate transformation. The transformation process is as follows: first, determine whether the coordinates are located within China. If they are within China, perform a nonlinear transformation; otherwise, return the original coordinates directly (to avoid invalid transformation).

[0062] Formula for determining domestic coordinates

[0063] In the formula, lng is longitude and lat is latitude; if the coordinates meet the above conditions, they are determined to be domestic coordinates and subsequent conversion is performed; otherwise, they are foreign coordinates and the original coordinates are returned directly.

[0064] The core of the nonlinear transformation mathematical model is to achieve coordinate offset correction through the calculation of correction amounts. The calculation formulas for the correction amounts (dlat: latitude correction amount, dlng: longitude correction amount) are as follows:

[0065]

[0066] In the formula, , (Offset correction based on the geographic center of China); (Pi).

[0067] Converting the correction values ​​to angular units, we finally obtain the GCJ-02 coordinates (lng_gcj, lat_gcj):

[0068]

[0069] In the formula, the parameters are defined as follows:

[0070]

[0071]

[0072]

[0073] Furthermore, to address topological errors such as self-intersection and non-closure in the collected urban boundary data, a "buffer repair method" (buffer(0)) is used to quickly repair the geometric data. The repair process is as follows: Geometric validity is determined using the `is_valid` method from the Shapely library to check for topological errors in boundary geometric objects (Polygon / MultiPolygon). The `is_valid` method is the core method in the Shapely spatial geometry library used to verify the topological validity of geometric objects, returning a boolean value. A `True` result indicates that the geometric object has no topological defects such as self-intersections, unclosed boundaries, or duplicate vertices, and is topologically valid. A `False` result indicates the presence of such topological errors, requiring subsequent repair operations.

[0074] Buffer repair involves performing a buffer(0) operation on invalid geometric objects, i.e., automatically merging self-intersecting regions and connecting unclosed boundaries through zero-distance buffering. This repair process is completed automatically by spatial geometry algorithms without manual intervention, and is expressed by the following formula:

[0075] In the formula, poly is the original invalid geometry object, and fixed_poly is the repaired geometry object; The validity of the repaired geometric object is verified again. If it is valid and not empty, it is used for subsequent matching. If the repair fails, a warning log is recorded and the city is skipped (to avoid affecting the overall matching process).

[0076] Step S40: Perform batch spatial matching of vehicle trajectory data based on standard administrative region boundary data to obtain trajectory data with administrative region labels.

[0077] It should be noted that vehicle trajectory data refers to a data set recording information about changes in vehicle location during operation. In this embodiment, it includes information such as longitude, latitude, vehicle identification, and time, and is stored in a tabular file format. Furthermore, batch spatial matching refers to the process of determining the spatial location and administrative boundary relationships of a large number of trajectory data points. In this embodiment, efficient data reading and processing are achieved using the data analysis library Pandas. Pandas is an open-source data analysis and processing library that provides the DataFrame data structure for processing tabular data. Further, trajectory data with administrative region labels refers to the result data on top of the original vehicle trajectory data with the administrative region identification information appended; that is, in this embodiment, an administrative division code field and an administrative region name field are appended.

[0078] Understandably, batch spatial matching of vehicle trajectory data is performed based on standard administrative region boundary data. That is, the spatial relationship of each location point in the vehicle trajectory is calculated using the processed standard boundary data to determine its administrative region and obtain trajectory data with administrative region labels.

[0079] In one feasible implementation, step S50 includes steps A31 to A35: Step A31: Read vehicle trajectory data and extract the coordinate data to be matched from the vehicle trajectory data; The vehicle trajectory data has been described in step S40 and will not be repeated here. It should be noted that the coordinate data to be matched refers to the coordinate information extracted from the vehicle trajectory data for spatial matching calculation, that is, data records containing longitude and latitude values, which in this embodiment correspond to the longitude and latitude fields in the table file.

[0080] Understandably, reading vehicle trajectory data involves loading an information file containing the vehicle's trajectory from a storage medium. Extracting the coordinate data to be matched from the vehicle trajectory data involves filtering the latitude and longitude information used for spatial location matching from the loaded data.

[0081] Step A32: Perform coordinate system transformation on the coordinate data to be matched according to the preset nonlinear coordinate transformation model to obtain the transformed coordinate data; It should be noted that the preset nonlinear coordinate transformation model refers to a mathematical calculation model used to convert coordinates from one coordinate system to another. In this embodiment, it is a transformation model from the first coordinate system (WGS84) to the second coordinate system (GCJ-02), constructed based on polynomial and trigonometric function composite operations. This involves the calculation of parameters such as longitude offset, latitude offset, latitude direction correction, longitude direction correction, coordinate correction, ellipsoid correction coefficient, and angle transformation coefficient. Key parameters include the Earth's equatorial radius A (6378245.0), the square of the Earth's ellipsoid eccentricity EE (0.00669342162296594323), and π (3.14159265358979324). Furthermore, the transformed coordinate data refers to the coordinate information after coordinate system transformation, i.e., coordinate data using the same coordinate system as the standard administrative region boundary data. In this embodiment, it refers to coordinates in the second coordinate system, i.e., the GCJ-02 coordinate system.

[0082] Understandably, the coordinate system of the coordinate data to be matched is transformed according to the preset nonlinear coordinate transformation model. That is, the original coordinates are offset and transformed by a mathematical calculation model based on the composite operation of polynomials and trigonometric functions to obtain the transformed coordinate data that is consistent with the coordinate system of the standard administrative region boundary data.

[0083] Step A33: Select candidate administrative region boundary data from the standard administrative region boundary data based on the transformed coordinate data; The transformed coordinate data, standard administrative region boundary data, and candidate administrative region boundary data have all been explained in the previous steps and will not be repeated here.

[0084] Understandably, candidate administrative region boundary data is selected from the standard administrative region boundary data based on the transformed coordinate data. That is, by utilizing the spatial location characteristics of the transformed coordinates, and through geohashing code comparison and neighboring area judgment, a small number of administrative region boundaries that may contain the coordinates are quickly selected from all standard boundary data to obtain candidate administrative region boundary data.

[0085] In one feasible implementation, step A33 includes steps B11 to B15: Step B11: Generate geohash codes for the points to be matched based on the converted coordinate data; It should be noted that the geohash encoding of the point to be matched refers to the string encoding used for spatial indexing generated based on the converted coordinate data, specifically the six-bit character encoding generated by the GeoHash encoding algorithm in this embodiment. Furthermore, GeoHash is a publicly available geocoding system that encodes two-dimensional latitude and longitude coordinates into a one-dimensional string. Rapid spatial region positioning can be achieved through string prefix matching. In this embodiment, the generated encoding is a six-bit GeoHash code, namely geohash6.

[0086] Understandably, the geohash code of the point to be matched is generated based on the converted coordinate data. That is, the GeoHash encoding algorithm is used to calculate the converted latitude and longitude coordinates to obtain a six-bit string code for spatial indexing.

[0087] Step B12: Compare the geohash codes of each administrative region in the standard administrative region boundary data with the geohash codes of the points to be matched to obtain the first candidate administrative region set; It should be noted that the first candidate administrative region set refers to the set of administrative regions that are exactly the same as the geohash code of the point to be matched. In this embodiment, it is obtained by comparing city.geohash6 (city geohash code) with point.geohash6 (point geohash code of the point to be matched).

[0088] Understandably, the geohash codes of each administrative region in the standard administrative region boundary data are compared with the geohash codes of the points to be matched. That is, the six-digit geohash codes of each administrative region in the standard data are compared one by one with the codes of the points to be matched. Administrative regions with the same code values ​​are filtered out to obtain the first set of candidate administrative regions.

[0089] Step B13: Identify the region codes adjacent to the geohash codes of the point to be matched according to the preset adjacent region judgment rules, and obtain the set of adjacent geohash codes; It should be noted that the preset adjacent area judgment rule refers to the judgment rule used to identify the codes of eight directional areas adjacent to a given geohash code. That is, it is an algorithm for determining the surrounding areas based on the character mapping relationship of GeoHash codes. In this embodiment, it is represented as adjacent, i.e., the adjacent judgment function. Furthermore, the adjacent geohash code set refers to the set of codes of eight directional areas that are spatially adjacent to the geohash code of the point to be matched.

[0090] Understandably, the region codes adjacent to the geohash code of the point to be matched are identified according to the preset adjacent region judgment rules. That is, the algorithm based on GeoHash character mapping is used to calculate the adjacent codes in eight directions around the code of the point to be matched, and the set of adjacent geohash codes is obtained.

[0091] Step B14: Compare the set of adjacent geohash codes with the geohash codes of each administrative region in the standard administrative region boundary data to obtain the second candidate administrative region set; It should be noted that the second candidate administrative region set refers to the set of administrative regions that match any code in the adjacent geohash code set. In this embodiment, it is obtained by comparing and filtering city.geohash6, i.e., the city geohash code, with the adjacent geohash code set.

[0092] Understandably, the adjacent geohash code set is compared with the geohash codes of each administrative region in the standard administrative region boundary data. That is, the six-digit geohash code of each administrative region in the standard data is compared one by one with the code in the adjacent set. The administrative regions with matching code values ​​are then selected to obtain the second candidate administrative region set.

[0093] Step B15: Merge the first set of candidate administrative regions and the second set of candidate administrative regions to remove duplicates, and obtain the boundary data of the candidate administrative regions; The first set of candidate administrative regions, the second set of candidate administrative regions, and the boundary data of candidate administrative regions have all been explained in the previous steps, and will not be repeated here.

[0094] Understandably, merging the first and second candidate administrative regions sets to remove duplicates involves integrating the administrative region data from the two candidate sets and eliminating duplicate records to obtain the candidate administrative region boundary data.

[0095] Step A34: Perform spatial inclusion judgment on the transformed coordinate data and candidate administrative region boundary data to obtain the administrative region matching result; The transformed coordinate data, candidate administrative region boundary data, and administrative region matching results have all been explained in the previous steps and will not be repeated here.

[0096] Understandably, spatial inclusion judgment is performed on the transformed coordinate data and the candidate administrative region boundary data. That is, the spatial positional relationship between the transformed coordinate point and the boundary geometric object of each candidate administrative region is calculated to determine whether the point is located inside the boundary of a certain administrative region, thus obtaining the administrative region matching result.

[0097] In one feasible implementation, step A34 includes steps B21-B25: Step B21: Construct the geometric object of the point to be matched based on the transformed coordinate data; It should be noted that the geometric object to be matched refers to the geometric object used for spatial calculation constructed based on the transformed coordinate data. In this embodiment, it is a Point type geometric object constructed using the spatial geometry library Shapely. A Point represents a point on a two-dimensional plane, defined by longitude and latitude coordinates.

[0098] Understandably, the geometric objects of the points to be matched are constructed based on the transformed coordinate data. That is, the spatial geometry processing tool Shapely is used to convert the transformed latitude and longitude coordinates into point geometric objects that can be used for spatial relationship calculations.

[0099] Step B22: Traverse the geometric objects of each administrative region boundary in the candidate administrative region boundary data, and use the spatial inclusion judgment strategy to detect the inclusion relationship between the geometric object to be matched and the current administrative region boundary geometric object to obtain the detection result; It should be noted that the spatial inclusion judgment strategy refers to the spatial analysis method used to determine whether a point geometric object is located inside a face geometric object. Specifically, in this embodiment, the `contains` method of the Shapely library is used, which is the core method in Shapely used to determine whether one geometric object contains another, returning a boolean value. Furthermore, the detection result refers to the boolean value obtained through the spatial inclusion judgment strategy, i.e., the output indicating whether the inclusion relationship is true or false, represented in this embodiment as `match_result`, the matching result.

[0100] Understandably, the process involves traversing the boundary geometry of each administrative region in the candidate administrative region boundary data, i.e., sequentially reading the boundary geometry data of each administrative region in the candidate set. In this embodiment, these are geometry objects of type Polygon or MultiPolygon. A spatial inclusion judgment strategy is used to detect the inclusion relationship between the geometry object to be matched and the current administrative region boundary geometry object. Specifically, the `contains` method of `Shapely` is used to determine whether the point is located inside the current administrative region boundary, thus obtaining the detection result.

[0101] Step B23: When the detection result indicates that an inclusion relationship has been detected, extract the administrative division code and administrative division name of the corresponding administrative region as the administrative region matching result.

[0102] It should be noted that the administrative division code refers to the numerical code used to uniquely identify an administrative region, specifically the adcode in this embodiment, which is a six-digit unique identifier for an administrative region. Additionally, the administrative region name refers to the textual name of the administrative region, i.e., the name field, used for manual identification of the region's name information.

[0103] Understandably, when the detection result indicates that an inclusion relationship is detected, the administrative division code and administrative district name of the corresponding administrative district are extracted as the administrative district matching result. That is, when it is determined that the point to be matched is located inside the boundary of a candidate administrative district, the adcode and name of the administrative district are recorded as the matching output. If no inclusion relationship is detected after traversing all candidate administrative districts, the administrative district matching result is set to null, i.e., None.

[0104] Step A35: Add labels to the vehicle trajectory data based on the administrative region matching results to obtain trajectory data with administrative region labels.

[0105] The administrative region matching results, vehicle trajectory data, and trajectory data with administrative region labels have all been explained in the previous steps and will not be repeated here.

[0106] Understandably, the vehicle trajectory data is labeled based on the administrative region matching results. That is, the corresponding administrative region code field and administrative region name field are added to the original trajectory data record. In this embodiment, the fields are city_adcode (city administrative region code) and city_name (city name), to obtain trajectory data with administrative region labels, and this data is saved as a new table file.

[0107] In the specific implementation, the converted GCJ-02 coordinates are constructed as point geometry objects. The contains method of the Shapely library is used to determine whether the point is located within the boundary geometry object (Polygon / MultiPolygon) of a certain city. The determination logic is as follows:

[0108] In the formula, if match_result is True, the point is successfully matched, and the corresponding city's adcode and name are returned; if all city boundaries are False after traversing them, the matching failure is returned (None, None).

[0109] To improve matching efficiency, a spatial index is constructed using the previously generated 6-bit GeoHash code: first, city boundaries within the same or adjacent regions are filtered based on the GeoHash code of the points to be matched; then, precise inclusion relationship determination is performed to reduce invalid traversal. The formula is expressed as:

[0110] In the formula, This indicates a "set of cities that meet the subsequent conditions"; Represents "OR" logic; adjacent(·) is the GeoHash adjacency judgment function, used to filter cities in adjacent regions.

[0111] To address the batch processing needs of commercial vehicle trajectory data, this paper utilizes the Pandas library to achieve efficient data reading, processing, and output. The process includes: reading an Excel file containing commercial vehicle GPS trajectory data and extracting core fields (longitude, latitude, vehicle identifier, time, etc.); checking whether the input data contains the "longitude" and "latitude" fields, and throwing an exception if they are missing (to ensure data integrity); iterating through each row of the trajectory data, calling coordinate transformation and point-to-area inclusion relationship judgment functions to obtain matching results (adcode and city name); appending the matching results (city_adcode, city_name) to the original data to form trajectory data with city labels; and saving the processed data to a new Excel file, while outputting statistical information such as the original data volume and the number of successful matches for subsequent verification.

[0112] Furthermore, this method also includes: This embodiment enhances operational robustness by constructing a multi-level anomaly handling mechanism, specifically including three levels of anomaly response strategies. At the network request level, for network fluctuations or server failures during the administrative region boundary data collection phase, a retry mechanism with a preset retry threshold is adopted. Each retry is spaced within a preset retry waiting time. If the retry threshold is reached and the attempt still fails, a request failure log is recorded, and the current region is skipped, preventing single-point blocking from affecting the overall data collection process. At the coordinate data level, layered validity checks are performed on the coordinate data to be matched. First, it is determined whether it meets the preset latitude and longitude valid range conditions. For invalid coordinates that are not numeric or exceed the reasonable latitude and longitude range, a coordinate anomaly log is recorded, and a matching failure is returned. For coordinates that meet the valid range but not the preset domestic coordinate range conditions, the original value is retained and marked as overseas coordinates, ensuring that abnormal coordinates do not enter the subsequent matching process while preserving the original information. At the spatial calculation level, anomaly monitoring is performed on the point-surface inclusion relationship judgment process. When geometric object corruption or program abnormality is detected, a geometric judgment anomaly log is recorded, and the process immediately jumps to the next data item, preventing a single data item anomaly from causing system crashes and ensuring the continuity and stability of large-scale batch processing.

[0113] This embodiment provides a method for matching prefecture-level cities traversed by commercial vehicles based on spatial geometry and coordinate system transformation. Through an offline, hierarchical data acquisition strategy, it avoids reliance on external online geocoding services, eliminates network latency and call frequency limitations, and achieves localized storage and efficient retrieval of administrative region boundary data. By coordinating geometric repair and coordinate system transformation, topological defects in the original boundary data are corrected, and nonlinear deviations between different coordinate systems are eliminated, ensuring the geometric accuracy of spatial matching and effectively reducing misjudgments of positional offsets at boundaries. By constructing a spatial index through geohashing encoding, combined with matching within the same region and determining adjacent regions, the computational workload for precise inclusion judgment is significantly reduced, significantly improving the matching efficiency of large-scale trajectory data. Through a multi-level anomaly handling mechanism, scenarios such as network fluctuations, data corruption, coordinate anomalies, and geometric judgment anomalies are effectively addressed, preventing system crashes and ensuring operational stability and reliability. Through standardized data formats and modular processing flows, the entire process from raw trajectory data to labeled result data is automated, and can be directly integrated with subsequent business analysis systems.

[0114] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 Step S30 includes steps S301 to S304: Step S301: The geometric description information in the original administrative region boundary data set is parsed and transformed using a spatial geometry processing tool to obtain the original boundary geometric object; It should be noted that spatial geometry processing tools refer to software libraries used for parsing and processing geometric data, specifically Shapely (a Python spatial geometry library) in this embodiment. Furthermore, geometric description information refers to data describing the shape of administrative region boundaries in text form, specifically the boundary geometric information contained in the geometry field in this embodiment. Further, the original boundary geometric object refers to the geometric entity that can be used for spatial calculations after parsing the geometric description information, specifically the polygon or polygon set object obtained by the Shapely library in this embodiment.

[0115] Understandably, spatial geometry processing tools are used to parse and transform the geometric description information in the original administrative region boundary data set. That is, the Shapely library is used to convert the text-based boundary geometric information into program-operable geometric objects to obtain the original boundary geometric objects.

[0116] Step S302: Determine whether the original boundary geometric object has topological defects through the topological validity verification strategy. If topological defects exist, perform a buffer repair operation on the original boundary geometric object to obtain the repaired boundary geometric object. It should be noted that the topology validity verification strategy refers to the method used to detect whether a geometric object has topological errors, which in this embodiment is the is_valid method (validity judgment method, is_valid) provided by the Shapely library. Additionally, topological defects refer to structural errors in geometric objects, including self-intersections, unclosed boundaries, and duplicate vertices, which affect the correctness of spatial calculations. Furthermore, the buffer repair operation refers to the processing method of repairing topological defects using a specific algorithm, which in this embodiment is the buffer(0) operation (zero-distance buffer operation, buffer(0)). This operation utilizes the underlying geometry engine to automatically merge self-intersecting regions and connect unclosed boundaries. The repaired boundary geometric object refers to the geometric object that meets the validity requirements after topology repair.

[0117] Understandably, a topology validity check strategy is used to determine whether the original boundary geometry object has topological defects, that is, to use Shapely's is_valid method to detect whether the original boundary geometry object has structural errors. When topological defects exist, a buffer repair operation is performed on the original boundary geometry object, that is, the buffer(0) method is called to automatically repair the defective geometry, resulting in a repaired boundary geometry object.

[0118] Step S303: Based on the preset nonlinear coordinate transformation model, the coordinate system of the repaired boundary geometric object is transformed to obtain the transformed boundary geometric object; It should be noted that the preset nonlinear coordinate transformation model refers to a coordinate transformation algorithm constructed based on complex mathematical operations. In this embodiment, it is the model used to convert data from the first coordinate system (WGS84 coordinate system, World Geodetic System 1984, WGS84) to data from the second coordinate system (GCJ-02 coordinate system, State Bureau of Surveying and Mapping coordinate system, GCJ-02). This model achieves coordinate offset correction through correction calculations. Furthermore, the transformed boundary geometric object refers to the boundary geometric data after coordinate system transformation, whose coordinate reference remains consistent with the trajectory data to be matched.

[0119] Understandably, the coordinate system of the repaired boundary geometric object is transformed based on a preset nonlinear coordinate transformation model. That is, a transformation algorithm based on polynomial and trigonometric function composite operations is used to perform offset correction and datum transformation on the repaired boundary coordinates to obtain the transformed boundary geometric object.

[0120] In one feasible implementation, step S303 includes steps A41-A44: Step A41: Calculate the longitude and latitude offsets relative to the preset geographic center point based on the latitude and longitude coordinates in the repaired boundary geometry object; The repaired boundary geometry has been described in step S303 and will not be repeated here. It should be noted that the preset geographic center point refers to the reference position used in the coordinate transformation calculation, which in this embodiment is the location corresponding to longitude 105.0 degrees and latitude 35.0 degrees, approximating the geographic center of China. Furthermore, the longitude offset refers to the difference between the longitude to be transformed and the longitude of the preset geographic center point, which in this embodiment is expressed as lng' = lng - 105.0. The latitude offset refers to the difference between the latitude to be transformed and the latitude of the preset geographic center point, which in this embodiment is expressed as lat' = lat - 35.0.

[0121] Understandably, the longitude and latitude offsets relative to the preset geographic center point are calculated based on the latitude and longitude coordinates of the repaired boundary geometric object. That is, the longitude value of each vertex in the repaired boundary geometric object is subtracted by 105.0 and the latitude value is subtracted by 35.0 to obtain the longitude and latitude offsets.

[0122] Step A42: Determine the coordinate correction amount based on the longitude offset, latitude offset, preset polynomial coefficients, and preset trigonometric function coefficients. The coordinate correction amount includes latitude direction correction and longitude direction correction. It should be noted that the preset polynomial coefficients refer to the fixed parameters of the polynomial terms in the coordinate transformation model, which in this embodiment include numerical coefficients such as -100.0, 2.0, 3.0, 0.2, and 0.1. Similarly, the preset trigonometric function coefficients refer to the fixed parameters of the trigonometric function terms in the coordinate transformation model, which in this embodiment include numerical coefficients such as 20.0, 40.0, 160.0, 300.0, and 320, as well as angle multipliers such as 6.0, 2.0, 1.0, 3.0, 12.0, and 30.0. Furthermore, the coordinate correction amount refers to the numerical value used to correct coordinate offsets, including the latitude correction amount dlat and the longitude correction amount dlng, obtained through composite operations of polynomial terms and trigonometric function terms.

[0123] Understandably, the coordinate correction is determined based on the longitude offset, latitude offset, preset polynomial coefficients, and preset trigonometric function coefficients. That is, a composite formula containing polynomial and trigonometric function operations is used to calculate the correction in the latitude direction and the correction in the longitude direction respectively, resulting in the coordinate correction containing the correction in the latitude direction and the correction in the longitude direction.

[0124] Step A43: Calculate the latitude radian value based on the latitude offset, and calculate the ellipsoid correction coefficient and angle conversion coefficient based on the latitude radian value, the preset Earth equatorial radius, the preset Earth ellipsoid eccentricity, and the preset pi value; It should be noted that the latitude radian value refers to the value converted from latitude angle to radians, which is calculated in this embodiment using radlat = lat × π / 180, where radlat represents the latitude radian value (latitude radians, radlat). Additionally, the preset Earth equatorial radius refers to the equatorial radius parameter of the Earth ellipsoid model, which in this embodiment is A = 6378245.0 meters (Earth equatorial radius, A). The preset Earth ellipsoid eccentricity refers to the first eccentricity square parameter of the Earth ellipsoid model, which in this embodiment is EE = 0.00669342162296594323 (Earth ellipsoid eccentricity square, EE). The preset pi value refers to the value of the mathematical constant π, which in this embodiment is π = 3.14159265358979324 (pi, π). The ellipsoidal correction factor is a parameter used to correct for the influence of the Earth's ellipsoidal shape. In this embodiment, it is calculated using magic = 1 - EE × sin²(radlat) (ellipsoidal correction factor, magic). The angle conversion factor is a conversion parameter that converts the correction amount into an angle value, involving a composite calculation of the Earth's equatorial radius, the ellipsoidal correction factor, and the latitude radian value.

[0125] Understandably, the latitude radian value is calculated based on the latitude offset. This involves adding the latitude offset to 35.0, multiplying the resulting latitude value by the preset pi value, and then dividing by 180 to obtain the latitude radian value. Then, based on the latitude radian value, the preset Earth equatorial radius, the preset Earth ellipsoid eccentricity, and the preset pi value, the ellipsoid correction coefficient and angle conversion coefficient are calculated. Specifically, the ellipsoid correction coefficient is first calculated using a sine function and the preset Earth ellipsoid eccentricity, and then the angle conversion coefficient is calculated using the preset Earth equatorial radius and the latitude radian value.

[0126] Step A44: Calculate the coordinate offset of the repaired boundary geometry based on the coordinate correction, angle transformation coefficient, and ellipsoid correction coefficient to obtain the transformed boundary geometry.

[0127] The coordinate correction, angle conversion coefficient, ellipsoid correction coefficient, and repaired boundary geometry have all been explained in the previous steps and will not be repeated here. It should be noted that the coordinate offset calculation refers to the process of converting the coordinate correction into an angle offset and applying it to the original coordinates. That is, in this embodiment, the transformed coordinates (GCJ-02 coordinates, GCJ-02Coordinate) are calculated using the formulas lng_gcj = lng + dlng × 180 / (A / √magic × cos(radlat) × π) and lat_gcj = lat + dlat × 180 / ((A × (1 -EE)) / (magic × √magic) × π).

[0128] Understandably, the coordinate offset of the repaired boundary geometric object is calculated based on the coordinate correction, angle transformation coefficient, and ellipsoid correction coefficient. That is, the latitude and longitude corrections are converted into angle offset values ​​using formulas that include ellipsoid correction and angle transformation, and then superimposed on the original coordinates of the repaired boundary geometric object to obtain the transformed boundary geometric object.

[0129] Step S304: Centroid calculation and geohashing encoding are performed on the transformed boundary geometric objects to obtain standard administrative region boundary data.

[0130] It should be noted that centroid calculation refers to the operation of determining the location of the center of mass of a geometric object. In this embodiment, the centroid coordinates of the transformed boundary geometric object are calculated using the Shapely library to obtain the latitude and longitude points representing the spatial location of the administrative region. Geohash encoding generation refers to the process of encoding latitude and longitude coordinates into string indices. In this embodiment, the six-digit character encoding geohash6 is generated using the GeoHash algorithm. Standard administrative region boundary data refers to the final data set containing complete attribute information and spatial indexes. In this embodiment, it is stored in JSON format (JavaScript Object Notation, JSON) and includes the fields adcode (administrative division code), name (administrative region name), geohash6 (six-digit geohash code), and wkt (Well-Known Text, WKT).

[0131] Understandably, centroid calculation and geohashing encoding are performed on the transformed boundary geometric objects. This involves using spatial geometry processing tools to calculate the coordinates of the center point of the transformed boundary geometric objects, and using a geohashing algorithm to encode these center point coordinates into a six-digit string. Combined with the transformed boundary geometric information, standard administrative region boundary data is obtained.

[0132] This embodiment provides a method for matching prefecture-level cities traversed by commercial vehicles based on spatial geometry and coordinate system transformation. It utilizes spatial geometry processing tools to standardize and parse boundary data, converting textual geometric descriptions into operable geometric objects, laying a data foundation for subsequent processing. By combining topology validity verification strategies with buffer repair operations, it automatically detects and repairs topological defects such as self-intersection and non-closure in the original boundary data, ensuring the accuracy and stability of spatial calculations. Through multi-level operations of a preset nonlinear coordinate transformation model, including offset calculation, coordinate correction determination, ellipsoid parameter correction, and angle transformation, it achieves high-precision transformation from the first coordinate system to the second coordinate system, eliminating systematic deviations between different coordinate systems. Through centroid calculation and geohashing encoding, an efficient spatial indexing mechanism is constructed, providing crucial support for subsequent rapid candidate selection. The overall processing flow achieves a complete transformation of boundary data from raw collection to standardized application, significantly improving data quality and matching reliability.

[0133] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation. Any simple transformations based on this technical concept are within the protection scope of this application.

[0134] This application also provides a matching device for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation. Please refer to [link / reference]. Figure 4 The matching device for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation includes: The superior data acquisition module 10 is used to acquire superior administrative region boundary data based on the preset benchmark administrative division code, and extract superior administrative division code based on the superior administrative region boundary data; The hierarchical data acquisition module 20 is used to obtain the boundary data of the lower-level administrative regions according to the code of the higher-level administrative division, and to perform special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set; The boundary data processing module 30 is used to perform geometric repair and coordinate system transformation on the original administrative region boundary data set in sequence to obtain standard administrative region boundary data. The batch matching module 40 is used to perform batch spatial matching of vehicle trajectory data based on standard administrative region boundary data to obtain trajectory data with administrative region labels.

[0135] The commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation provided in this application adopts the commercial vehicle transit through prefecture-level cities matching method based on spatial geometry and coordinate system transformation in the above embodiments, which can solve the technical problem of inaccurate matching of administrative regions of vehicles due to coordinate system deviation, boundary topology errors, and online service dependence. Compared with the prior art, the beneficial effects of the commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation provided in this application are the same as the beneficial effects of the commercial vehicle transit through prefecture-level cities matching method based on spatial geometry and coordinate system transformation provided in the above embodiments, and other technical features in the commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation are the same as the features disclosed in the methods of the above embodiments, and will not be repeated here.

[0136] In one embodiment, the upper-level data acquisition module 10 is further configured to construct a first data request based on a preset benchmark administrative division code; The first data request is sent to the geographic data server so that the geographic data server returns the boundary data of the superior administrative region based on the first data request. It receives the boundary data of the superior administrative region returned by the geographic data server, and extracts the provincial administrative division code and the name of the provincial administrative region from the boundary data of the superior administrative region to obtain the superior administrative division code.

[0137] In one embodiment, the hierarchical data acquisition module 20 is further configured to truncate the code of the superior administrative division according to a preset coding derivation rule to obtain the code of the subordinate administrative division request. Construct a second data request based on the lower-level administrative division request code; The second data request is sent to the geographic data server so that the geographic data server returns the boundary data of the lower-level administrative region based on the second data request. Identify target area data in the boundary data of higher-level administrative regions that meet the preset special administrative region identification conditions, and directly use the target area data as the boundary data of special administrative regions; The boundary data of lower-level administrative regions and the boundary data of special administrative regions are merged to obtain the original set of administrative region boundary data.

[0138] In one embodiment, the boundary data processing module 30 is further configured to parse and transform the geometric description information in the original administrative region boundary data set using a spatial geometry processing tool to obtain the original boundary geometric object; The topology validity verification strategy is used to determine whether there are topological defects in the original boundary geometry object. If there are topological defects, a buffer repair operation is performed on the original boundary geometry object to obtain the repaired boundary geometry object. Based on a preset nonlinear coordinate transformation model, the coordinate system of the repaired boundary geometric object is transformed to obtain the transformed boundary geometric object. Centroid calculation and geohashing encoding are performed on the transformed boundary geometric objects to obtain standard administrative region boundary data.

[0139] In one embodiment, the boundary data processing module 30 is further configured to calculate the longitude offset and latitude offset relative to a preset geographic center point based on the latitude and longitude coordinates in the repaired boundary geometric object; Based on the longitude offset, latitude offset, preset polynomial coefficients, and preset trigonometric function coefficients, the coordinate correction is determined, which includes latitude direction correction and longitude direction correction. The latitude radian value is calculated based on the latitude offset, and the ellipsoid correction coefficient and angle conversion coefficient are calculated based on the latitude radian value, the preset Earth equatorial radius, the preset Earth ellipsoid eccentricity, and the preset pi value. The coordinate offset of the repaired boundary geometric object is calculated based on the coordinate correction amount, angle transformation coefficient, and ellipsoid correction coefficient to obtain the transformed boundary geometric object.

[0140] In one embodiment, the batch matching module 40 is further configured to read vehicle trajectory data and extract coordinate data to be matched from the vehicle trajectory data; Based on a preset nonlinear coordinate transformation model, the coordinate system of the coordinate data to be matched is transformed to obtain the transformed coordinate data. Candidate administrative region boundary data are selected from the standard administrative region boundary data based on the transformed coordinate data; Spatial inclusion determination is performed on the transformed coordinate data and candidate administrative region boundary data to obtain administrative region matching results; Based on the administrative region matching results, tags are appended to the vehicle trajectory data to obtain trajectory data with administrative region tags.

[0141] In one embodiment, the batch matching module 40 is further configured to generate geohash codes for the points to be matched based on the converted coordinate data; The geohash codes of each administrative region in the standard administrative region boundary data are compared with the geohash codes of the points to be matched to obtain the first candidate administrative region set; Based on the preset adjacent area judgment rules, identify the area codes adjacent to the geohash codes of the point to be matched, and obtain the set of adjacent geohash codes; The set of adjacent geohash codes is compared with the geohash codes of each administrative region in the standard administrative region boundary data to obtain the second candidate administrative region set; The first and second candidate administrative regions sets are merged and deduplicated to obtain the candidate administrative region boundary data. The steps for determining the spatial inclusion of the transformed coordinate data and the candidate administrative region boundary data to obtain the administrative region matching results include: Construct geometric objects of the points to be matched based on the transformed coordinate data; Traverse the geometric objects of each administrative region boundary in the candidate administrative region boundary data, and use the spatial inclusion judgment strategy to detect the inclusion relationship between the geometric object to be matched and the current administrative region boundary geometric object to obtain the detection results; When the detection result indicates that an inclusion relationship is found, the administrative division code and administrative division name of the corresponding administrative region are extracted as the administrative region matching result.

[0142] This application provides a commercial vehicle route-matching device based on spatial geometry and coordinate system transformation. The commercial vehicle route-matching device based on spatial geometry and coordinate system transformation includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the commercial vehicle route-matching method based on spatial geometry and coordinate system transformation in the above embodiment 1.

[0143] The following is for reference. Figure 5This document illustrates a structural schematic diagram of a commercial vehicle transit-through-prefecture-city matching device suitable for implementing embodiments of this application based on spatial geometry and coordinate system transformation. The commercial vehicle transit-through-prefecture-city matching device in this application embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The commercial vehicle passing through prefecture-level cities matching device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0144] like Figure 5 As shown, the commercial vehicle transit matching device based on spatial geometry and coordinate system transformation may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to the program stored in ROM (Read Only Memory) 1002 or the program loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the commercial vehicle transit matching device based on spatial geometry and coordinate system transformation. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the commercial vehicle transit matching equipment based on spatial geometry and coordinate system transformation to exchange data with other devices wirelessly or via wired communication. Although the figure shows a commercial vehicle transit matching equipment based on spatial geometry and coordinate system transformation with various systems, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.

[0145] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0146] The commercial vehicle transit through prefecture-level cities matching device provided in this application, employing the commercial vehicle transit through prefecture-level cities matching method based on spatial geometry and coordinate system transformation in the above embodiments, can solve the technical problem of inaccurate matching of administrative regions of vehicles due to coordinate system deviation, boundary topology errors, and online service dependence. Compared with the prior art, the beneficial effects of the commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation provided in this application are the same as the beneficial effects of the commercial vehicle transit through prefecture-level cities matching method based on spatial geometry and coordinate system transformation provided in the above embodiments, and other technical features in the commercial vehicle transit through prefecture-level cities matching device based on spatial geometry and coordinate system transformation are the same as the features disclosed in the previous embodiment method, and will not be repeated here.

[0147] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0148] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0149] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the commercial vehicle route-through-prefecture-level-city matching method based on spatial geometry and coordinate system transformation in the above embodiments.

[0150] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, RAM (Random Access Memory), ROM (Read Only Memory), EPROM (Erasable Programmable Read Only Memory or Flash Memory), optical fibers, CD-ROM (CD-Read Only Memory), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0151] The aforementioned computer-readable storage medium may be included in the commercial vehicle transit matching device based on spatial geometry and coordinate system transformation; or it may exist independently and not be installed in the commercial vehicle transit matching device based on spatial geometry and coordinate system transformation.

[0152] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a commercial vehicle passing through a prefecture-level city matching device based on spatial geometry and coordinate system transformation, the commercial vehicle passing through a prefecture-level city matching device based on spatial geometry and coordinate system transformation performs the following: obtaining boundary data of a higher-level administrative region based on a preset benchmark administrative division code, and extracting the higher-level administrative division code from the boundary data; obtaining boundary data of a lower-level administrative region based on the higher-level administrative division code, and performing special administrative region identification processing on the lower-level administrative region boundary data to obtain a set of original administrative region boundary data; sequentially performing geometric repair and coordinate system transformation on the original administrative region boundary data set to obtain standard administrative region boundary data; and performing batch spatial matching of vehicle trajectory data based on the standard administrative region boundary data to obtain trajectory data with administrative region labels.

[0153] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including LAN (Local Area Network) or WAN (Wide Area Network)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0154] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0155] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0156] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation. This method can solve the technical problem of inaccurate matching of administrative regions traversed by vehicles due to coordinate system deviation, boundary topology errors, and online service dependencies. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the commercial vehicle passing through prefecture-level cities matching method based on spatial geometry and coordinate system transformation provided in the above embodiments, and will not be repeated here.

[0157] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation.

[0158] The computer program product provided in this application can solve the technical problem of inaccurate matching of vehicle routes through administrative regions caused by coordinate system deviation, boundary topology errors, and online service dependence. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the commercial vehicle route matching method based on spatial geometry and coordinate system transformation provided in the above embodiments, and will not be repeated here.

[0159] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for matching commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation, characterized in that, The method includes: Obtain the boundary data of the superior administrative region based on the preset benchmark administrative division code, and extract the superior administrative division code based on the superior administrative region boundary data; Obtain the boundary data of the lower-level administrative regions based on the higher-level administrative division code, and perform special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set; The original administrative region boundary data set is sequentially subjected to geometric repair and coordinate system transformation to obtain standard administrative region boundary data; Based on the standard administrative region boundary data, batch spatial matching of vehicle trajectory data is performed to obtain trajectory data with administrative region labels.

2. The method as described in claim 1, characterized in that, The steps of obtaining the boundary data of the superior administrative region based on the preset benchmark administrative division code, and extracting the superior administrative division code based on the boundary data of the superior administrative region, include: The first data request is constructed based on the preset benchmark administrative division code; The first data request is sent to the geographic data server so that the geographic data server returns the boundary data of the superior administrative region according to the first data request. The system receives the boundary data of the superior administrative region returned by the geographic data server, and extracts the provincial administrative division code and the name of the provincial administrative region from the boundary data of the superior administrative region to obtain the superior administrative division code.

3. The method as described in claim 1, characterized in that, The step of obtaining the boundary data of the lower-level administrative regions based on the higher-level administrative division code, and performing special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set includes: The code of the superior administrative division is truncated according to the preset coding derivation rules to obtain the code of the subordinate administrative division request. Construct a second data request based on the lower-level administrative division request code; The second data request is sent to the geographic data server so that the geographic data server returns the boundary data of the lower-level administrative region according to the second data request. Identify target area data in the superior administrative region boundary data that meets the preset special administrative region identification conditions, and directly use the target area data as special administrative region boundary data; The boundary data of the lower-level administrative regions and the boundary data of the special administrative regions are merged to obtain the original set of administrative region boundary data.

4. The method as described in claim 1, characterized in that, The steps of sequentially performing geometric restoration and coordinate system transformation on the original administrative region boundary data set to obtain standard administrative region boundary data include: The geometric description information in the original administrative region boundary data set is parsed and transformed using spatial geometry processing tools to obtain the original boundary geometric objects. The original boundary geometry object is determined to have topological defects by a topological validity verification strategy. If topological defects exist, a buffer repair operation is performed on the original boundary geometry object to obtain a repaired boundary geometry object. Based on a preset nonlinear coordinate transformation model, the repaired boundary geometric object is subjected to coordinate system transformation to obtain the transformed boundary geometric object. The centroid of the transformed boundary geometric object is calculated and geohashed to generate standard administrative region boundary data.

5. The method as described in claim 4, characterized in that, The step of performing coordinate system transformation on the repaired boundary geometric object based on a preset nonlinear coordinate transformation model to obtain the transformed boundary geometric object includes: Calculate the longitude and latitude offsets relative to the preset geographic center point based on the latitude and longitude coordinates in the repaired boundary geometric object; Based on the longitude offset, the latitude offset, the preset polynomial coefficients, and the preset trigonometric function coefficients, the coordinate correction amount is determined, wherein the coordinate correction amount includes the latitude direction correction amount and the longitude direction correction amount; The latitude radian value is calculated based on the latitude offset, and the ellipsoid correction coefficient and angle conversion coefficient are calculated based on the latitude radian value, the preset Earth equatorial radius, the preset Earth ellipsoid eccentricity, and the preset pi value. The coordinate offset of the repaired boundary geometric object is calculated based on the coordinate correction amount, the angle transformation coefficient, and the ellipsoid correction coefficient to obtain the transformed boundary geometric object.

6. The method as described in claim 1, characterized in that, The step of performing batch spatial matching of vehicle trajectory data based on the standard administrative region boundary data to obtain trajectory data with administrative region labels includes: Read vehicle trajectory data and extract coordinate data to be matched from the vehicle trajectory data; The coordinate system of the coordinate data to be matched is transformed according to the preset nonlinear coordinate transformation model to obtain the transformed coordinate data. Candidate administrative region boundary data are selected from the standard administrative region boundary data based on the transformed coordinate data; Spatial inclusion determination is performed on the transformed coordinate data and the candidate administrative region boundary data to obtain the administrative region matching result; Based on the administrative region matching results, tags are appended to the vehicle trajectory data to obtain trajectory data with administrative region tags.

7. The method as described in claim 6, characterized in that, The step of filtering candidate administrative region boundary data from the standard administrative region boundary data based on the transformed coordinate data includes: Generate a geohash code for the point to be matched based on the transformed coordinate data; The geohash codes of each administrative region in the standard administrative region boundary data are compared with the geohash codes of the points to be matched to obtain the first candidate administrative region set; Based on the preset adjacent area judgment rules, the region codes adjacent to the geohash codes of the point to be matched are identified, and a set of adjacent geohash codes is obtained. The adjacent geohash code set is compared with the geohash codes of each administrative region in the standard administrative region boundary data to obtain the second candidate administrative region set; The first set of candidate administrative regions and the second set of candidate administrative regions are merged and deduplicated to obtain the boundary data of candidate administrative regions. The step of performing spatial inclusion determination on the transformed coordinate data and the candidate administrative region boundary data to obtain the administrative region matching result includes: Construct a geometric object of the point to be matched based on the transformed coordinate data; Traverse the geometric objects of each administrative region boundary in the candidate administrative region boundary data, and use a spatial inclusion judgment strategy to detect the inclusion relationship between the geometric objects of the point to be matched and the current administrative region boundary geometric objects to obtain the detection results; When the detection result indicates that an inclusion relationship is found, the administrative division code and administrative division name of the corresponding administrative region are extracted as the administrative region matching result.

8. A matching device for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation, characterized in that, The device includes: The superior data acquisition module is used to acquire superior administrative region boundary data based on a preset benchmark administrative division code, and extract superior administrative division code based on the superior administrative region boundary data; The hierarchical data acquisition module is used to obtain the boundary data of the lower-level administrative regions based on the code of the higher-level administrative division, and to perform special administrative region identification processing on the boundary data of the lower-level administrative regions to obtain the original administrative region boundary data set. The boundary data processing module is used to perform geometric repair and coordinate system transformation on the original administrative region boundary data set in sequence to obtain standard administrative region boundary data. The batch matching module is used to perform batch spatial matching of vehicle trajectory data based on the standard administrative region boundary data to obtain trajectory data with administrative region labels.

9. A matching device for commercial vehicles passing through prefecture-level cities based on spatial geometry and coordinate system transformation, characterized in that, The device includes: a memory, a processor, and a commercial vehicle transit city matching program based on spatial geometry and coordinate system transformation stored in the memory and executable on the processor, wherein the commercial vehicle transit city matching program based on spatial geometry and coordinate system transformation is configured to implement the steps of the commercial vehicle transit city matching method based on spatial geometry and coordinate system transformation as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores a commercial vehicle route-through-prefecture-level-city matching program based on spatial geometry and coordinate system transformation. When the processor executes the commercial vehicle route-through-prefecture-level-city matching program based on spatial geometry and coordinate system transformation, it implements the steps of the commercial vehicle route-through-prefecture-level-city matching method based on spatial geometry and coordinate system transformation as described in any one of claims 1 to 7.