[QGIS-Developer] Strange Mysql (spatial) behaviour: no points visible

Even Rouault even.rouault at spatialys.com
Tue Jan 23 14:21:05 PST 2024


Le 23/01/2024 à 20:43, Richard Duivenvoorde a écrit :
> Ah, oo :-)
>
> I can reproduce now in the docker!
>
> After seeing
>
> src/core/providers/ogr/qgsogrprovider.cpp:3236 : (crs) [0ms] no 
> spatial reference found
>
> in the debug info of that other db, I thought to try to load the data 
> WITHOUT telling it EPSG:31370:
>
> So instead of:
>
> ogr2ogr -update 
> "mysql:test,user=root,password=passwd,port=33060,host=127.0.0.1" 
> test.csv -select id -nlt point -a_srs EPSG:31370
>
> I removed the test table and did
>
> ogr2ogr -update 
> "mysql:test,user=root,password=passwd,port=33060,host=127.0.0.1" 
> test.csv -select id -nlt point

This fails for me with:

ERROR 1: MySQL error message:Longitude 168937.186906 is out of range in 
function st_geomfromtext. It must be within (-180.000000, 180.000000]. 
Description: INSERT INTO `test` (`SHAPE` , `id`) VALUES 
(ST_GeomFromText('POINT (168937.186906043 175180.302889316)',32767, 
'axis-order=long-lat') , '1')
ERROR 1: Unable to write feature 1 from layer test.
ERROR 1: Terminating translation prematurely after failed
translation of layer test (use -skipfailures to skip errors)

If you don't specify a SRS at layer creation time, the CreateLayer() 
logic in the MySQL driver assigns to it a "Undefined_geographic_SRS", 
and thus you must set longitude, latitude in range.


If trying with a point in range for geographic coordinates, ogr2ogr 
works and QGIS also happily displays it (with unknown CRS as expected)

printf 'id,WKT\n1,"POINT(2 49)"\n' > test.csv


So all in all, no issues on my side...

-- 

http://www.spatialys.com
My software is free, but my time generally not.



More information about the QGIS-Developer mailing list