User Tools

Site Tools


contrib:add_names_of_streets_et_al_from_shapefile_to_oracle_spatial

This is an old revision of the document!


  • Replace all occurrences of SHP_TABLE (case sensitive, can be part of a word) in the script below with the table name of the imported map from Shapefile (copy all script from below to a text editor and perform that replace);
  • Copy/Paste (in Linux: select text and then use middle mouse button or Shift+Insert to paste it in a console) the script line-by-line, follow any severe errors (ignore ones, when it writes that table cannot be dropped when it does not actually exist :) and the like).
-- copy/paste everything in one go between BEGIN and termination line with symbol “/” (including):
 
-- for street length:
BEGIN
        FOR r IN (SELECT LINK_ID FROM SHP_TABLE_LINK$) LOOP
                UPDATE SHP_TABLE_LINK$ SET COST=(SELECT LENGTH FROM SHP_TABLE WHERE ID=(SELECT ID FROM SHP_TABLE_TOPO t WHERE t.FEATURE_TG_ID = r.LINK_ID)) WHERE LINK_ID=r.LINK_ID;
        END LOOP;
END;
/
 
-- for street names:
BEGIN
        FOR r IN (SELECT LINK_ID FROM SHP_TABLE_LINK$) LOOP
                UPDATE SHP_TABLE_LINK$ SET LINK_NAME=(SELECT NAME FROM SHP_TABLE WHERE ID=(SELECT ID FROM SHP_TABLE_TOPO t WHERE t.FEATURE_TG_ID = r.LINK_ID)) WHERE LINK_ID=r.LINK_ID;
        END LOOP;
END;
/
/data/www/wiki.inf.unibz.it/data/attic/contrib/add_names_of_streets_et_al_from_shapefile_to_oracle_spatial.1185301594.txt.gz · Last modified: 2019/01/16 10:03 (external edit)