Tobias McTelson
Tobias McTelson

Reputation: 31

select geometry from geopackage in dbbrowser for sqlite

I'm using dbmanager for sqlite with spatialite module loaded and I'm trying to read a geopackage I exported before from qgis 3.12.

I perform this both selections bellow and get the 'geometry' with hex function, and them as supposed WKT text (I'm not sure) but when I export it as csv to read in qgis again, it didn't work. I read some examples from sqlite docs to select it as AsText or AsBinary or other readable type in qgis, but it only return empty field.

Functions here: http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html#p16gpkg

First case:

SELECT cd_geocodi, nm_bairro, renmeddom, SRID(geom), hex(geom) from setorcengeom_rj20171016 where renmeddom > 5000 group by cd_geocodi order by nm_bairro DESC limit 10;

Second case:

SELECT cd_geocodi, nm_bairro, renmeddom, SRID(geom) as epsg, AsText(CastAutomagic(geom)) AS geometry from setorcengeom_rj20171016 where renmeddom > 5000 group by cd_geocodi order by nm_bairro DESC limit 30;

Type First case Second case

Upvotes: 1

Views: 866

Answers (1)

Tobias McTelson
Tobias McTelson

Reputation: 31

I believe I got the answer! I sucefully export it as CSV and load it in QGIS with no problems.

> SELECT cd_geocodi, nm_bairro, renmeddom, SRID(geom) as epsg,
> AsWKT(CastAutomagic(geom)) AS geometry from setorcengeom_rj20171016
> group by cd_geocodi order by nm_bairro DESC

enter image description here

Upvotes: 1

Related Questions