Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [spatialite]

SpatiaLite is a spatial extension to SQLite, providing vector geodatabase functionality.

0
votes
1answer
73 views

Constructing query to return values from all polygons that line passes through using SpatiaLite? [closed]

I want an SQL query in Spatialite to return a list of values (Primary Key in this case, but could be any value) from all the polygons which are crossed by a line. Say, for example, a footpath passes ...
1
vote
1answer
29 views

How to create table with geometry column in GPKG with spatialite?

I want to create a vectorial GPKG with spatialite. With the help of the documenation (here: http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html#p16gpkg ), I've created a sql script that look ...
0
votes
0answers
17 views

Remove duplicate polygons in a single layer using ogr2ogr? [duplicate]

I have a spatialite database file containing buildings within a country as multipolygons. While trying to use QGIS to delete these duplicate features, QGIS keeps on crashing due to the millions of ...
0
votes
0answers
21 views

QGIS @parent or import to database(Error 7) not working for layer

I have a shape file layer that won't load into the SpatiaLite database and it gives Error 7. It also won't run functions that work in other layers and works fine without the @parent or if I remove ...
0
votes
1answer
13 views

Counting (Multi)Polygons Within (Multi)Polygons on same Table

So I have a table with approximately 10k rows, with each row having its corresponding geometry entry. What I am attempting to do is count how many row geometries are contained/within the geometry of a ...
0
votes
1answer
14 views

Initialise a database with SpatiaLite 4.3

I am starting to work with SpatiaLite 4.3 in an empty database. SpatiaLite requires a number of meta-data tables, where it stores information about geometry fields. For previous versions there are SQL ...
1
vote
1answer
24 views

Field added to SpatiaLite table doesn't show in QGIS

I have a spatial table in a SpatiaLite database that I'm editing in QGIS with no problem (the spatial table was created through SpatiaLite GUI). I then added a text field to the table through SQL ...
1
vote
1answer
37 views

Finding nearest line from points in SpatiaLite?

I have writtern a query in Spatialite to get the nearest line from a point. I want to do that for all points. How can I modify the below codes: SELECT g1.id As gref_id, g2.id As gnn_gid FROM ...
1
vote
1answer
54 views

Efficiently query two properties QGIS spatialite

I have a simple query that involves two steps: non-spatial criteria (should be super-fast) spatial criteria (which is really slow) I would like to run the spatial query only on the filtered layer (...
0
votes
1answer
46 views

Importing NAS Data into SQLite database? [closed]

I'm trying to import German NAS-Data into a SQLite- Spatialite-database. For this I use the following command: ogr2ogr -f SQLITE --config OGR_SQLITE_CACHE 8192 -gt 65536 -skipfailures -s_srs "+proj=...
0
votes
0answers
56 views

Loading spatialite with python3's module under Windows

I installed spatialite's Python module using pip: pip install spatialite I copied the mod_spatialite.dll found on https://www.gaia-gis.it/gaia-sins/index.html into my windows/system32 folder (I have ...
0
votes
0answers
22 views

Apply gdal_rasterize with spatilite

I am trying to rasterize a spatialite database using gdal_rasterize. I am using gdalUtils in R to do so and have run the following gdal_rasterize -burn 1 -sql SELECT * FROM plants WHERE binomial="...
1
vote
0answers
20 views

'SELECT AddGeometryColumn' in C++ crashed

I am using MSVC 2018 developed a GIS program. I use spatialite API to create a SQLite geometry database. The program always crashed when executing "Select AddGeometryColumn'. I don't know if I need ...
1
vote
0answers
26 views

Auto delete 5th record while inserting 6th record of polygon to SpatiaLite table

I am having problem while inserting 6th record to SpatiaLite table it auto deletes 5th record, and after that it is ok. I am using SpatiaLite database to insert some polygon using Google Maps API in ...
0
votes
2answers
57 views

SQLite spatial function

I have a SQLite database, with point and linestring geometries. Between the points(blue) and the linestring(green) is a gap, which I want to close with another line(red). The line should have angle of ...
0
votes
0answers
18 views

Suitable Image or container that has ST_MakeValid functionality

I'm looking for an easy to deploy machine image that would allow me to use the ST_MakeValid function. I'm looking to use this in an ogr2ogr call, but can't get a version compiled correctly against ...
3
votes
0answers
90 views

Loading editable SQLite layer in QGIS?

I converted a shapefile to a SpatiaLite database so I could work with attributes with a length longer than 254 characters, and also not see some columns and change their order. In QGIS 2.18.16 I have ...
1
vote
2answers
86 views

Seeking list of spatial functions available in PostGIS but unavailable in Spatialite?

It seems like most of the classic spatial function available in PostGIS (i.e. ST_Buffer) are usable with Spatialite, but some others don't seem to be supported in Spatialite (i.e.: no such functions: ...
1
vote
1answer
33 views

Arcs from a Delaunay Triagulation

I am trying to generate a Cost Distance table using Spatialite. I have several points in the table random_points for which I would like to compute the Delaunay triangulation and use the segments it ...
3
votes
2answers
121 views

Calculating point layer values within polygon features in QGIS 2

There are two layers polygon BereichBerechnung with a field "Are_Number" points EW2017 with a field "EWjeAdr" In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr" for ...
1
vote
1answer
119 views

Efficient intersect query for virtual layers in QGIS

I have 3 tables/shapes as follows: ADRR (adress points) ADRR_ID | ST_ID (street surface id) | point geometry STREET ST_ID | ST_NAME (street name) | polygon geometry Obstacles ID_OBS | ...
0
votes
0answers
119 views

Can I use SpatiaLite database using Room for Android?

I want to use the SpatiaLite database using Room library for my project. Is it possible to do? I have heard there is a custom open helper for the Room which might help to use the SpatiaLite db. But ...
-2
votes
1answer
220 views

Difference between SQLite and SpatiaLite? [closed]

I wrote telegram bot for my uni project that receives from user spatial and non-spatial data (coordinates and user identity) and puts them in an SQLite database. Then when I extract this database and ...
1
vote
1answer
84 views

QGIS cannot save to SpatiaLite after vector difference?

In QGIS I have a spatialite DB full of roads. I'd like to do a Difference operation (Vector > Geometry Tools > Difference) with another layer in order to keep roads only available in a given ...
0
votes
1answer
88 views

Querying geometry in perimeter or square with SpatiaLite?

How can I query geometry in a perimeter or a square with SpatiaLite? CREATE TABLE points (id INTEGER,geom GEOMETRY) insert into points values (897, GeomFromText('POINT(40.0 3.0)')) I've tried ...
0
votes
0answers
53 views

Spatialite: command not found on CentOS 7

I've installed Spatialite on CentOS 7 using this procedure: 1) SQLite installation wget https://www.sqlite.org/2018/sqlite-autoconf-3240000.tar.gz tar -xzf sqlite-autoconf-3240000.tar.gz cd sqlite-...
0
votes
1answer
66 views

With Spatialite, how do I run PtDistWithin with meters?

So the problem is that I have a set of multipolygons and points and I need to be able to query the data with a given point to check which ones are within 'x' km. Initially my SRID was 4283 but I ...
2
votes
0answers
60 views

Extracting polygons from mbtiles

Currently, one can extract features within a bounding box from an mbtiles file using tilelive-copy. However there is no way to extract features within a polygon from an mbtiles file. The mbtiles-...
7
votes
1answer
123 views

Creating SpatiaLite view (for use in QGIS) from non-spatial SQLite database?

I have a plain SQLite database that contains X, Y coordinates in a table. Data are edited via an MS Access front-end using the ODBC driver and so I want to avoid storing them in a geometry blob that ...
1
vote
0answers
163 views

GeoDjango application using SpatiaLite database

I want to create a simple GeoDjango app with SpatiaLite database but I have this error at migrate: django.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extensio`. ...
1
vote
1answer
284 views

Installing Spatialite on Centos7: select mod_extension() doesn't work

I'm trying to install Spatialite on a CentOS 7 server. Sqlite (version 3.7.17 ...), works fine. Using the command yum list | grep spatial the result is the follow So I've installed Spatialite ...
0
votes
1answer
179 views

Convert XY (SRID 4326) to UTM in spatialite returns NULL

How can I convert EPSG4326 point to UTM in spatialite? SRID=4326;POINT(51.2506238 35.70442974) Executing X(TRANSFORM(Geometry, 32639)) as X always returns NULL. What's the proper way of extracting ...
1
vote
2answers
590 views

How can I create a map style for OSM data in QGIS 3

I am new to QGIS (Version 3.2.2) and basically what I want to archive is to load OSM data and apply my own map style to it. However once I have defined my style I would also like to be able to load ...
3
votes
0answers
226 views

Does GeoPackage support simultaneous editing?

I am looking to move a mess of shapefiles to a newer format, either Spatialite or Geopackage. I have read that Spatialite can handle multiple users editing the same file more or less simultaneously. ...
1
vote
3answers
277 views

Re-projecting base map (WGS 84 EPSG: 4326)

I am trying to change my base map from the open street plug in to Google Street Map from WGS 84 EPSG: 3857 to WGS 84 EPSG: 4326. My spatialite polygons (originally mapped on United States) projects ...
4
votes
0answers
116 views

Offline editing solution for small GIS project with multiple editors?

I have a specific use-case that I cannot seem to find any solutions for online, so any and all advice would be most welcome. Some basic details: I am part of a small academic organization (a research ...
1
vote
1answer
62 views

Error while Importing data from .SHP files to spatialite using OGR2OGR

I was trying to import data from files provided here http://download.geofabrik.de/europe/france.html specifically http://download.geofabrik.de/europe/france/languedoc-roussillon-latest-free.shp.zip ...
1
vote
0answers
100 views

Adding SpatiaLite to Visual Studio project (already has SQLite)

I am very new to SpatiaLite. I am working on a large Visual Studio C++ project that already supports SQLite, and I am trying to add SpatiaLite capabilities to it. After reading the documentation and ...
2
votes
1answer
120 views

How to merge big and many polygons (SHP) in QGIS/Spatialite?

Background: I have a bunch of (huge) SHP-files that I would like to merge to one big SHP-file that I can use for geo-processing (clip, etc.). Now I was able to merge a big part of the SHP-files to one ...
0
votes
0answers
101 views

Is it possible to work with GeoPackage or SpatiaLite files in command-line?

I am interested in processing GeoPackage files in CLI (probably in linux). I know for example I can use ogr2ogr with the -spat option to crop OSM *.pbf file and convert it to SpatiLite DB. But is it ...
1
vote
3answers
275 views

How to modify spatialite table column names with QGIS?

I am trying to modify column names in a SpatiaLite table. To do that, I run the following SQL statements in the DB Manager : -- Rename existing table ALTER TABLE compteur_routier RENAME TO ...
1
vote
1answer
62 views

Adding per-row creation time and modification time in GeoPackage geometry table?

I need to add ctime and mtime to a GPKG sqlite database in table with geometry. Apparently logic solution: add ctime column with DEFAULT CURRENT_TIMESTAMP and add trigger ON UPDATE to set mtime = ...
0
votes
0answers
33 views

python 3.6 spatialite 4.3 on mac

In researching this problem, it appears that there is an issue with loading extensions in sqlite3 that requires a recompile of sqlite3 so SELECT load_extension("mod_spatialite.dylib") can be called. ...
0
votes
1answer
92 views

Create vector layers in sql in spatialite db with PyQGIS / QtSql

I have a vector layer in a spatialite DB structured as follows: In PyQGIS I try to create a derived vector layer from this like from PyQt4.QtSql import * db = QSqlDatabase.addDatabase('QSPATIALITE') ...
0
votes
0answers
85 views

sqlite layers not showing in QGIS

Installed qgis 3.2 on MAC. Added layers from spatialite database and they display fine. Two weeks later, they still show up in the original project I created in qgis, but when I try to add layers (...
0
votes
1answer
137 views

ogr2ogr Export spatial data from SQL Server to Spatialite

I am trying to export some spatial data from SQL Server 2012 to Spatialite with the following command ogr2ogr -f SQLite -update C:\tmp\Spatial.sqlite -nln "my_polygons" "MSSQL:server=host;database=...
5
votes
2answers
209 views

QGIS 3 does not load default styles from spatialite (defined in QGIS 2.18)

I have a set of styles stored in a spatialite db with QGIS 2.18, the layer_styles table looks like this: Adding a layer in QGIS 2.18 loads the style set as default (waters light blue, categorized): ...
2
votes
1answer
66 views

Build spatialite db from scratch within build process

Having a scripted build process on Windows 10 (CMD or Powershell, both is possible) I want to build a spatialite database with the ready to use but empty schema created from a couple of sql files. I ...
0
votes
0answers
89 views

Cannot open a SpatiaLite connection using ogr in Python

I need to open SpatiaLite connection to copy data to the database. This is my code: from osgeo import ogr dsc_in = ogr.Open(file_name) if dsc_in is None: raise Exception("Reading data failed.") ...
1
vote
2answers
301 views

Unique constraint for SpatialLite geometry column

I am creating a SpatiaLite database where I want to ensure that the contents of the geometry column for a table are unique. For normal SQL I would add a UNIQUE constraint to that column but, I don't ...