Error
Error Code:
3737
MySQL Error 3737: Invalid Semi-Major Axis Length
Description
This error indicates that an attempt was made to define or modify a Spatial Reference System (SRS) with a non-positive value for its semi-major axis. In geodesy, the semi-major axis represents the equatorial radius of an ellipsoid, a fundamental parameter that must always be a positive number.
Error Message
The length of the semi-major axis must be a positive number.
Known Causes
4 known causesIncorrect Manual Input
A user manually entered a zero or negative value for the semi-major axis when defining or updating an SRS, often due to a typo or misunderstanding of the required parameter.
Application Logic Error
An application or script generated an SQL statement that contained an invalid (zero or negative) semi-major axis value, passing it to MySQL during an SRS operation.
Malformed Data Import
Importing spatial data or SRS definitions from an external source where the semi-major axis was incorrectly specified as zero or a negative number within the dataset.
Misconfigured SRS Definition
Attempting to create a custom Spatial Reference System with an invalid semi-major axis parameter, indicating a fundamental misunderstanding of geodetic principles for Earth models.
Solutions
3 solutions available1. Correct Invalid Semi-Major Axis Value in Spatial Data medium
Identify and update spatial data with non-positive semi-major axis lengths.
1
Identify tables and columns containing spatial data. This error typically occurs when defining or inserting data into spatial types like `POINT`, `LINESTRING`, `POLYGON`, etc., especially when dealing with geographic coordinates or projections that use an elliptical model.
2
Examine the data in your spatial columns. You might need to query for geometries that are invalid or have been constructed with incorrect parameters. The exact method depends on the spatial function used.
SELECT ST_AsText(your_spatial_column) FROM your_table WHERE ST_IsValid(your_spatial_column) = 0;
3
Update the offending spatial data. If you find invalid geometries, you'll need to correct them. This might involve re-creating the geometry with valid parameters or using spatial functions to repair them. If the error is during insertion, ensure the values you are passing to spatial creation functions are valid.
-- Example: If a polygon creation failed due to an invalid axis, re-create it with valid data.
-- This is a conceptual example, the actual fix depends on the source of the invalid data.
UPDATE your_table SET your_spatial_column = ST_GeomFromText('POLYGON((...))', SRID) WHERE your_id = some_id;
4
If the error occurs during table creation or alteration, ensure that any spatial index definitions or spatial data type constraints are correctly configured and do not imply invalid axis lengths.
-- Example of creating a table with spatial data. Ensure SRID is valid and supported.
CREATE TABLE cities (
id INT PRIMARY KEY,
name VARCHAR(100),
location GEOMETRY
);
2. Verify and Set Correct Spatial Reference System (SRID) medium
Ensure the SRID used for spatial data is valid and correctly configured.
1
Understand that spatial data in MySQL relies on SRIDs to define the coordinate system and its associated ellipsoid (which includes the semi-major axis). An invalid or unsupported SRID can lead to this error.
2
Check the SRID being used for your spatial data. If you are defining spatial columns or inserting spatial data, ensure you are providing a valid SRID that MySQL recognizes.
-- Example: When inserting or updating spatial data
INSERT INTO your_table (your_spatial_column) VALUES (ST_GeomFromText('POINT(1 1)', 4326)); -- 4326 is a common SRID for WGS 84
3
Consult MySQL's spatial reference system documentation to verify the SRID you are using. You can also query the `mysql.spatial_ref_sys` table if it exists and is populated.
SELECT * FROM mysql.spatial_ref_sys WHERE SRID = your_srid_value;
4
If your SRID is custom or not recognized, you may need to add it to the `mysql.spatial_ref_sys` table or use a standard, well-defined SRID that correctly represents your geographic area and its associated ellipsoid parameters.
-- Example of adding an SRID (requires appropriate privileges and understanding of the SRID definition)
-- INSERT INTO mysql.spatial_ref_sys (SRID, SRS_NAME, ORGANIZATION, ORGANIZATION_COORDSYS_ID, PROJECTED_COORDSYS_ID, SRTEXT, IS_GEOGRAPHIC, IS_PROJECTED) VALUES (...);
3. Review and Correct Spatial Function Arguments easy
Inspect arguments passed to MySQL spatial functions for invalid semi-major axis values.
1
This error can occur if you are manually constructing geometries using functions that take ellipsoid parameters, and you provide a non-positive value for the semi-major axis.
2
Carefully review the arguments passed to any spatial functions you are using, particularly those involved in defining or transforming geometries. Look for parameters related to the ellipsoid's shape.
-- Example: If using a function that requires ellipsoid parameters (hypothetical, as MySQL's built-in functions often abstract this)
-- Ensure semi_major_axis > 0
3
If you are using custom functions or stored procedures that handle spatial data, audit their code to ensure they are not inadvertently passing invalid values for the semi-major axis. This is especially relevant if you are implementing custom coordinate transformations.
/* Review stored procedure code for spatial parameter validation */