Questions tagged [sqlite]
A self-contained SQL database engine.
380 questions
4
votes
1
answer
52
views
Syntax for the function ORG_G_BufferEx(...) via ogr2ogr sqlite dialect
GDAL introduces the geometry function OGR_G_BufferEx(OGRGeometryH, double dfDist, CSLConstList papszOptions) in version 3.10. The options are encoded as a list of key value pairs (key=value)
...
1
vote
1
answer
68
views
gdal_sqlite_rtree_bl_from_feature_table() failed with database or disk is full
I'm using og2ogr provided by the latest osgeo docker image on an Ubuntu 24.04 OS running on a consumption-based azure container app job with 8GB RAM.
For certain large datasets, I get the following ...
1
vote
0
answers
60
views
Looking up EPSG codes offline with PROJ
Let's say we are offline and want to look up an EPSG code.
We do happen to have PROJ installed.
Is the best we can do just e.g.,
$ echo 'SELECT * FROM extent WHERE '\
'description LIKE "%...
0
votes
0
answers
92
views
Large Geopackage missing fields
We've been provided a geopackage file from the government that is supposed to contain technical data for all buildings in the country, specifically including primary building materials used in ...
1
vote
2
answers
149
views
Does ogr LIKE have undocumented differences depending on FROM?
This LIKE works as expected:
$ ogrinfo :memory: -q -al -dialect SQLite -sql \
"SELECT \"8145\" AS name WHERE name LIKE \"%8%\""
Layer name: SELECT
OGRFeature(SELECT):0
...
0
votes
2
answers
97
views
Why does ST_DissolvePoints give me nothing?
Why does ST_DissolvePoints give me nothing?
Other people
Using GDAL to get vertices of a multipolygon
don't seem to have a problem.
$ ogrinfo -q input_contours.csv -dialect SQLite -sql \
"SELECT ...
1
vote
0
answers
21
views
QGIS: Unable to Save Edits to GeoPackage on Network Drive (Disk I/O Error) [duplicate]
I have a multipolygon layer saved in a GeoPackage. The GeoPackage file is stored on a separate drive on my company's network because other people occasionally need access to it.
Sometimes, when I ...
2
votes
2
answers
136
views
How to set SpatiaLite *global settings* in GDAL/OGR?
In https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html#global
there are the SpatiaLite Global settings per connection.
In particular SetDecimalPrecision().
How might I use that with ogr2ogr -...
0
votes
1
answer
47
views
Putting downloaded OpenStreetMap roads back together with OGR
"From OpenStreetMap let's download all the linesrtings of the streets
that start with 'Junfu' (軍福) in the city of Taichung," I said to
myself with confidence.
OK, I did my Overpass Turbo ...
0
votes
0
answers
57
views
QGIS write thousands SQLite files to Windows directory
Why does QGIS writing more than thousands SQLite files to my Windows directory '?
How can I let QGIS write these files to another map..?
Windows > QGIS3-OjXByK > RLTLmf_styles.db
Every time with ...
1
vote
1
answer
101
views
Better control cascading triggers in SQLite [closed]
I'm working with two interdependent SpatiaLite layers.
When I delete entities from the first layer (ESPECES_PT), I also delete corresponding entries from the second layer (ESPECES_ATTRIBUTS). However, ...
0
votes
0
answers
67
views
Where does output from QGIS Processing "SpatiaLite execute SQL (registered DB)" go?
I can run SQLite queries on a SQLite database in the Processing module named "SpatiaLite execute SQL (registered DB)".
This SQL runs with no error messages:
CREATE table Tur_og_Deltur_2016 ...
0
votes
1
answer
83
views
QGIS - Issue with Geometry Disappearing After Merging Attributes in QGIS with SpatiaLite Trigger
I’m working with SpatiaLite, and I have a layer that contains a field named pk, which requires unique values.
However, when using QGIS, there is a tool that allows users to merge attributes from ...
1
vote
0
answers
60
views
SQL approach to forms layout in QGIS
We're creating GeoPackage to use in QField. In the Attributes Form we have a Category-field where you can choose a value from a look-up table (layer). And a separate field for Sub-Category, which is ...
1
vote
1
answer
87
views
GDAL ogr2ogr SQLite Booleans changing to false
Using GDAL's ogr2ogr to load data from a DBF I've downloaded from a proprietary system into PostgreSQL. The data has date fields where no-data records are stored as 0000/00/00, so I'm using SQLite's ...
0
votes
0
answers
46
views
QGIS - list/string comparison using SQLite
I'm using SQLite to process multiple queries while working with SpatiaLite layers.
I need to identify which string has been added to a list after updating the layer. Currently, my approach involves ...
0
votes
1
answer
87
views
GeoDjango fails to load SpatiaLite, but not Jupyter?
I am trying to use SpatiaLite for a GeoDjango application on a Windows 10 machine using Anaconda, but, when I run python manage.py dbshell, I get an error "CommandError: You appear not to have ...
1
vote
0
answers
54
views
.mode column results in strange output with spatialite
I'm currently experimenting with SpatiaLite because I plan to eventually use it to programmatically generate a geodatabase from an API I have subscribed to. I already have sqlite3 available as a ...
0
votes
2
answers
54
views
How to use ogr2ogr -clipdstsql?
This works (A),
$ ogrinfo -dialect SQLITE -sql
"SELECT ST_Buffer(ST_GeomFromText('POLYGON ((120.81313 24.18337 ...
Layer name: SELECT
OGRFeature(SELECT):0
POLYGON ((120.702569638856 24....
1
vote
0
answers
41
views
QGIS - SQLite trigger to create buffer but with a non-overlaping clause
I'm using an SQLite trigger to add a buffer around another "POINT" layer based on entered values.
The buffers are being correctly added, but I'm encountering difficulty in preventing them ...
3
votes
1
answer
133
views
SpatiaLite Equals function vs the standard ‘=‘ operator
When using SQLite with SpatiaLite, what is the difference between ‘=‘ and Equals?
As far as I understand from the documentation:
Equals(geometry1,geometry2)
may return TRUE when
geometry1 = geometry2 ...
0
votes
1
answer
102
views
Geoserver not allowed to edit gpkg
I have set up Geoserver in Tomcat on a Ubuntu Server.
All the geodata is stored in a specific folder: /tomcat9/webapps/geoserver/data/GIS_data
The problem is geoserver does not seem to have rights to ...
1
vote
2
answers
136
views
Synchronizing polygon changes between layers using QGIS
I'm working with two distinct SpatiaLite layers, each with specific fields (they are not duplicates of each other).
While working on HABITATS_POLY, I aim to update ZONES_HUMIDES_POLY based on field ...
0
votes
1
answer
121
views
Grass GIS vector seem to lost connection to database table, but in file dbln connection exists
After I imported a big vector file and table in sqlite.db was successfully created, there were some operations then I got an error:
DBMI-SQLite driver error:
Error in sqlite3_prepare():
select * from ...
1
vote
1
answer
179
views
How to use the 'sqlite' dialect in ogr2ogr queries when one of the GeoJSON property fields is "id"
I have an example GeoJSON, and I would like to use it as input to an ogr2ogr command. I aim to generate a new file with positive integer feature ids, as described here. The example GeoJSON, src....
1
vote
0
answers
109
views
SQLite/GeoPackage over a network [closed]
In our organisation we work with data stored on an Azure network file server - pretty typical for an office. We use QGIS to read geodata files (SQLite/GeoPackage) across this network and it seems to ...
0
votes
0
answers
59
views
QGIS - Unable to save after mergin attribute - (SpatiaLite - Triggers)
I'm working with SpatiaLite layers, and I'm currently encountering a problem when I use the tool: « Merge attributes of selected entities ».
I use several triggers that are not the cause of the ...
2
votes
2
answers
153
views
QGIS - Trigger's execution too slow (QGIS freeze)
I am currently working on a SpatiaLite layer that is updated after insertions and modifications through triggers.
When I copy-paste features on the "HABITATS_POLY" layer, it triggers updates ...
0
votes
1
answer
71
views
QGIS - SpatiaLite triggers doesn't update properly each field
See edit at the end of the post
I am working in two layers:
HABITATS_POLY (important fields: "EUNIS_1" , "EUNIS_2" , "EUNIS_3" , "EUNIS_4" ; "EUNIS22_1&...
1
vote
1
answer
79
views
QGIS - How to update several rows with triggers SQLite
I currently have two SpatiaLite layers:
HABITATS_POLY: Key fields include EUNIS_1, EUNIS_2, EUNIS_3, EUNIS_4, EUNIS22_1, EUNIS22_2, EUNIS22_3, EUNIS22_4.
GESTION_CODES: Key fields include EUNIS and ...
1
vote
0
answers
59
views
Specifying field type as DateTime when exporting (save feature as...) QGIS virtual layer
To extract useful data from CSV file I use virtual layer. As virtual layer are based on SQLite all field in my virtual layer are of type int, real or text.
These data need to be exported in an ESRI ...
1
vote
1
answer
107
views
QGIS - SpatialLite - Trigger for code correspondences - Manage multiple results
I have a database containing correspondences between codes (e.g., A = 1 = 11 = H = M, etc.). I've made the first 100 rows of this data available for download.
BDD Extract
I would like a feature where, ...
1
vote
1
answer
398
views
Rebuild spatial index after massive changes
I have a question about spatial indexes.
I'm using SQLite with VirtualSpatialIndex.
I have a main table that contains millions of polygons.
Let's say every 4 months I have to get a completely new ...
0
votes
2
answers
114
views
Requesting your help to identify what is automatically executed when a QGIS layer is saved
I'm working with a QGIS project where a script runs during the saving process. I've looked extensively, but I haven't been able to locate the code that gets executed.
I believe the layers are saved in ...
0
votes
0
answers
280
views
SpatiaLite / SQLite -- error: tracks.geom violates geometry constraint [geom-type or srid not allowed]
I am working with an Elixir struct that looks like
%Geo.MultiLineStringZ{
coordinates: [
[
{18.68056, 54.695338, 15.6},
{18.68061, 54.695331, 15.6},
{18.68069, 54.695339, 15.6}
...
5
votes
1
answer
400
views
How to decide when to use the SQLite dialect when running ogr2ogr on large files
When using ogr2ogr, I got used to using the -dialect sqlite option. I often see this option in GIS.SE answers (examples), and I notice others also found it helpful:
+1 for the inclusion of -dialect ...
1
vote
1
answer
356
views
Buffer lines using ogr2ogr
I'm trying to create a contour around polygons. I already managed to convert the polygons to lines and now I am trying to use SQLite and the ogr2ogr command to give them thickness. From online ...
3
votes
1
answer
522
views
Inserting XY POINT (EPSG 4326) fails in sqlite3 shell
I'm working for the first time with spatial databases, using SpatiaLite. I'm working with Kotlin (Xerial's driver for JDBC) and it seems to work just fine. But I'm wondering why I am getting errors ...
4
votes
2
answers
3k
views
Unesting JSON array in SQLite [closed]
I'm using DB Manager on QGIS to write a view. I want to "translate" unnest() SQL function, but I don't find the same in SQLite.
SQL
SELECT unnest(ARRAY['A','B','C']);
unnest
A
B
C
The ...
5
votes
1
answer
1k
views
Creating relationships at the database level using QGIS and Geopackages
I've been trying to work out a way to create relationships at the database level of geopackages.
Simple scenario for example - Table 'clearing' is related to table 'sourcefile'. The solution is to ...
1
vote
1
answer
321
views
AddGeometryColumn not creating column on new Spatialite database
I'm creating a new Spatialite database using c# and .net through the following code:
using var connection = new SqliteConnection($"Data Source={Path.Combine(outputDirectory, "data.db")}&...
7
votes
2
answers
794
views
SQL functions supported by ogr2ogr
I have a GeoJSON, test.geojson:
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { }, "geometry": { ...
1
vote
1
answer
179
views
ogr2ogr SQLite and json_each, filtering using WHERE does not work
using ogr2ogr I want to process a geojson file that has a JSON field (see minimal file below).
I tried the following command to extract the description corresponding to group a from the JSON field:
...
1
vote
1
answer
1k
views
Convert SQLite3 Geometry BLOB to WKB for PostgreSQL
I have used iterdump() to create an output file from a SQLite database that includes SpatiaLite data. I need to convert the hex data to a geometry in PostgreSQL.
I have found here a summary of how the ...
4
votes
1
answer
478
views
ogr2ogr: Make polygon from points
I have a set of points in a csv file like this (ie. a square):
-77.63333333;-11.75
-77.63333333;-12.25
-77.3;-12.25
-77.3;-11.75
-77.63333333;-11.75
-77.63333333;-11.75
After getting rid of the semi-...
3
votes
1
answer
379
views
How can I calculate the nearest 3D distance (x, y, z) between points in Qgis?
I'm new to Qgis.
I have two point groups. One is the points representing the road with an interval of 1 m, and another is the forest area.
Each point has x, y, and z values.
I want to calculate the ...
4
votes
1
answer
638
views
Difference between SQLite and SpatiaLite export from QGIS
When exoprting data in QGIS, I can choose between SpatiaLite and SQLite files. Both files get the file extension .sqlite.
What is the difference between these export formats?
Is it a different data ...
2
votes
1
answer
91
views
SQLite collaboratibe editing in Mergin-Maps
I've QGIS project using SpatiaLite database. I can see SQLite as a valid data provider in Mergin-Maps user documentation, but it is not listed as collaborative editing, only GeoPackage is. As SQLite ...
2
votes
2
answers
1k
views
Can't query GeoPackage geometry via SQLite client
I have a GeoPackage and I want to select the geometry as text from the SQLite command-line client. Here's what I've done:
Run sqlite3
Load SpatiaLite with .load /path/to/mod_spatialite.dylib (I'm on ...
0
votes
0
answers
173
views
SQLite database not updating
I have a SpatiaLite database that I need to update from a shapefile.
I have successfully created a dictionary querying the shapefile and I've printed on my console statements like:
UPDATE POLE SET ...