mardi 30 décembre 2014

ST_Touches Function in Iterative Process


Im a complete newbie to postgis. I have the following problem:


Got two tables:



  1. "mp_power_lines_new" -> contains lines of an electricity grid

  2. "uw.new"-> contains polygons of all substations in this grid


What I need are the osm_id of the substations which are touching each line.



  1. Go to the first line in "mp_power_lines_new"

  2. see which substations touch this line

  3. fill the osm_id of the substation which touches the line in the first column UW_1

  4. fill the second touching substation in column UW_2 and then UW_3 if there is a third one

  5. Do this for all rows (lines) in the table "mp_power_lines_new"


Has anyone done something similar or knows a solution?


enter image description here





Aucun commentaire:

Enregistrer un commentaire