0
CREATE TABLE rotated_bus AS SELECT AO_id,
RotateCoords(ST_Centroid(Geometry) FROM Substation, 45.00) AS Geometry FROM Busbar;

I am trying to rotate a line geometry (Busbar) by passing the centroid of a polygon geometry (Substation) inside the RotateCoords Function. After running the above query, I am getting an error “near FROM syntax error”. What is wrong with my query?

4

1 回答 1

1

您可以加入两个表:

CREATE TABLE rotated_bus AS
SELECT Busbar.AO_id,
       RotateCoords(ST_Centroid(Substation.Geometry), 45) AS Geometry
FROM Busbar
JOIN Substation ON Busbar.AO_id = Substation.Substn_ID

或者,使用相关子查询(子查询必须是一对额外括号内的完整查询):

CREATE TABLE rotated_bus AS
SELECT AO_id,
       (SELECT RotateCoords(ST_Centroid(Geometry), 45)
        FROM Substation
        WHERE Substn_ID = Busbar.AO_id
       ) AS Geometry
FROM Busbar
于 2015-05-15T13:08:22.517 回答