0

I am tring to intersect lines with a polygon grid, but i got an error when i run this:

create table "st11_01_vd" as 
  SELECT (
    "grid_1km.gid",
    "st11_012017_ln.linetime",
    ST_INTERSECTION("grid_1km.geom", "st11_012017_ln.geom") 
  FROM "grid_1km",
    "st11_012017_ln" 
  WHERE ST_Intersects("grid_1km.geom", "st11_012017_ln.geom");

Where I am wrong?

closed as off-topic by Vince, Erica, LaughU, MaryBeth, xunilk Dec 17 '18 at 16:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, Erica, LaughU, MaryBeth, xunilk
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    what is the error? – JGH Dec 17 '18 at 14:03
  • a sintax error on "FROM" – Luigi Falco Dec 17 '18 at 14:04
2

There is an open parentheses after the select statement that is never closed. It should be removed.

You should also separate table name from the column name. As it is, the column name is everything between the double quotes

create table "st11_01_vd" as 
  SELECT 
    "grid_1km"."gid",
    "st11_012017_ln"."linetime",
    ST_INTERSECTION("grid_1km"."geom", "st11_012017_ln"."geom") 
  FROM "grid_1km",
    "st11_012017_ln" 
  WHERE ST_Intersects("grid_1km"."geom", "st11_01207_ln"."geom");

Since you are not using any capital letter, do yourself a favor and just drop the doubles quotes..

create table st11_01_vd as
  SELECT 
    grid_1km.gid,
    st11_012017_ln.linetime,
    ST_INTERSECTION(grid_1km.geom, st11_012017_ln.geom) 
  FROM grid_1km,
    st11_012017_ln 
  WHERE ST_Intersects(grid_1km.geom, st11_01207_ln.geom);

Not the answer you're looking for? Browse other questions tagged or ask your own question.