AutoLISP-based high-precision coordinate conversion method and system
By using a high-precision coordinate transformation method based on AutoLISP and employing higher-order correction formulas and Newton's iteration method, the problems of accuracy, efficiency, compatibility, and format in existing coordinate transformation technologies are solved. This method achieves high-precision, fast, and multi-format coordinate transformation, which is applicable to surveying engineering and computer-aided design fields.
Patent Information
- Application Number
- CN202511813938.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-17
AI Technical Summary
Existing coordinate transformation technologies are insufficient to meet practical engineering needs in terms of accuracy, efficiency, cost, compatibility, and format, especially in terms of high-precision transformation and multi-format output.
A high-precision coordinate transformation method based on AutoLISP is adopted, including higher-order correction formulas and Newton's iteration method, to achieve high-precision iterative convergence and support multi-format output, and can be integrated into platforms such as AutoCAD.
It achieves engineering-grade high-precision conversion with an angle error of less than 0.0001 arcseconds and a plane error of less than 3 millimeters. The conversion time is reduced to less than 10 seconds. It supports multiple output formats, covering desktop GIS, WebGIS and mobile applications, and is compatible with platforms such as AutoCAD and ZWCAD.
Smart Images

Figure CN121685270A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of interdisciplinary technology of surveying engineering and computer-aided design, specifically a high-precision coordinate transformation method and system based on AutoLISP. Background Technology
[0002] With the updating of national surveying and mapping benchmarks, the 2000 National Geodetic Coordinate System (CGCS2000) has become the legal coordinate system for surveying, land use, planning and other fields in my country. It adopts ellipsoidal parameters compatible with the International Earth Reference System ITRF97. In practical engineering applications, it is often necessary to convert CGCS2000 Gauss-Kruger projection plane coordinates into WGS84 latitude and longitude coordinates to meet the needs of scenarios such as GPS positioning and navigation, construction site layout, map navigation system docking, international data exchange and multi-source data fusion.
[0003] According to standards such as the Engineering Surveying Code GB50026-2007 and the Urban Surveying Code CJJ / T8-2011, the accuracy of coordinate transformation directly affects the quality and safety of engineering projects. The plane accuracy of the primary control network needs to reach ±5 cm or even higher.
[0004] However, existing coordinate transformation techniques are difficult to meet the actual needs of engineering applications: in terms of accuracy, existing techniques mostly use simplified algorithms, only including D² or D. 4 The correction term resulted in low iterative convergence accuracy (10). -6 ~10 -8 The angular error is typically between 0.001" and 0.01" (equivalent to a plane error of 0.3 meters to 3 meters), which fails to meet relevant specifications. Regarding integration and efficiency, the built-in program of the total station requires manual coordinate input, making batch processing difficult. Surveying software requires switching between multiple programs, resulting in a cumbersome process. Online conversion services rely on the network and are unavailable for classified projects, all exhibiting complex operation and low efficiency; processing 100 points takes 1-2 hours. In terms of cost, professional software is expensive (30,000-50,000 RMB / set), making it unaffordable for small and medium-sized enterprises and individual users. Regarding functionality and compatibility, existing solutions cannot directly process CAD graphic objects, have a limited output format, and suffer from poor compatibility between dedicated software and CAD platforms, making data exchange difficult. Therefore, a high-precision coordinate transformation method and system based on AutoLISP is proposed to address these issues. Summary of the Invention
[0005] (a) Technical problems to be solved To address the shortcomings of existing technologies, this invention provides a high-precision coordinate transformation method and system based on AutoLISP, which has the advantages of engineering-grade high precision, complete algorithm implementation, high efficiency, and multi-format output. It solves the problems of simplified algorithms, complex operation, low efficiency, high cost, single output format, poor compatibility, and difficulty in data exchange in terms of integration and efficiency.
[0006] (II) Technical Solution The technical solution of the present invention to solve the above-mentioned technical problems is as follows: A high-precision coordinate transformation method based on AutoLISP, comprising the following steps: S1. Parameter initialization: Read the configuration file to obtain parameters such as the central meridian L0, east offset, and output accuracy; define the CGCS2000 ellipsoid parameters, wherein the ellipsoid parameters include the semi-major axis a = 6378137 meters and the flattening f = 1 / 298.257222101; S2. High-precision meridian arc length calculation: using a method including e 2 e 4 e 6 The 8th-order correction formula for higher-order correction terms is used to calculate the meridian arc length X from the equator to a specified latitude B. S3. High-precision iteration for base point latitude: Solve for the base point latitude Bf based on Newton's iteration method, with the iteration convergence accuracy set to 10. -12 The maximum number of iterations is 10. S4. Calculation of radius of curvature: Solve for the radius of curvature Rf of the meridian and the radius of curvature Nf of the zonal circle corresponding to the latitude of the base point Bf; S5. Latitude Correction Calculation: Application includes D 6 The higher-order correction formula of the term calculates the latitude correction ΔB, where D is the normalized coordinate. S6. Longitude Correction Calculation: Application includes D 5 The higher-order correction formula for the term calculates the longitude correction ΔL; S7. Coordinate Format Conversion: Convert latitude and longitude in radians to decimal (DD) format with 8 decimal places and seconds to degrees, minutes and seconds (DMS) format with 5 decimal places, respectively; S8. Multi-format file output: Output the conversion results in at least five geographic data formats and embed conversion parameter metadata. The geographic data formats include TXT, CSV, KML, GeoJSON, and GPX.
[0007] Based on the above technical solution, the present invention can be further improved as follows.
[0008] Furthermore, the 8th-order correction formula in step S2 is as follows: X = a × [A0B - A2sin(2B) + A4sin(4B) - A6sin(6B)], where the coefficients are calculated using the following formula: A0=1-e 2 / 4-3e 4 / 64-5e 6 / 256; A2=3e 2 / 8+3e 4 / 32+45e 6 / 1024; A4=15e 4 / 256+45e 6 / 1024; A6=35e 6 / 3072; Among them, e 2 It is the square of the first eccentricity, calculated from the semi-major axis a and the flattening f of the ellipsoid.
[0009] Furthermore, the Newton iteration formula for step S3 is: Bf(n+1)=Bf(n)+(XS(Bf(n))) / M(Bf(n)), Where |XS(Bf(n))| is the convergence criterion, and |XS(Bf(n))| < 1 × 10 -12 M is the radius of curvature of the meridian circle, and S(Bf(n)) is the arc length of the meridian corresponding to the current iteration value.
[0010] Furthermore, the latitude correction formula in step S5 is: ΔB = -(Nf•tan(Bf) / Rf)•D 2 / 2+term2•D 4 / 24-term3•D 6 / 720, Where, term2 = 5 + 3T + C - 9CT - 4C 2 term3 = 61 + 90T + 45T 2 T=tan 2 (Bf), C=e ‘2 •cos 2 (Bf), e ’2 Let x be the square of the second eccentricity, and D = x / Nf be the normalized coordinates.
[0011] Furthermore, the longitude correction formula in step S6 is: ΔL=(1 / cos(Bf))×[D-(1+2T+C)D 3 / 6+(5+28T+24T 2 +6C+8CT)D 5 [ / 120], Where T=tan 2(Bf), C=e ‘2 •cos 2 (Bf), where D=x / Nf are the normalized coordinates.
[0012] Furthermore, in step S7, the decimal degree format corresponds to a planar precision of approximately 1.1 mm, and the degree-minute-second format corresponds to a planar precision of approximately 0.3 mm, automatically recognizing the north-south latitude and east-west longitude directions; in step S8, the KML format follows the KML2.2 standard, the GeoJSON format follows the RFC7946 standard, and the GPX format follows the GPX1.1 standard.
[0013] A high-precision coordinate transformation system based on AutoLISP includes: a configuration management module for reading and parsing configuration files, verifying parameter validity, and providing a DCL graphical configuration interface; a core algorithm module for high-precision coordinate transformation methods, including a meridian arc length calculation function, a base point latitude iteration function, a radius of curvature calculation function, and a latitude and longitude correction function; a format conversion module for converting between decimal degrees and degrees, minutes, and seconds, as well as between angles and radians; a file output module for generating files in five formats: TXT, CSV, KML, GeoJSON, and GPX, and embedding metadata; and a user interaction module providing a command-line interface that supports single-point transformation, quick transformation, and keyboard input and parameter passing for configuration commands.
[0014] Furthermore, the configuration management module includes a configuration file parser, a parameter validator, a DCL interface generator, and a configuration persistence module. The parameter validator verifies that the central meridian range is 0-360 degrees, the east offset is non-negative, and the accuracy range is 0-15 bits.
[0015] Furthermore, the core algorithm module adopts a pure function design based on functional programming, uses double-precision floating-point numbers for numerical calculations, relies only on standard AutoLISP syntax and DXF group codes, and is compatible with AutoCAD, ZWCAD, and GstarCAD platforms.
[0016] Furthermore, the file output module includes file path management, UTF-8 encoding processing, metadata embedding, and format verification.
[0017] The beneficial effects of this invention are: 1) This high-precision coordinate transformation method and system based on AutoLISP has the advantages of engineering-grade high precision: angle transformation error is less than 0.0001 arcseconds, plane error is less than 3 mm, and it meets the accuracy requirements (±5 cm) of the first-level control network in the "Engineering Surveying Specification" GB50026-2007.
[0018] 2) This high-precision coordinate transformation method and system based on AutoLISP has a complete algorithm implementation: The implementation includes D...6 and D 5 The complete Gauss-Kruger projection inverse calculation algorithm with higher-order corrections, calculation of 8th-order meridian arc length, 10 -12 Advantages of iterative convergence accuracy.
[0019] 3) This high-precision coordinate transformation method and system based on AutoLISP has the advantages of high efficiency: single-point transformation time is less than 0.05 seconds, the workflow is shortened from 5-10 minutes to less than 10 seconds, and the efficiency is improved by 30 times.
[0020] 4) This high-precision coordinate transformation method and system based on AutoLISP has multiple output formats: one transformation automatically generates five geographic data formats: TXT, CSV, KML, GeoJSON, and GPX, covering the advantages of desktop GIS, WebGIS, and mobile platforms.
[0021] 5) This high-precision coordinate transformation method and system based on AutoLISP has the advantages of intelligent configuration: providing dual modes of configuration files and DCL graphical interface, real-time parameter verification and persistent storage.
[0022] 6) This high-precision coordinate transformation method and system based on AutoLISP has the advantage of cross-platform compatibility: it supports multiple CAD platforms such as AutoCAD, ZWCAD, and GstarCAD, covering more than 90% of CAD users. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the structure of the present invention; Figure 2 This is a diagram of the overall system architecture of the present invention; Figure 3 This is a flowchart of the Gauss-Kruger projection inverse calculation algorithm of the present invention; Figure 4 This is a schematic diagram of the latitude iteration process of the base point in this invention; Figure 5 This is a schematic diagram of the configuration management DCL interface of the present invention; Figure 6 This is a flowchart of the single-point conversion command-line interaction process of the present invention; Figure 7 This is a flowchart of the batch conversion process of the present invention; Figure 8 This is a schematic diagram illustrating the multi-format file output of the present invention; Figure 9 This is a flowchart of the accuracy verification process for this invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] Example 1, by Figure 1-9 This invention presents a high-precision coordinate transformation method based on AutoLISP, comprising the following steps: S1: Parameter Initialization: Read the configuration file (coordtransformconfig.txt) and parse the following parameters: Central Meridian L0 (degrees): for example, 120 represents 120 degrees east longitude; East Offset FALSE_EASTING (meters): usually 500,000 meters; DD Format Decimal Places DECIMAL_PLACES: 8 digits recommended; DMS Second Decimal Places DMSSECONDSPLACES: 5 digits recommended; Output Format OUTPUT_FORMAT: DD / DMS / BOTH; Define the CGCS2000 ellipsoid parameters (global constants): semi-major axis a = 6378137.0 m; flattening f = 1 / 298.257222101; first eccentricity squared e 2 =2f-f 2 =0.00669438002290; second eccentricity squared e ’2 =e 2 / (1-e 2 ) = 0.00673949677548; S2: High-precision meridian arc length calculation: Calculates the meridian arc length X from the equator to a specified latitude B using an 8th-order correction formula: X = a × [A0B - A2sin(2B) + A4sin(4B) - A6sin(6B)], The coefficients are calculated using the following formula: A0=1-e 2 / 4-3e 4 / 64-5e 6 / 256 =1-0.0016735256-0.0000033900-0.0000000058 =0.9983264784; A2=3e 2 / 8+3e 4 / 32+45e 6 / 1024 =0.0025146070+0.0000042188+0.0000000984 =0.0025189242; A4=15e 4 / 256+45e 6 / 1024 =0.0000026357+0.0000000984 =0.0000027341; A6=35e 6 / 3072 =0.0000000032 S3: High-precision iteration of base point latitude: The base point latitude Bf is solved using Newton's iteration method. The iteration formula is: Bf(n+1)=Bf(n)+(XS(Bf(n))) / M(Bf(n)); Where: X is the input north coordinate value; S(Bf) is the meridian arc length corresponding to the current Bf, calculated by formula S2; and M is the radius of curvature of the meridian circle: M=a(1-e 2 ) / (1-e 2 sin 2 Bf)^1.5; Iteration process: Initial value: Bf(0)=X / a (approximate value); Substitution condition: |XS(Bf(n))|<1×10 -12 Maximum number of iterations: 10; Actual number of iterations: usually 3-5 to converge. Step S4: Radius of curvature calculation: Calculate the radius of curvature at the base latitude Bf: Meridian radius of curvature (north-south direction): Rf=a(1-e 2 ) / (1-e 2 sin 2 Bf)^1.5; Radius of curvature of the zonal loop (east-west direction): Nf=a / sqrt(1-e 2 sin 2 Bf); the radius of curvature is used for subsequent latitude and longitude correction calculations; Step S5: Latitude Correction Calculation: Application includes D 6 The higher-order correction formula for the term calculates the latitude correction: ΔB = -(Nf•tan(Bf) / Rf)•D 2 / 2+term2•D 4 / 24-term3•D 6 / 720 Where: D = x / Nf, x = E - FALSE_EASTING (east coordinates after removing east offset); tan(Bf) = sin(Bf) / cos(Bf) (AutoLISP has no built-in tan function); T = tan 2 (Bf); C=e ‘2 cos 2 (Bf); term2 = 5 + 3T + C - 9CT - 4C 2 ;term3=61+90T+45T 2 Final latitude: B = Bf + ΔB; Step S6: Longitude Correction Calculation: Apply the formula containing D 5 The higher-order correction formula for the term calculates the longitude correction: ΔL=(1 / cos(Bf))×[D-(1+2T+C)D 3 / 6+(5+28T+24T 2 +6C+8CT)D 5 / 120]; Final longitude: L = L0 + ΔL × 180 / π (radians to degrees); Step S7: Coordinate format conversion: DD format (decimal system) conversion: Convert latitude and longitude in radians to degrees. Formula: Longitude (DD) = L × 180 / π, Latitude (DD) = B × 180 / π, retain 8 decimal places, with an accuracy of about 1.1 mm (at 30 degrees north latitude). DMS format (degrees, minutes, seconds) conversion: Extracting degrees: degrees = floor(DD); Extracting minutes: minutes = floor((DD - degrees) × 60); Extracting seconds: seconds = ((DD - degrees) × 60 - minutes) × 60; seconds are retained to 5 decimal places with an accuracy of approximately 0.3 millimeters. Direction determination: Latitude: positive values are North Latitude (N), negative values are South Latitude (S); Longitude: positive values are East Longitude (E), negative values are West Longitude (W); Output format example: Latitude: 29:19:13.81024N; Longitude: 120:08:55.03391E; Step S8: Multi-format file output: Output the conversion results in at least five geographic data formats and embed conversion parameter metadata. The geographic data formats include TXT, CSV, KML, GeoJSON, and GPX.
[0026] This method achieves high-precision conversion from CGCS2000 Gauss-Kruger projection coordinates to WGS84 geodetic coordinates through a complete eight-step process. It integrates high-order correction algorithms, high-precision iteration, and multi-format output functions. It does not rely on external software or network services and can run directly in the CAD environment. It not only meets the accuracy requirements of engineering surveying specifications but also significantly improves the efficiency of coordinate conversion, while being compatible with the data usage needs of various application scenarios.
[0027] The formula for calculating the meridian arc length X in step S2 includes e 6 The modified formula achieves higher accuracy than the traditional 6th-order formula; the calculated coefficients avoid redundant calculations, improving efficiency; the angle functions sin(2B), sin(4B), and sin(6B) are optimized using double-angle formulas; the iterative formula in step S3 achieves a convergence accuracy of 10. -12 Meters, equivalent to sub-millimeter level, adaptive iteration, automatic convergence detection, setting a maximum iteration count protection to avoid infinite loops, exceeding the 10 of existing technologies. -6 ~10 -8 Convergence accuracy; the latitude correction calculation formula in step S5, including D 6 This revision, industry standards typically only go up to D. 4 Consider the higher-order effects of ellipsoidal flattening (through terms T and C); the tan function is implemented using sin / cos, addressing the lack of a built-in tan function in AutoLISP; the longitude correction calculation formula in step S6 includes D. 5 Correction to improve accuracy in the east-west direction; cos(Bf) normalization to ensure accuracy near the poles; higher powers of D 3 D 5 Multiplication accumulation is used to avoid errors in the expt function.
[0028] In step S8, the TXT format output is a structured text format containing: file header: conversion parameters (central meridian, east offset, conversion time); data rows: point name, original coordinates (N, E), converted coordinates (latitude DD, longitude DD, latitude DMS, longitude DMS); file footer: statistical information (total number of points, conversion time). CSV format output: comma-separated value table format, UTF-8 encoding: point name, North coordinate (N), East coordinate (E), Latitude (DD), Longitude (DD), Latitude (DMS), Longitude (DMS); CT1, 3231313.928, 506853.208, 29.32050285, 120.14862053, 29:19:13.81024N, 120:08:55.03391E; can be directly opened in Excel and Access for statistical analysis; KML format output: conforms to the KML 2.2 standard (OGC standard), Google Earth compatible. <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http: / / www.opengis.net / kml / 2.2"> <document> <name> CGCS2000→WGS84 coordinate transformation results< / name> <placemark> <name> CT1< / name> <point> <coordinates> 120.14862053,29.32050285,0< / coordinates> < / point> < / placemark> < / document> < / kml> ; GeoJSON format output: Following the RFC7946 standard, the common format for WebGIS is as follows: { "type": "FeatureCollection", "crs": {"type": "name", "properties": {"name": "EPSG:4326"}}, "features": [{ "type": "Feature", "geometry": {"type": "Point", "coordinates": [120.14862053, 29.32050285]}, "properties": {"name": "CT1", "source_N": 3231313.928, "source_E":506853.208} }] } Compatible with WebGIS frameworks such as Leaflet, OpenLayers, and Mapbox; GPX format output: Compliant with GPX1.1 standard, GPS devices are compatible. <?xml version="1.0" encoding="UTF-8"?> <gpx version="1.1" creator="CGCS2000-WGS84 Converter"> <wpt lat="29.32050285" lon="120.14862053"> <name> CT1< / name> <desc> N:3231313.928, E:506853.208< / desc> < / wpt> < / gpx> It can import handheld GPS devices and trajectory analysis software such as Garmin and Magellan.
[0029] Multi-format output, one conversion generates 5 formats, increasing data reuse rate by 5 times, covering application scenarios of desktop GIS, WebGIS, and mobile terminals, conforming to international standards, ensuring cross-platform compatibility, embedding complete metadata, facilitating data traceability and quality control.
[0030] In step S7, the decimal degree format corresponds to a plane precision of approximately 1.1 mm, and the degree-minute-second format corresponds to a plane precision of approximately 0.3 mm, automatically recognizing the north-south latitude and east-west longitude directions; in step S8, the KML format follows the KML2.2 standard, the GeoJSON format follows the RFC7946 standard, and the GPX format follows the GPX1.1 standard.
[0031] This embodiment also includes an accuracy verification step: Triple verification mechanism: verification by comparison with the total station's built-in coordinate transformation program; verification by comparison with surveying professional software (such as Southern CASS); verification by comparison with international standard libraries (such as the PROJ library); Round trip verification: Convert the transformed WGS84 coordinates back to CGCS2000 coordinates and calculate the round trip error; Statistical analysis: Perform error statistics on batch conversion results, and calculate the average error, maximum error, and root mean square error.
[0032] Example 2: A high-precision coordinate transformation system based on AutoLISP, comprising the following modules: Configuration Management Module: Used to read and parse configuration files, verify parameter validity, and provide a DCL graphical configuration interface; Core algorithm module: Used for high-precision coordinate transformation methods, including meridian arc length calculation function, base point latitude iteration function, radius of curvature calculation function, and latitude and longitude correction function; Format conversion module: used to convert between decimal degrees and degrees, minutes and seconds, as well as between angles and radians; File output module: Used to generate files in five formats: TXT, CSV, KML, GeoJSON, and GPX, and embed metadata; User interaction module: Provides a command-line interface that supports single-point conversion, quick conversion, and keyboard input and parameter passing for configuration commands.
[0033] In this embodiment, the configuration management module includes a configuration file parser, a parameter validator, a DCL interface generator, and a configuration persistence module. The following is a sample configuration file (coordtransformconfig.txt): #CGCS2000 to WGS84 coordinate transformation configuration file #Central Meridian (degrees) #3-degree zone: Zones are defined by 3-degree intervals, with the central meridian at 3, 6, 9... 120... #6-degree zone: Zones are defined by 6-degree intervals, with central meridians at 3, 9, 15... 117, 123... CENTRAL_MERIDIAN=120 #Eastward offset (meters) #3 degree band is usually 500,000, 6 degree band is usually 500,000. FALSE_EASTING=500000.0 #DD format: number of decimal places (0-15) #8 digits are recommended, corresponding to an accuracy of approximately 0.01 meters. DECIMAL_PLACES=8 #Number of decimal places for seconds in DMS format (0-10) #5 digits are recommended, corresponding to an accuracy of approximately 0.003 meters. DMS_SECONDS_PLACES=5 # Output format: DD (decimal degrees) / DMS (degrees, minutes, seconds) / BOTH (output both) OUTPUT_FORMAT=BOTH; The parameter verification rules are as follows: Central Meridian: range 0-360 degrees; East Offset: non-negative real number; Decimal Places: integer, within a reasonable range; Output Format: limited to DD / DMS / BOTH.
[0034] In this embodiment, the core algorithm module adopts a functional programming paradigm, with all computation functions being pure functions, facilitating unit testing and accuracy verification; the main functions include: calc-first-eccentricity-squared: Calculates the square of the first eccentricity. calc-second-eccentricity-squared: Calculates the square of the second eccentricity. calc-meridian-arc-length: Calculates the arc length of a meridian. calc-meridian-radius: Calculates the radius of curvature of the meridional circle. calc-prime-vertical-radius: Calculates the radius of curvature of the prime meridian. calc-footpoint-latitude: Calculates the latitude of the footpoint (iteratively). Gauss-Kruger inverse: the Gauss-Kruger inverse calculation of the master function dd-to-dms: Converting DD to DMS format rad-to-deg: radians to degrees deg-to-rad: angle to radians; The function design principles are as follows: Single responsibility: each function performs only one well-defined task; Clear input and output: parameters and return value types are clear; No side effects: do not modify global variables, do not perform I / O operations; Testability: easy to write unit tests.
[0035] In this embodiment, the format conversion and output module includes functions such as file path management, UTF-8 encoding processing, metadata embedding, and format verification; the file naming rules are as follows: coord_transform_result_YYYYMMDD_HHMMSS.txt / csv / kml / geojson / gpx; UTF-8 encoding processing: Windows platform: GBK to UTF-8; ensuring correct display of Chinese characters and special characters; cross-platform compatibility (Windows / Linux / Mac). Metadata embedded content: Transformation parameters: central meridian, projection zone, east offset; Transformation time: YYYY-MM-DDHH:MM:SS; Software version: v1.2.4 Accuracy information: iterative convergence accuracy, expected plane error.
[0036] In this embodiment, the user interaction module provides three commands: COORDTRANS (full functionality): Function: single-point conversion or batch conversion; Input: manual input of coordinates or selection of block reference; Output: command line display + file output. CT (Quick Conversion): Function: Quick single-point conversion; Input: Direct input of North and East coordinates; Output: Command line display only; CTCFG (Configuration Management): Function: Opens the DCL configuration dialog box. Operations: Modify parameters, verify, and save.
[0037] In this embodiment, the deployment method is: zero-installation deployment: provided as a single LSP file, which the user can load directly through AutoCAD's LOAD or APPLOAD command; Automatic configuration loading: Add the LSP file path to acad.lsp or acadDoc.lsp to enable automatic loading when AutoCAD starts; Cross-version compatibility: Supports all versions of AutoCAD from 2007 to 2025, ZWCAD from 2020 to 2024, and GstarCAD from 2020 to 2024; No external dependencies: It does not depend on any third-party libraries, external software or network services and runs purely offline.
[0038] Example 3, in conjunction with Examples 1 and 2, demonstrates how to use the present invention for single-point coordinate transformation: Step 1: Load the program: In the AutoCAD command line, type: Command:(load"coord_transform.lsp"); The program displays the following after successful loading: CGCS2000→WGS84 coordinate transformation tool v1.2.4 loaded successfully. Command: COORDTRANS, CT, CTCFG; Step 2: Execute the conversion command: Enter the command: Command:CT Step 3: Input coordinates: Please enter the north coordinates (N): 3231313.928 Please enter the East coordinates (E): 506853.208; Step 4: View the results: The command line displays the conversion results: ======================================== CGCS2000 → WGS84 coordinate transformation results ======================================== Original coordinates (CGCS2000 projection): North coordinates (N): 3231313.928 meters East coordinates (E): 506853.208 meters Coordinate transformation (WGS84 geodetic coordinates): Latitude (DD): 29.32050285° Longitude (DD): 120.14862053° Latitude (DMS): 29:19:13.81024 N Longitude (DMS): 120:08:55.03391 E Conversion parameters: Central Meridian: 120.0° Projection zone: 3-degree zone Number of iterations: 4 Convergence accuracy: <1×10 -12 ======================================== In this embodiment, the input north coordinates of 3231313.928 meters and east coordinates of 506853.208 meters (central meridian 120 degrees) are converted by a high-precision algorithm to obtain latitude of 29.32050285° and longitude of 120.14862053°.
[0039] Accuracy verification: Comparative verification was performed using Southern CASS10.0: CASS results: latitude 29.32050284°, longitude 120.14862052°; Results: latitude 29.32050285°, longitude 120.14862053°; Difference: latitude 0.00000001° (approximately 0.3 mm), longitude 0.00000001° (approximately 0.3 mm); meets the accuracy requirements for engineering measurement.
[0040] Example 4, in conjunction with Examples 1 and 2, demonstrates how to modify configuration parameters using the DCL graphical interface.
[0041] Step 1: Open the configuration dialog box: Command: CTCFG; Step 2: Modify parameters: In the pop-up DCL dialog box: Central Meridian: Change to 117 (applicable to Fujian Province); East Offset: Keep at 500000; DD Decimal Places: Change to 10 (higher precision); DMS Decimal Places: Change to 6; Output Format: Select BOTH; Step 3: Save configuration: Clicking the "Save" button will automatically: validate the parameters; write the data to the configuration file; update the global variables in memory; and display a success message. Step 4: Verify the configuration: When transforming the coordinates again, use the new central meridian of 117 degrees for calculation.
[0042] This example demonstrates the flexibility of the configuration system, allowing users to adjust parameters according to different project requirements.
[0043] Example 5: This example demonstrates the multi-format file output function. After performing single-point or batch conversion, the system automatically generates five file formats: TXT file (coordtransform result 20251103143052.txt): ======================================== CGCS2000→WGS84 coordinate transformation results ======================================== Conversion time: 2025-11-03 14:30:52; Software version: v1.2.4; Central Meridian: 120.0 degrees; Projection zone: 3-degree zone; Eastward offset: 500,000.0 meters; Point names: North coordinates (N), East coordinates (E), Latitude (DD), Longitude (DD), Latitude (DMS), Longitude (DMS); CT1, 3231313.928, 506853.208, 29.32050285, 120.14862053, 29:19:13.81024N, 120:08:55.03391E; Conversion points: 1; Expected accuracy: <3mm ==========================================
[0044] CSV file (coordtransform result 20251103143052.csv): Name, North coordinates (N), East coordinates (E), Latitude (DD), Longitude (DD), Latitude (DMS), Longitude (DMS) CT1, 3231313.928, 506853.208, 29.32050285, 120.14862053, 29:19:13.81024N, 120:08:55.03391E; KML file: Contains the complete KML 2.2 structure GeoJSON file: contains the complete FeatureCollection structure GPX file: contains waypoint information.
[0045] In this embodiment, users can choose to use the following files as needed: TXT file: for printing and archiving; CSV file: for Excel statistical analysis; KML file: for viewing on Google Earth; GeoJSON file: for web map development; GPX file: for importing into a handheld GPS device.
[0046] Example 6: This example demonstrates a comparison of the accuracy of the present invention with that of the prior art.
[0047] Test method: Five standard test points were used, and the following methods were applied to each point: the method of this invention; the built-in program of the Southern Total Station NTS-362R10; the coordinate transformation function of Southern CASS10.0; and the Python pyproj library (international standard). Test results: test points North coordinates (N) East coordinate (E) Latitude of this invention CASS Latitude Latitude difference (″) Planarity error (mm) CT1 3231313.928 506853.208 29.32050285 29.32050284 <0.0001 <3 CT2 3244785.690 514343.620 29.44214736 29.44214735 <0.0001 <3 CT3 3244803.746 514432.811 29.44230962 29.44230961 <0.0001 <3 CT4 3244764.542 514440.748 29.44195588 29.44195587 <0.0001 <3 CT5 3227181.662 505174.674 29.28328043 29.28328042 <0.0001 <3 The conversion accuracy of this invention is on par with that of professional surveying software (CASS), with an error of <3 mm, meeting the requirements of: GB50026-2007 Engineering Surveying Code (±5 cm) for first-level control networks; and CJJ / T8-2011 Urban Surveying Code (±30 mm) for first-level traverses. Compared with the simplified algorithm (error >1 meter), the accuracy is improved by more than 100 times.
[0048] Example 7: This example verifies the compatibility of the present invention on different CAD platforms: Test platforms: AutoCAD 2020 (Autodesk); ZWCAD 2024 (ZWSoft); GstarCAD 2024 (GstarSoft); Test content: program loading; single-point conversion; configuration modification; file output.
[0049] Test results:
[0050] This invention can run normally on three mainstream CAD platforms, with complete functions and consistent accuracy, achieving true cross-platform compatibility.
[0051] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0052] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. An AutoLISP-based high-precision coordinate transformation method, characterized in that: The method comprises the following steps: S1. Parameter initialization: read the configuration file, obtain the central meridian L0, east offset, and output precision parameters; define the CGCS2000 ellipsoid parameters, including the major semi-axis a = 6378137 meters and the flattening f = 1 / 298.257222101; S2. High-precision meridian arc length calculation: using the 8th order correction formula containing e 2 , e 4 , e 6 high order correction term, calculate the meridian arc length X from the equator to the specified latitude B; S3. High-precision iteration of the foot point latitude: the foot point latitude Bf is solved based on the Newton iteration method, the iteration convergence precision is set to 10 -12 , and the maximum iteration number is 10 times. S4. Curvature radius calculation: solve the meridian curvature radius Rf and the prime vertical curvature radius Nf corresponding to the foot point latitude Bf; S5. Latitude Correction Calculation: Calculate the latitude correction ΔB using a high order correction formula containing D 6 term, where D is the reduced coordinates. S6. Longitude Correction Calculation: Apply high order correction formula containing D 5 term to calculate the longitude correction ΔL; S7. Coordinate format conversion: convert the radian format of longitude and latitude into the decimal degree format and the degree-minute-second format, respectively; S8. Multi-format file output: output the conversion results in at least five geographic data formats, including TXT, CSV, KML, GeoJSON, and GPX, and embed the conversion parameter metadata.
2. The AutoLISP-based high-precision coordinate conversion method according to claim 1, characterized in that: The 8th order correction formula of step S2 is X = a * [A0B - A2sin(2B) + A4sin(4B) - A6sin(6B)], where the coefficient calculation formula is: A0= 1 - e 2 / 4-3e 4 / 64-5e 6 / 256; A2= 3e 2 / 8+3e 4 / 32+45e 6 / 1024; A4 = 15e 4 / 256 + 45e 6 / 1024; A6 = 35e 6 / 3072; where e 2 is the square of the first eccentricity, calculated from the ellipsoid long semi-axis a and the flattening f.
3. The AutoLISP-based high-precision coordinate conversion method according to claim 1, characterized in that: The Newton iteration formula of step S3 is: Bf(n+1) = Bf(n) + (X - S(Bf(n))) / M(Bf(n)), Wherein, |X-S(Bf(n))| is convergence criterion, and |X-S(Bf(n))|<1×10 -12 , M is the meridian radius of curvature, S(Bf(n)) is the meridian arc length corresponding to the current iteration value; the convergence accuracy reaches 10 -12 meters, adaptive iteration, automatic convergence judgment, and maximum iteration number protection is set.
4. The AutoLISP-based high-precision coordinate conversion method according to claim 3, characterized in that: The latitude correction formula of step S5 is: AB = - (Nf • tan(Bf) / Rf) • D 2 / 2 + term2 • D 4 / 24 - term3 • D 6 / 720, where term2 = 5 + 3T + C - 9CT - 4C 2 , term3 = 61 + 90T + 45T 2 , T = tan 2 (Bf), C = e '2 cos 2 (Bf), e '2 is the square of the second eccentricity, and D = x / Nf is the normalized coordinate.
5. The AutoLISP-based high-precision coordinate conversion method according to claim 2 or 4, characterized in that: The longitude correction formula of step S6 is: AL = (1 / cos(Bf)) x [D - (1 + 2T + C)D 3 / 6 + (5 + 28T + 24T 2 + 6C + 8CT)D 5 / 120], where T = tan 2 (Bf), C = e '2 • cos 2 (Bf), D = x / Nf are normalized coordinates.
6. The AutoLISP-based high-precision coordinate conversion method and system according to claim 5, characterized in that: In step S7, the decimal degree format corresponds to a plane accuracy of about 1.1 millimeters, and the degree-minute-second format corresponds to a plane accuracy of about 0.3 millimeters. The north-south latitude and east-west longitude direction are automatically identified. The KML format of step S8 complies with the KML2.2 standard, the GeoJSON format complies with the RFC7946 standard, and the GPX format complies with the GPX1.1 standard.
7. The AutoLISP-based high-precision coordinate conversion system according to any one of claims 1-6, characterized in that: It comprises: A configuration management module for reading and analyzing configuration files, verifying parameter validity, and providing a DCL graphical configuration interface; A core algorithm module for high-precision coordinate conversion methods, including meridian arc length calculation functions, foot point latitude iteration functions, curvature radius calculation functions, and longitude and latitude correction functions; A format conversion module for realizing the conversion between the decimal degree system and the degree-minute-second format and the conversion between angles and radians; A file output module for generating TXT, CSV, KML, GeoJSON, and GPX format files and embedding metadata; A user interaction module providing a command line interface, supporting single-point conversion, fast conversion, and keyboard input of configuration commands and parameter transmission.
8. The high-precision coordinate conversion system based on AutoLISP according to claim 7, characterized in that: The configuration management module comprises a configuration file parser, a parameter verifier, a DCL interface generator, and a configuration persistence module. The parameter verifier verifies that the central meridian range is 0-360 degrees, the east offset is non-negative, and the precision range is 0-15 bits.
9. The high-precision coordinate conversion system based on AutoLISP according to claim 7, characterized in that: The core algorithm module uses pure function design of functional programming, uses double-precision floating-point numbers for numerical calculation, and only relies on standard AutoLISP syntax and DXF group codes, compatible with AutoCAD, Zhongwang CAD, and Haochen CAD platforms.
10. The high-precision coordinate conversion system based on AutoLISP according to claim 7 or 9, characterized in that: The file output module includes file path management, UTF-8 encoding processing, metadata embedding, and format verification.