Questions tagged [spatialite]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
25 views

ogr2ogr large gdb file to SQLite warning: “organizePolygons() received a polygon with more than 100 parts”

I'm trying to write a .gdb file (could also be any other format, geojson, gpkg, etc.) to a Spatialite DB but it takes awhile and I am getting a warning. Command: ogr2ogr --config OGR_SQLITE_CACHE 1024 ...
1
vote
0answers
30 views

QGIS labels rounding error

I wish to use rounded values as labels using QGIS 3.4.4. My field is type "double" and the the data source is a Spatialite table. I notice two odd behaviors linked to this problem. First, ...
0
votes
1answer
34 views

Best method for expanding Multi* geometries to their constituent objects [closed]

I have a Spatialite table with a geometry column containing a mix of multi and single geometries, e.g. (Multipolygon, Polygon) or (MultiLineString, LineString). The application that will be reading ...
0
votes
1answer
54 views

Can I store raster data in a spatialite database (in QGIS)?

This might be a super simple question, but I'm a little confused. I don't know what the best way is to share qgis-projects that have raster-data, vector-data and some applied styling. I figured a ...
1
vote
0answers
10 views

Counting number of intersections for N linestrings

I have a database with D entries of polygons representing buildings. Each entry/row has the following information: id, min_height, max_height, geom (min_height is for buildings that have some kind of ...
2
votes
0answers
22 views

How to find cities without nearby bigger city in SpatiaLite?

I have a table cities, each with a population INTEGER and a geom POINT location (WGS84). I'm trying to select all cities where there is not a more populous city within 50 km using the latest ...
0
votes
0answers
13 views

How to Create Spatialite tables and layers in QGIS using Python

I'm trying to build a data model for use in QGIS. I want to use Spatialite (SL). I've found a few things on the internet to create an in memory layer. I don't know how to specify the SL database where ...
1
vote
0answers
24 views

Spatialite - Editing points

I have a few hundred invalid x-coordinates on points in my database, as a result of a GPS logger malfunction. Database is Spatialite, GPX-files were imported with gpx2spatialite. As they are messing ...
1
vote
0answers
41 views

How to visualise generic geometry column from SpatiaLite database in QGIS

I have a SpatiaLite database with various tables. One is a table called Geometries that has a geometry column which is defined as a generic Geometry column - that is, not POINT or POLYGON or anything, ...
4
votes
0answers
56 views

Creating child entries in QGIS form with Spatialite many-to-many relationship

I am trying to reproduce the example from Introducing many-to-many (N-M) relations using Spatialite. Creating the tables and the relations works fine, but when I try to create a child element in a ...
1
vote
1answer
64 views

Create clusters from point layer [closed]

There is a point layer with points in a irregular grid. I need to separate them in 11 more or less identical cluster so that each cluster has more ore less the same amount of points in one area. Is ...
0
votes
0answers
24 views

Intersections between two Linestrings - SpatiaLite

I have two LineStrings and would like to draw the point of their intersection. The two lines are similar to this: LINESTRING(445798.43 6153379.87, 445892.89 6153340.08, 445987.35 6153300.3, 446081.82 ...
0
votes
0answers
27 views

Virtual layer with st_buffer from geopackage layer

I'm trying to make a virtual layer that has a buffer over a layer of lines. If I run the following query on a layer in shapefile it works correctly create view river as select st_buffer(geometry,50) ...
0
votes
0answers
35 views

getting convert X and Y to lat and long

I have a table called IK_TEMP and it contains columns called data, range . String sql = "SELECT DATA, RANGE FROM IK_TEMP"; try (Connection conn = this.connect(); ...
0
votes
0answers
40 views

Load a layer from SpatiaLite database, using Python

I'm new to SpatiaLite and PyQGIS. I would like to upload a layer from SpatiaLite database. To do this, I tried with this code: database = r"C:\sqlite\db.sqlite" uri = QgsDataSourceUri() uri....
0
votes
0answers
13 views

Spatialite layer with multiple geometry type in QGIS3

The spatialite table has field with GEOMETRY type and contains both line and polygon features. How to add them in QGIS 3.8.1 project as individual editable layers?
0
votes
0answers
22 views

ogr2ogr Error 1: no linking against spatialite library

I'm receiving this error from ogr2ogr: ogr2ogr -f SQLite testspatialite.sqlite test.sqlite -dsco SPATIALITE=YES Warning 6: driver SQLite does not support creation option SPATIALITE ERROR 6: OGR was ...
0
votes
0answers
34 views

Geometry loss/mix up of a spatialite view joining two tables

I have two Spatialite tables: - Sites (with geometry column) (ca. 5000 single sites) - Samples (ca. 6800 samples) To display the samples in QGIS I want to create a spatial view showing all samples at ...
0
votes
1answer
32 views

Check direction of linestring against corresponding polygon using SpatiaLite

I have a polygon and a linestring that is part of the polygons boundary, but not necessarily digitized in the same direction as shown here: In this case the linestring runs in the opposite direction ...
0
votes
1answer
35 views

SpatiaLite: Distance returns NULL when geometries touch

I use the Python sqlite3 library as well as the SQLite3 CLI. I am also using the Distance function with the use_ellipsoid parameter, to get the distance between two geometries in meters. Whenever the ...
1
vote
1answer
74 views

QGIS add PostGIS / Spatiallite rows as layers

I wish to be able to query PostGIS and Spatialite tables and add vectors from individual rows whose attributes meet criteria as multiple layers under a group or sub group instead of a single layer for ...
0
votes
0answers
36 views

How to minimize size of Spatialite file by reducing excess projections, logging etc

I have a spatialite db with only 1 table. It contains a million simple polygons with 8 points each and is about 350 MB. It is intended for read-only use in a mobile app, so I want to reduce the size ...
0
votes
1answer
61 views

Spatialite - update query for bounding polygon using WITHIN

I have 2 spatialite polygon layers which represent land parcels and municipalities. Each parcel is within or intersects 0, 1 or 2 municipalities. I am trying to update a field within the parcel layer ...
2
votes
0answers
73 views

Fresh QGIS 3.12 and 3.10 Installation result in unknown error when saving Spatialite layer

This is the most interesting problem to resolve. On a brand new Windows 10 HP Laptop, I install Windows with the latest updates and then install both versions of QGIS 3.10 and 3.12. On creating a new ...
1
vote
1answer
42 views

Dump all spatialite tables to shp and dbf

Given a spatialite database i want to export/dump all tables to shapefile (or dbf for those without geometry). I want to do it programatically so acceptable solutions will be using a (bash) command ...
2
votes
0answers
20 views

For Spatialite databases in QGIS, why is the provider 'spatialite' sometimes and 'ogr' other times?

I have many spatialite databases that I use across a lot of projects and sometimes the Provider is set to 'spatialite' and sometimes it's set to 'ogr', seemingly arbitrarily. This causes issues when ...
-2
votes
1answer
34 views

Find multipolygons in spatialite [closed]

How could I identify and select the rows with multiparts? How could I copy/save the polygons from a table with geom MULTIPOLYGON into a table with geom POLYGON?
1
vote
1answer
112 views

Find and split Multipolygons in spatialite

I have a spatialite table with more than 1100 Polygons. The geometry type in that table is multipolygon. There are only some real Multipolygons inside and I need only polygons. How can I find the ...
1
vote
0answers
51 views

Convert ellipsoid height to geoid using SpatiaLite

I would like to convert ellipsoid height to geoid (EGM2008) using SpatiaLite. is there any query that we could achieve this?
1
vote
0answers
16 views

Spatiallite table auto update

I have a spatialite database that uses a CSV file to map the geometries, however there is a csv file that keeps changing as the user add more data, how can I make it so that the user simply drag and ...
2
votes
1answer
92 views

SQLite error - no such function: InitSpatialMetadata

I am porting a QGIS plugin to QGIS3. I get a problem when I try to create a new SpatiaLite DB, in particular when I initialize spatial metadata (GEOMETRY_COLUMNS and SPATIAL_REF_SYS). My code is: ...
3
votes
0answers
38 views

Using Spatialite to add features to a layer does nothing in custom plugin but works in QGIS python console

Context I am developing a QGIS plugin which among other things can save digitized features to existing vector layers in a Spatialite database. I am using the utility class below, to help with ...
2
votes
1answer
85 views

ST_Distance in Virtual Layer query not working on QGIS on Mac but on Windows

I tried to use solution posted here, but ST_Distance in the Virtual Layer query doesn't work properly in Qgis (v3.2) on Mac, the result is showing blank while the same script is working properly in ...
3
votes
1answer
168 views

Extracting/casting mixed geometry types to single type using ogr2ogr?

I have a GeoJSON file with mixed geometry types, something like this: { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "GeometryCollection", "...
3
votes
1answer
82 views

QGIS 3 shows and saves raw default-values from spatialite-tables

QGIS shows default values from sqlite tables as string in the edit-form when i try to create a new row. After save, the raw default values are stored in the table. How can i edit in QGIS LTR 3.4.7 a ...
2
votes
1answer
76 views

Updating GeoPackage records with R

I'd like to update records of a GeoPackage containing vector information in R. I've tried this: library(sf) library(RSQLite) nc <- st_read(system.file("shape/nc.shp", package="sf")) # Write Geo ...
0
votes
0answers
40 views

Extracting and inserting polygon geometry from SpatiaLite

I've created the following script which attempts to copy a SpatiaLite table from one db to another, one record at a time. It's a learning exercise and I will eventually be doing some per-record ...
1
vote
2answers
61 views

Refresh Oracle and Spatialite Layer with PyQgis

I'm working on a Dockwidget with PyQgis. I made an insert into an Oracle DB and a Spatialite DB and I would like to see the new insert (it's a point). The Layer where the new point is add is ...
5
votes
1answer
77 views

Referencing a polygon layer in the field calculator of a point layer to make a virtual field

I have a polygon layer that shows the counties of England and a point layer of project sites. I am trying to make a new virtual field within the point layer that will reference the county that it is ...
0
votes
0answers
50 views

Why is spatialite query taking so long (only) on first execution?

I have an AWS lambda function deployed with a spatialite table. When queried, a point lookup is done on the table to find the locations in the table containing the point. The first execution of the ...
1
vote
1answer
129 views

Extract part of multipolygon that does not intersect with another geometry in Spatialite / QGIS DB manager

I have a point layer (with a buffer value), and a polygon layer (footprint) that intersects the point buffer. Using only SQL in QGIS Virtual Layers (i.e. based on Spatialite), how can I get the ...
0
votes
0answers
38 views

Why can't I upload shapefiles into my SpatiaLite database

When I try to import a layer into my SpatiaLite Database, I get this error message. Why is this happening now ?
3
votes
1answer
46 views

Creating grid references with virtual fields

I wish to create a virtual field that will automatically update when new attributes are added; the equation is for working out the 10 figure grid reference of a point shapefile in SpatiaLite: floor(((...
9
votes
1answer
296 views

Spatialite spatial queries do not function on GeoPackage

I have downloaded some data (as GeoPackages) from this excellent website: https://data.mfe.govt.nz/layer/52757-petroleum-wells/ and https://data.mfe.govt.nz/layer/52675-location-and-extent-of-nzs-...
0
votes
1answer
38 views

Adding“last modified” and “created” column in SQLite/SpatiaLite table

I am designing a new db schema for a SQLite/SpatiaLite database. Each table should get two extra columns called modified and created which should be automatically change as soon a row gets inserted ...
2
votes
0answers
21 views

Creating multipoints from points and setting incrementing M value in spatialite

I have a layer of points, which I want to group into multipoints grouping by some column. This part is easy: SELECT name_pre, CastToMulti(GUnion(geometry)) AS geometry FROM sp_survey GROUP BY ...
1
vote
0answers
32 views

Layers from SpatialLite Database are not displayed correctly in QGIS

While working a lot with layers from spatialLite databases I face a returning bug in which layers from databases aren’t displayed correctly in the project. The error affects persisting layers as well ...
0
votes
0answers
81 views

Spatial index not speeding up spatialite query containing Multipoint Geometry Data?

I am querying a sqlite format geodatabase in which there is a label for each geometry shape. Think of data as : label = name of a district in your state geometry: polygon which specify the ...
0
votes
0answers
78 views

Calculating shortest route in Geopackage/SQLite

Are there any graph analysis tools written for a SQLite database? What I'm looking for is something akin to pgRouting but for SQLite. I can't find anything with a significant user base, which is ...
1
vote
1answer
102 views

Cast 3D geometry as 2D for ogr2ogr GeoJSON

I'm trying to take a shapefile that can be downloaded here (specifically the shapefile titled PVS_19_v1_vtd_21031.shp), convert it from EPSG:4269 to EPSG:3857, and output the GeoJSON into CSV with ...

1
2 3 4 5
12