Created
March 11, 2019 16:40
-
-
Save theduckylittle/a495fb911fdeba069cb326899f19bf83 to your computer and use it in GitHub Desktop.
Fun with OGR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ducky@thinkduck /tmp $ cat test.geojson | |
{ | |
"type": "FeatureCollection", | |
"features": [ | |
{ | |
"type": "Feature", | |
"properties": { "smlint": 1 }, | |
"geometry": { | |
"type" : "Point", | |
"coordinates" : [0, 0] | |
} | |
} | |
] | |
} | |
ducky@thinkduck /tmp $ rm output.gpkg ; ogr2ogr -f SQLite output.gpkg ./test.geojson -sql "SELECT cast(smlint as SMALLINT) from ogrgeojson" | |
ducky@thinkduck /tmp $ sqlite3 output.gpkg | |
SQLite version 3.11.0 2016-02-15 17:29:24 | |
Enter ".help" for usage hints. | |
sqlite> .schema | |
CREATE TABLE geometry_columns ( f_table_name VARCHAR, f_geometry_column VARCHAR, geometry_type INTEGER, coord_dimension INTEGER, srid INTEGER, geometry_format VARCHAR ); | |
CREATE TABLE spatial_ref_sys ( srid INTEGER UNIQUE, auth_name TEXT, auth_srid TEXT, srtext TEXT); | |
CREATE TABLE 'ogrgeojson' ( ogc_fid INTEGER PRIMARY KEY, 'GEOMETRY' BLOB, 'smlint' INTEGER_INT16); | |
sqlite> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment