I have a query which outputs a table with an unique nodeID and x-,y-coordinates.
How can I import this query result table into qgis as an point-layer?
I have tried it with the DB-Manager (see below) and by WFS. But both hasn't worked out for me although I was able to specify a query.
The following shows you the SQL query I am running to get my result query table which I want to import in QGIS as point-layer:
SELECT "from" AS nodeID,
st_x AS x,
st_y AS y,
priority AS type
FROM (SELECT "from",
st_x(st_pointn(geom,1)),
st_y(st_pointn(geom,1))
FROM public.graph
UNION
SELECT "to",
st_x(st_pointn(geom,st_npoints(geom))),
st_y(st_pointn(geom,st_npoints(geom)))
FROM public.graph
ORDER BY "from") AS nodes
INNER JOIN junctions on nodes."from" = id
ST_StartPoint
&ST_EndPoint
instead of extracting the coordinates from the first and last vertex (from which you, btw., would only need to create aST_MakePoint
). please copy your query as code formatted text into the question body instead of an image! it'seasier to parse for anybody trying to help, and also complete...