0

I created a table with point geometry in MySQL. Subsequently added a vector layer from MySQL table. The table could be accessed from QGIS. However on pressing the add button the system threw warning message that no CRS was defined hence WGS84 has been used. I then changed the CRS to EPSG24378 as was desired. Now I select this vector layer and toggle to editing mode to add points. The MySQL table is shown when I click at the desired location. However when I attempt to save then QGIS trows error as "Could not commit changes to layer MySQL:xxxxxxxxxxx OGR error creating feature-2:MySQL error message: SRID value is out of range in 'st_geomfromtext' Description: INSERT INTO tbl_loc(loc_grid, Name) VALUES (ST_Geomfromtext('POINT( 3383449.16856926 973171.230534863)',-2), Garud)

Obviously SRID of -2 is an error. How do I correct this?

QGIS VER 3.4.5 MySQL VER 8.0.3

0

I have the same error trying to save work in QGIS to a table I created in MySQL. Here is my error message:

Could not commit changes to layer watermain node

Errors: ERROR: 1 feature(s) not added.

Provider errors: OGR error creating feature -14: MySQL error message:SRID value is out of range in 'st_geomfromtext' Description: INSERT INTO node (GEOM , Description) VALUES (ST_GeomFromText('POINT (3153315.74976982 1435822.95030241)',-2) , 'stuff')

I copied part of the error description which includes SQL script: INSERT INTO node (GEOM , Description) VALUES (ST_GeomFromText('POINT (3153315.74976982 1435822.95030241)',-2) , 'stuff')

Then I tried manually running this script in mysql for which it still failed. Later, I started wondering: what does the -2 stands for in the SQL script and why is it negative? It turns out the number should be the SRID or SRS defining the coordinate zone I am using.

The SRID for my coordinate zone is 2231, I changed the -2 value to 2231 in mysql and ran the script and guess what, it worked. I still dont know if there is a way to modify the Qauntum GIS program to make this correction, but if there is I think it would be a great bug to fix.

If you have not set your SRID for the GEOM(point, linestring, etc) column in your MySQL table, but chances are you may want to try 0 first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.