Hot answers tagged

5

Create a "Virtual Layer" (Layer Menu > Create Layer > New Virtual Layer...) and use this query: SELECT * FROM table1 LEFT JOIN table2 Then you can export as another format.


5

The whole point of a WMS service (or really, any service) is to hide specifics of the underlying database to users, so you only have to deal with a generic WMS interface rather than something database specific. So, no, there is no way, other than asking the owner, to get more information. As for getting the data into an attribute table, your best bet would ...


5

The IN operator allows you to specify multiple values in a WHERE clause. The IN operator is a shorthand for multiple OR conditions. case when "field1" IN('5','6') then 'pro' --IN(5, 6) if field1 is numeric --more when condition goes here else "field1" end


4

You can use "Vector general > Execute SQL" tool. Select "No geometry", specify a file path and use this query: SELECT * FROM table1 LEFT JOIN table2 Result:


2

Why not all at once? CASE when "field1"= 1 then 'num' when "field1"= 2 then 'left' else 'pro' END However: if field1 is of fieldtype integer, you can't insert text. Copy of a comment by @Babel


2

You can: Convert your shapefile to a geopackage add a connection to it in Browser and use DB Manager:


2

You're doing a full table scan query on features with tens of millions of vertices. Yeah, that will take a while. Adding additional geometries to the table likely made it worse (more pages in the table). The key to good draw performance with massive polygons is to not draw them. Instead you can convert the boundaries to lines, intersect the lines with a 9x9, ...


2

An alternation using processing tools and expressions (I know it's OT, but it might be useful) Aggregate algorithm, set as below: your layer field to group expression to use expression used: concatenate_unique( group_by:="area", concatenator:=',', expression:="species", order_by:="species") output:


2

You'd want to run: SELECT JSONB_BUILD_OBJECT( --aggregate features into FeatureCollection 'type', 'FeatureCollection', 'features', JSONB_AGG(features.feature) ) AS featurecollection FROM ( --subquery to generate GeoJSON Features from "table_rows", aliased "AS features" SELECT JSONB_BUILD_OBJECT( --...


1

Depending on your use case it might be worth trying to subdivide the geometries. Paul Ramsey has a nice article on that. Subdividing will multiply your feature count and lead to many "duplicates" regarding their attribute values but each of the new features will have its geometry only cover a smaller region. Even when using the whole table anyways, ...


1

Per @Joe Be's comment, it's necessary to either write a SQL statement to add the additional columns to the DB, or to do so manually before running the script.


1

The problem is that if a point is within polygon A, it is also outside of polygon B. To overcome this, you can use a where exists clause to ignore points that are within any polygon. Note that we don't need to compute the intersection (st_intersection) itself, we just need to know if they intersect or not (st_intersects) SELECT * FROM cougar_sample_points ...


Only top voted, non community-wiki answers of a minimum length are eligible