3

I have a point layer (xyz_coordinates_UTM33N) and a polygon layer (section1) in a SpatiaLite database.

My SpatialLite database

I wish to extract the points within the polygon to a new layer, and I want that layer stored in the database. Section 1

I know I can create a new layer by using the Intersection tool, but how can I save the new point file without first saving it as a shapefile and then importing it into the database?

Intersection settings

Using the "Save to SpatiaLite table" only creates a new database! How can I accomplish this without all the extra steps?

nmtoken
  • 13,355
  • 5
  • 38
  • 87

2 Answers2

1

You use the QspatiaLite plugin for QGIS. If will handle the creation of the spatial view. I use a building as an example of a polygon.

enter image description here

In the dialog you can write the SQL code doing the spatial join:

select *
from point p
inner join building b on st_within(p.geometry, b.geometry);

enter image description here

The spatiale view is dynamic in regard to it base layers. If you add point or a building the spatial view will be updated when you hit the QGIS refresh button.

enter image description here

Jakob
  • 7,471
  • 1
  • 23
  • 41
0

You got to create a view (="dynamic" query corresponding to your intersection) directly in the spatialite database.

Check Can QGIS read spatialite views ?

Snaileater
  • 5,743
  • 1
  • 15
  • 26