I'm working on an android app which should display some lineobjects stored in a SQLite database. This SQLite database is created through an export in QGIS.

Is it a real SQLite database or is it a so called spatialite database?

How to read the column GEOMERTY? This column has the dataformat BLOB. When i open my database with a tool called SQLite database browser this column is empty.

When i open the same database with the Firefox extension SQLite Manager it gives me a value like


And when i open this database on an android device it gives me a value like [B@408acb78 for the GEOMETRY column.

Which markup language is used for this column? Is it Well-known text, well-known binary or something totaly different?

Does anyone know some answers for my questions? Or maybe even someone worked on a similar project (display objects from a sqlitedb on an android device)?


3 Answers 3


If the file was created with QGIS, as you state, then it should be a Spatialite DB. Please refer to the following site for info regarding Spatialite:


Download the GUI, read the documentation and you will be well on your way to understanding the Spatialite format. There is also an excellent user group here. Have fun!


The spatialite data will be binary. Your best bet is to use the API to access the geometry rather than try to crack it from outside. It's easier and quicker this way. You can request the data in a suitable format such as WKT, WKB or GeoJSON for instance.

Spatialite is very small and completely free and has C and Python APIs, ot to mention a command line interface and even a basic GUI. Together you have any number of ways to extract the geometry data and integrate Spatialite into other scripts.


National Earth SQLite database uses Well-known binary format in GEOMETRY column. It's well described on this Wikipedia page, however you can also find some libraries to handle it, for example http://geophp.net/

If you want to use it with SpatiaLite, here is example of SQL query:

SELECT name, GeometryType(GeomFromWKB(GEOMETRY)) FROM ne_10m_admin_0_countries

and the result would be something like that:

Afganistan, Polygon
USA, MultiPolygon

Here is full reference of functions available in SpatiaLite: http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.1.0.html

Of course, you cannot run this query in pure SQLite (without SpatiaLite extension). It won't work this way. If you don't want to use SpatiaLite, you have to decode GEOMETRY column as WKB format, and implement the functions you need by yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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