Unfortunately in this case, ST_Segmentize only inserts vertices into the linear component of a geometry, and only when the distance between consecutive points is longer than the given max_segment_length - a point dump will contain the initial vertices as well [e.g. observable in the respective image in @jgrocha's answer].
If that is undesirable, use a ...
Since you added QGIS tag to your question, you can use the very simple processing tool called Points along geometry.
It allows you to create points along the line.
Using Postgis, you can use the query you already wrote.To make it more usable, I've created another (temporary) table with the result.
My query is:
create table outros....
A solution using a case
WHEN i = 'other' THEN i_o
END as i
You can mostly do the same without any SQL using QGIS expressions for labeling if using Desktop GIS like QGIS but I do not know your usage context (web or desktop, software used,...)
First off, never use string concatenation when you're building SQL query strings. It's a bad habit, as it'll leave you vulnerable to SQL injections if you ever give people access to your code, say, via a website.
In your example, you're constructing a list from a ComboBox to populate an IN clause. You'd want to create a variable that concatenates those ...
I think this SDO_GEOMETRY solution could be adapted to work with SDE.ST_GEOMETRY.
Replace cust_pointn with st_pointn.
Replace sdo_util.getnumvertices with st_numpoints.
Replace .sdo_point.x with st_x.
--Custom PointN fucntion: https://gis.stackexchange.com/a/412038/135445
create or replace function cust_pointn (g sdo_geometry, n number)
Layer name with space character is a so called delimited identifier in SQL. See for example https://www.ibm.com/docs/en/informix-servers/12.10?topic=identifier-delimited-identifiers.
Delimited identifiers must be enclosed between double quotes "delimited identifier". To prevent the truncation of the -sql parameter in ogr2ogr that must also appear ...
I just had the same problem. And actually the problem was as it was written in the title "Can't create fields of type Binary on shapefile". So I just deleted the row "Geometry" type binary... That doesn't affect the geometry of my layer. And the export worked. Voilà!
With using the following SQL expression:
SELECT ST_Distance("random_points_test"."geometry", "poly_test"."geometry")
FROM "random_points_test", "poly_test"
I was able to recreate the same error
To overcome it, there are several suggestions:
use an alias e.g. AS dist i.e. ST_Distance("...
You need to use a QGIS Python Macro.
QGIS Expression is not supported in the Query Builder.
Go in Project properties then Macros, the code is under the screenshot :
Python code to use, you need to replace the layer_id variable :
from qgis.core import QgsProject
project = QgsProject.instance()
base_name = project.baseName()
What you need is the crosstab function from the tablefunc extension.
First install the extension:
create extension tablefunc;
Then you can use the crosstab function like this:
select * from
crosstab('select id, name, value from your_table order by 1,2',
$$values ('name1'), ('name2'), ('name3')$$)
as ct(id int, name1 int, name2 int, name3 int);
The easiest way would be to use a virtual layer :
Go to : > Layer > Add Layer > Add/Edit Virtual Layer...
In the "Create virtual Layer" dialog click on import and choose your
In the query part make an SQL query like this one : SELECT year(ACQ_DATE) as year, COUNT(ACQ_DATE) as 'number of incidents' FROM YOUR_LAYER GROUP BY ...
Use this expression. Normalle, if using field calculator, it calculates the same list (each year + number of entries per year) separately for each feature. To avoid that, simply select one feature and then run field calculator with the box checked next to Only update 1 selected features.
If your date is indeed formatted as date (not as text), instead of left ...
There is no equivalent out of the box. But implementing such a function is easy with a bit of PL/SQL:
create or replace function st_pointn (g sdo_geometry, n number)
g.sdo_ordinates((n-1) * 2 + 1),
g.sdo_ordinates((n-1) * 2 + 2),
You can do below to get vertex at an index from a linestring in Oracle SDO_GEOMETRY
t.id= <<Index of the vertex>>