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

Richard Duivenvoorde rdmailings at duif.net
Sun Jan 28 10:41:31 PST 2024


On 1/28/24 19:04, Even Rouault wrote:

> what I don't understand is how you manage to create with ogr2ogr a table without explicit SRS with features whose coordinates are not compatible of geographic coordinates. As mentioned previously, I do get a hard error from ogr2ogr when trying that. Which GDAL version do you use?

I'm doing this on a Debian 12/Bookworm machine.

$ ogr2ogr --version
GDAL 3.6.2, released 2023/01/02

But the people who contacted me (today I found out, of https://github.com/qgis/QGIS/issues/55463) actually create this table theirselves, I think, without explicitly setting a crs on a column when creating a table. Which if I understand from https://ant.burnett.com.au/adding-spatial-column-to-existing-mysql-table/ is the issue.

> The reason for which QGIS doesn't display features is likely it calls OGR with SetSpatialFilter() , which the mySQL driver turns into a  WHERE MBRIntersects(ST_GeomFromText('POLYGON((.....))', 'axis-order=long-lat'), `geom_colum_name`) filter. The 'axis-order=long-lat' qualifier is because OGR (perhaps mistakenly?) identifies the layer as with a geographic SRS, and if the extents of the layer aren't compatible of geographic coordinates, that probably causes the filter to fail.

But, my point: why can QGIS apparently show attributes, while not showing a geom.. Apparently the features were fully retrieved.

I could even copy the features from the attribute-table (when not seeing them on the MapCanvas), and copy them in another table (with made the geoms visisble).

My hope is people, still using mysql, will learn from the comments to create proper tables/columns.

Thanks for the fix!

Regards,

Richard Duivenvoorde



More information about the QGIS-Developer mailing list