I'm trying to work with a MySQL 5.5 table using QGIS 1.8. I can do "Add Vector Layer", choose "Database", and successfully connect to the MySQL connection I previously set up. QGIS shows me a "Select vector layers to add" dialog that lists the tables in my database, including the one I want to use which shows a "Geometry type" of "Point" (which is correct, there's a POINT column in that table). When I highlight that table from the list and click OK I get an error message:
The layer MySQL:[redacted connection info] is not a valid layer and can not be added to the map
Is there something that needs to be done to make a MySQL table a "valid layer" other than making sure that it has a geometry field (like a point)?
-
Can you make a connection directly with ogr? Try using ogrinfo to see what it tells you about the table. The syntax is to use is at the bottom of this page: gdal.org/ogr/drv_mysql.htmlHeyOverThere– HeyOverThere2012年11月10日 17:11:19 +00:00Commented Nov 10, 2012 at 17:11
1 Answer 1
Does your MySQL data have a MySQL spatial index? http://dev.mysql.com/doc/refman/5.0/en/create-index.html Additionaly do you have spatial extensions installed for MySQL? http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html I don't know if this is the problem, but without more information I will offer it as a possible solution.