tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.12k stars 527 forks source link

Sqlite Plugin: auto-index table creation failed #690

Closed atrawog closed 13 years ago

atrawog commented 13 years ago

I'm testing the new Sqlite Datasouce Support in Tilemill 0.5 on a server running Ubintu 11.04. The GDP data examples runs without a problem, but when I try to import my own Sqlite database created using using ogr2ogr I end up getting a 'Sqlite Plugin: auto-index table creation failed' error message when I try to create a Sqlite layer. Importing the same layer using ESRI Shapefiles works without any problems.

Example with Open Data from the city of Vienna, Austria.

Working import via ESRI Shapefiles: ogr2ogr -f 'ESRI Shapefile' ogdwienzaehlbezirk WFS:"http://data.wien.gv.at/daten/wfs?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:ZAEHLBEZIRKOGD&srsName=EPSG:4326"

Failing import via SQLite database: ogr2ogr -f 'SQLite' ogdwienzaehlbezirk.sqlite WFS:"http://data.wien.gv.at/daten/wfs?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:ZAEHLBEZIRKOGD&srsName=EPSG:4326"

springmeyer commented 13 years ago

Are you on a 32 bit or 64 bit machine?

atrawog commented 13 years ago

It's a 64bit machine.

springmeyer commented 13 years ago

okay, thanks. we've seen issues with index creation on 32bit machines, but not 64, so I'm not sure what is happening at this point.

You can try triggering mapnik to avoid index usage all together by adding

use_spatial_index=false

in the 'Advanced' input window. This will be slower when rendering but should allow things to work. Let me know.

atrawog commented 13 years ago

Disabled index usage and everything is working fine :-)

Whats the best way to index a sqlite database for tilemill?

I'm using GDAL 1.8.0 compiled from source with libspatialite enabled. So maybe the index gets generated in the wrong flavour.

springmeyer commented 13 years ago

oh, interesting. well ogr will not create an index unless spatialite is built into ogr and you request it. can you post your sqlite file that originally failed?

atrawog commented 13 years ago

You can download the file from http://ogdwien.googlecode.com/files/ogdwienzaehlbezirk.sqlite The table I'm using is 'ogdwien:zaehlbezirkogd'.

springmeyer commented 13 years ago

the problem appears to be due to the : in the table name

springmeyer commented 13 years ago

fixed by http://trac.mapnik.org/changeset/3239. This fix in mapnik will be available in the 0.5.1 tilemill release, when it arrives.