Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6481 closed defect (wontfix)

ogrinfo: invalid args when using ElementaryGeometries

Reported by: tobwen Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.0.2
Severity: normal Keywords:
Cc:

Description

I'm using GDAL v2.0.2 with SQLite v3.12.2 and SpatiaLite v4.3.0a.

ogrinfo -dialect sqlite -sql "SELECT ElementaryGeometries('other_relations', 'geometry', 'other_rels_dumped', 'pkey', 'multi_id')" other_relations.sqlite

breaks with this error:

INFO: Open of `other_relations.sqlite'
      using driver `SQLite' successful.
.elemgeo: invalid args

Layer name: SELECT
Geometry: None
.elemgeo: invalid args
Feature Count: 1
Layer SRS WKT:
(unknown)
ElementaryGeometries('other_relations', 'geometry', 'other_rels_dumped', 'pkey', 'multi_id'): String (0.0)
OGRFeature(SELECT):0
  ElementaryGeometries('other_relations', 'geometry', 'other_rels_dumped', 'pkey', 'multi_id') (String) = (null)

Running it via sqlite's CLI-tool works without a problem:

sqlite3 other_relations.sqlite "SELECT load_extension('mod_spatialite'); SELECT ElementaryGeometries('other_relations', 'geometry', 'other_rels_dumped', 'pkey', 'multi_id');"

(Output shows just the amounts of new entries created)

Change History (3)

comment:1 by Even Rouault, 8 years ago

Resolution: wontfix
Status: newclosed

OGRSQLiteExecuteSQL() already does a lot of magic to make things like "SELECT * FROM the_table" to work, but here it would need more magic again : 1) to recognize that it must create a virtual table for the tablename passed to ElementaryGeometries() 2) read the created table.

Using a proper spatialite DB is the most reasonable solution here.

Closing as wontfix/not fixable

comment:2 by tobwen, 8 years ago

I don't need to read the table using ogrinfo. I just wanted to run the query (the creation of the new table) without the need of sqlite's CLI tools. But since OGRSQLiteExecuteSQL() isn't capabale to pass through queries, it's okay for to use sqlite3.

comment:3 by Even Rouault, 8 years ago

You can also do it with ogrinfo but you need to do it within a Spatialite DB.

Note: See TracTickets for help on using tickets.