<div dir="ltr">Ah thanks, yeah I see now with a '-dsco METADATA=NO' option ogrinfo doesn't recognize the output geometry column as geometry.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 25, 2024 at 3:46 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Le 25/10/2024 à 23:40, Patrick Young via gdal-dev a écrit :<br>
> Hello,<br>
><br>
> I noticed in the docs <br>
> <a href="https://gdal.org/en/latest/drivers/vector/sqlite.html#regular-sqlite-databases" rel="noreferrer" target="_blank">https://gdal.org/en/latest/drivers/vector/sqlite.html#regular-sqlite-databases</a> <br>
> that there is some support for treating a plain sqlite db as a vector <br>
> format.<br>
><br>
> I've been dumping some vector data into a table with a geometry column <br>
> full of WKB plus some properties, but I can't seem to get OGR to <br>
> recognize the geometry column for what it is (just treated as <br>
> binary). Is this possible or does one need to shape the data to <br>
> something more in line with <a href="https://trac.osgeo.org/fdo/wiki/FDORfc16" rel="noreferrer" target="_blank">https://trac.osgeo.org/fdo/wiki/FDORfc16</a> ?<br>
<br>
Yes, you need to create the geometry_columns and spatial_ref_sys special <br>
tables:<br>
<br>
$ ogr2ogr poly.db autotest/ogr/data/poly.shp -lco FORMAT=WKB<br>
<br>
$ echo .dump | sqlite3 poly.db<br>
CREATE TABLE geometry_columns ( f_table_name VARCHAR, <br>
f_geometry_column VARCHAR, geometry_type INTEGER, coord_dimension <br>
INTEGER, srid INTEGER, geometry_format VARCHAR );<br>
INSERT INTO geometry_columns VALUES('poly','GEOMETRY',3,2,27700,'WKB');<br>
CREATE TABLE spatial_ref_sys ( srid INTEGER UNIQUE, auth_name <br>
TEXT, auth_srid TEXT, srtext TEXT);<br>
INSERT INTO spatial_ref_sys VALUES(27700,'EPSG','27700','PROJCS["OSGB36 <br>
/ British National <br>
Grid",GEOGCS["OSGB36",DATUM["Ordnance_Survey_of_Great_Britain_1936",SPHEROID["Airy <br>
1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","27700"]]');<br>
CREATE TABLE IF NOT EXISTS 'poly' ( "ogc_fid" INTEGER PRIMARY KEY <br>
AUTOINCREMENT, 'GEOMETRY' BLOB, 'area' FLOAT, 'eas_id' BIGINT, 'prfedea' <br>
VARCHAR(16));<br>
INSERT INTO poly <br>
VALUES(1,X'01030000000100000014000000000000602f491d41000000207f2d5241000000c028471d41000000e0922d5241000000007c461d4100000060ae2d524100000080c9471d4100000020b62d5241000000209c4c1d41000000e0d82d5241000000608d4c1d41000000a0dd2d5241000000207f4e1d41000000a0ea2d524100000020294f1d4100000080ca2d524100000000b4511d41000000e0552d5241000000c016521d4100000080452d5241000000e0174e1d41000000202e2d524100000020414d1d41000000e04c2d5241000000e04b4d1d41000000605e2d524100000040634d1d41000000e0742d5241000000a0ef4c1d41000000e08d2d5241000000e04e4c1d41000000e0a12d5241000000e0b04b1d4100000060b82d524100000080974a1d4100000080ae2d524100000080cf491d4100000080952d5241000000602f491d41000000207f2d5241',215229.26600000000325,168,'35043411');<br>
[ ... snip ... ]<br>
<br>
Even<br>
<br>
-- <br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
My software is free, but my time generally not.<br>
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.<br>
<br>
</blockquote></div>