Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I believe title is all clear.I'm using Ogr2ogr utilities & binaries to read geometry. I used something like this:

ogr2ogr -f "SQLite" test2.sqlite test.sqlite -sql "SELECT ST_X(GEOMETRY),ST_Y(GEOMETRY),COL1,COL2 FROM TABLE"

Error says that there is no function ST_X,where I also tried X(..) that doesnt work either. What am I missing ?

I checked the documentation for SpatialLite.There is no other inline function that export X,Y portions of geometry to double.I also need to create geometry from LAT,LONG columns from selection.

How can i do these ?

share|improve this question
Is it possible that your OGR was built without spatialite support? It is not enabled by default. You can check with something like "ogr2ogr -f "SQLite" test.sqlite test1.sqlite -sql "SELECT sqlite_version()" (which should always work as long as test1.sqlite exists and test.sqlite doesn't), then try ogr2ogr -f "SQLite" test.sqlite test1.sqlite -sql "SELECT spatialite_version()" – BradHards Feb 12 '13 at 7:46
I can confirm BradHards - the spatialite extensions in the sqlite driver are optional. – relet Feb 12 '13 at 7:51
@BradHards I use the latest binaries for OGR utilities.I believe OGR has support for it.By the way,your query works as i verified it with ogrinfo tool. – Myra Feb 12 '13 at 7:58
Where did you get the binaries? There are multiple sources, none of which are really "official". Can you amend the question to show the results of each ogrinfo test? I'm particularly looking for the line that starts with spatialite_version() (String) = – BradHards Feb 12 '13 at 8:28
I get the binaries from found the solution,the sqlite file did not built with spatiallite option which in creation should use -dsco spatialite=yes.SQLite support SpatialLite functions that's true only if spatialite option is enabled.. – Myra Feb 12 '13 at 9:37
up vote 4 down vote accepted

I found the solution as for source table did not created with spatialite option which default is false.

To do that simply add parameter to ogr2ogr utility -dsco "SPATIALITE=YES" then all SpatialLite parameters shall work as requested.

share|improve this answer

Also, in order to use spatialite style queries, you must specify

-dialect sqlite

in ogr2ogr and ogrinfo sql

share|improve this answer

Check that your version of ogr is built with sqlite and spatialite support. - section "Spatialite SQL functions"

share|improve this answer
As I confirmed with @BradHards comment,ogr is built with such support.But the functionality I wish to use is the same in your documentation link that doesn't work ! What is missing here ? – Myra Feb 12 '13 at 8:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.