select topology.droptopology('topo_ar5_forest_sysdata');

select CreateTopology('topo_ar5_forest_sysdata',25832,1.0);

DROP TABLE IF EXISTS topo_ar5_forest.ar5_forest_grense;

CREATE schema topo_ar5_forest;

CREATE TABLE topo_ar5_forest.ar5_forest_grense(
id serial PRIMARY KEY NOT NULL
);
-- add a topogeometry column to get a ref to the borders
SELECT topology.AddTopoGeometryColumn('topo_ar5_forest_sysdata', 'topo_ar5_forest', 'ar5_forest_grense', 'grense', 'LINESTRING') As new_layer_id;
CREATE TABLE topo_ar5_forest.ar5_forest_flate(
id serial PRIMARY KEY not null
);

select topology.toTopoGeom('0102000020E864000032010000F6285C0FAF00234152B81E5574015941C3F5285CB70023418FC2F5E8730159419A999919C6002341EC51B82E74015941EC51B89ECA0023415C8FC28574015941713D0A57D500234152B81EF575015941A4703D0AE400234114AE47817701594100000000EF002341713D0A977801594166666666FB00234114AE478179015941F6285C8F18012341C3F528CC77015941295C8F422F012341295C8F52770159417B14AEC73F0123419A9999B9770159419A9999994E012341F6285C7F79015941295C8F425901234152B81E357B0159410AD7A3706001234148E17A347D0159417B14AEC76701234114AE47817F015941E17A142E700123411F85EB6181015941295C8FC27D0123413D0AD773830159410AD7A3F089012341713D0A7785015941CDCCCCCC9E012341AE47E11A89015941F6285C8FAD012341B81E855B8B01594148E17A94BD01234185EB51288E015941E17A14AEC4012341EC51B88E8E015941CDCCCCCCD001234152B81E258D0159410AD7A370DB0123417B14AEE78A01594185EB5138DF012341AE47E10A89015941D7A370BDDC012341B81E857B8601594166666666D2012341C3F5284C820159415C8FC2F5C2012341666666A67E01594166666666AE012341EC51B88E7B015941B81E856B9C0123413333339378015941B81E856B89012341666666967301594152B81E85790123415C8FC2556E0159417B14AEC76C01234185EB51386A0159410000000048012341CDCCCC4C62015941333333B3310123413D0AD7F35D01594185EB51B821012341CDCCCCEC5A015941666666E614012341EC51B80E59015941C3F5285C02012341EC51B8DE56015941B81E85EBE7002341713D0A17550159418FC2F528D200234148E17AB453015941666666E6CE002341D7A370ED530159419A999999C7002341F6285CCF54015941C3F528DCC4002341000000405501594185EB5138C20023416666665655015941A4703D0ABF0023413D0AD7235501594100000000BC00234148E17A1455015941C3F5285CBA0023410AD7A32055015941333333B3B6002341713D0A6755015941CDCCCC4CB4002341B81E85BB55015941E17A142EB40023410AD7A30056015941B81E85EBB4002341E17A14AE56015941CDCCCC4CB600234185EB514857015941F6285C0FB800234185EB51D85701594185EB5138B9002341C3F5287C58015941CDCCCCCCB80023418FC2F51859015941A4703D8AB6002341EC51B88E5901594152B81E05B300234152B81EE55901594185EB5138AC00234114AE47015A01594185EB5138A70023418FC2F5E859015941333333B3A1002341295C8FA25901594152B81E859D0023416666665659015941333333B39A002341CDCCCC0C590159410AD7A37098002341EC51B87E580159413D0AD72394002341713D0AB756015941C3F528DC900023410AD7A3F0550159417B14AEC788002341295C8F7254015941A4703D8A84002341E17A149E5301594185EB51B88100234148E17A3453015941CDCCCCCC7F00234133333303530159419A9999197E0023411F85EB0153015941CDCCCCCC7D0023415C8FC2355301594148E17A947F002341333333D3530159415C8FC2758600234166666656550159417B14AE478900234148E17A2456015941EC51B89E8C0023419A9999795601594185EB51B88D002341F6285C9F56015941C3F528DC8D00234114AE47E156015941EC51B81E8D002341AE47E16A57015941CDCCCCCC8B0023418FC2F5E8570159417B14AE478A002341B81E85FB570159416666666688002341B81E859B57015941EC51B89E85002341EC51B8BE56015941D7A370BD8300234166666646560159410000008081002341666666165601594152B81E057F002341AE47E12A5601594185EB51B87D002341F6285CFF550159411F85EBD17C002341B81E85EB55015941C3F5285C7C002341666666F655015941666666E67B0023419A99991956015941713D0A577D0023410AD7A30057015941666666E67C00234148E17A3457015941000000007B002341A4703D7A570159419A9999197800234185EB51785701594114AE47617300234166666636570159419A9999996A0023410AD7A350560159418FC2F52867002341D7A370DD5501594152B81E85630023410AD7A35055015941EC51B89E6100234114AE4741550159411F85EB515F002341B81E854B5501594152B81E055C002341E17A141E5501594114AE47E157002341D7A370CD54015941F6285C0F510023417B14AEF753015941AE47E1FA4D002341F6285CAF5301594148E17A944B002341D7A370AD5301594152B81E054A00234166666606540159417B14AE47480023413D0AD7835401594148E17A14460023411F85EBA1550159413D0AD723430023410AD7A34056015941713D0AD740002341295C8FD256015941713D0AD73E002341000000605701594148E17A943D002341B81E85FB57015941B81E856B3B002341A4703D0A5A015941C3F5285C3A002341295C8F625A015941666666E6380023413D0AD7A35A01594185EB513836002341E17A149E5B0159415C8FC27535002341A4703D5A5C0159410000008034002341295C8FD25C015941D7A3703D320023418FC2F5085D015941EC51B81E28002341CDCCCC2C5D015941F6285C8F24002341666666265D015941713D0A57220023410AD7A3E05C0159418FC2F5A81D0023418FC2F5085D0159415C8FC2750D002341EC51B80E5D015941F6285C0FFFFF2241D7A370FD5C015941AE47E1FAFFFF2241A4703D6A5D01594185EB51B805002341C3F5289C5E0159410AD7A370090023411F85EBF16001594148E17A940600234100000030640159413D0AD7230200234152B81E4568015941B81E85EBFFFF22417B14AE376C0159410AD7A3F0FBFF224114AE470170015941F6285C8FF3FF2241A4703DBA7301594114AE4761E8FF2241E17A147E770159419A999999D7FF2241000000507B01594185EB51B8C5FF2241E17A148E8001594152B81E85BFFF224100000070830159415C8FC2F5C2FF22415C8FC22586015941F6285C0FCCFF22413D0AD79389015941C3F528DCCDFF2241C3F5285C8D015941295C8FC2CBFF2241713D0AC7900159418FC2F528C7FF2241A4703DAA93015941C3F5285CBEFF2241333333F396015941D7A3703DC8FF224185EB515897015941F6285C0FCBFF22417B14AE97970159410AD7A370D0FF2241AE47E1AA98015941E17A142ED1FF2241B81E85FB98015941CDCCCCCCD0FF2241713D0A47990159415C8FC275CFFF2241C3F5288C99015941AE47E1FACFFF2241713D0A079A015941F6285C8FD0FF2241AE47E14A9A01594166666666D0FF2241295C8F829A01594166666666CFFF22419A9999799A01594185EB5138CCFF22413D0AD7039A015941A4703D8ACAFF22419A9999F999015941AE47E17AC9FF2241000000109A015941666666E6C8FF2241A4703D6A9A0159415C8FC2F5C8FF22413D0AD7D39A01594100000000CAFF224152B81E359B01594185EB5138CFFF22419A9999F99B015941E17A14AED1FF2241A4703DFA9B015941AE47E17AD3FF224185EB51C89B015941F6285C0FD4FF22411F85EB819B015941D7A370BDD4FF2241713D0A579B015941295C8F42D6FF2241713D0A479B015941B81E856BD7FF2241B81E857B9B015941713D0AD7D8FF2241295C8F729B01594166666666D9FF22418FC2F5389B015941E17A142EDAFF2241EC51B8FE9A015941A4703D8ADBFF2241000000F09A01594148E17A94DCFF224185EB51089B015941EC51B89EDDFF2241000000B09B01594133333333DFFF2241AE47E1DA9B015941D7A370BDE1FF2241B81E85EB9B015941295C8FC2E3FF2241666666E69B0159418FC2F528E5FF2241000000C09B0159418FC2F528E6FF22411F85EB719B0159417B14AE47E6FF2241F6285C6F9A015941A4703D8AE7FF224148E17A649A0159417B14AEC7E8FF2241B81E858B9A0159418FC2F528EAFF22417B14AEC79A015941D7A370BDEBFF22418FC2F5A89A015941AE47E1FAECFF2241000000709A01594100000000EEFF22415C8FC2859A01594114AE47E1EFFF22413D0AD7C39A015941B81E85EBF1FF2241333333C39A0159415C8FC275F3FF22419A9999999A0159419A999999F4FF224152B81E459A015941B81E85EBF5FF224185EB512899015941333333B3F4FF2241E17A14BE980159411F85EBD1F1FF224148E17A2498015941F6285C8FEFFF22419A9999199701594185EB51B8EEFF2241CDCCCC7C96015941333333B3EEFF22419A9999E995015941D7A3703DEEFF2241AE47E14A95015941666666E6EAFF2241295C8F3294015941AE47E1FAE9FF224152B81ED593015941713D0AD7E9FF22413D0AD773930159411F85EB51EAFF2241A4703D2A9301594185EB5138ECFF22417B14AEE7920159410AD7A370F6FF22418FC2F54892015941AE47E17AFAFF2241AE47E11A9201594166666666FDFF2241F6285C1F920159416666666603002341B81E85BB8E015941CDCCCC4C0E00234114AE47518A0159410AD7A370150023413D0AD7C38701594114AE47611F002341EC51B81E85015941A4703D8A2F002341C3F5286C830159419A9999993E0023415C8FC20583015941D7A370BD4C002341E17A145E830159410AD7A370570023410AD7A3E083015941333333B35C00234185EB519884015941713D0AD765002341295C8FD286015941333333336D002341295C8FF288015941E17A14AE740023419A9999798B0159418FC2F5287A0023410AD7A3F08D0159413D0AD7237F00234114AE47019001594148E17A9481002341A4703DCA91015941295C8FC2870023418FC2F5A897015941CDCCCC4C8A0023413D0AD7239901594100000000940023411F85EB11990159417B14AEC79C0023415C8FC245990159415C8FC2F5A300234185EB51A8990159415C8FC2F5A5002341666666269A0159415C8FC2F5A7002341713D0AC79A01594100000000AA0023411F85EB919B015941CDCCCC4CAC0023413D0AD7539C0159415C8FC2F5B1002341A4703D1A9D0159415C8FC2F5B2002341A4703D6A9D01594148E17A14B500234148E17AF49D0159418FC2F5A8B80023417B14AEB79E015941A4703D0ABB002341000000009F0159411F85EB51BD002341295C8F229F0159419A999999BF002341333333039F01594152B81E85C00023418FC2F5D89E01594100000000C20023418FC2F5D89E01594114AE47E1C2002341333333339F01594152B81E85C40023411F85EB619F0159410AD7A370C600234148E17A349F015941B81E856BC60023418FC2F5989E015941295C8F42C700234114AE47619D01594100000000C900234152B81E259D015941B81E856BCB0023417B14AE279D01594100000080CE00234185EB51589D015941CDCCCC4CD10023419A9999A99D015941F6285C8FD400234185EB51289E0159415C8FC2F5D6002341C3F528BC9E015941A4703D8AD700234152B81E459F015941295C8F42D80023418FC2F538A0015941EC51B89ED700234152B81ED5A00159417B14AEC7D800234152B81ED5A1015941CDCCCCCCD9002341333333F3A10159415C8FC275DC00234148E17AD4A10159411F85EB51DE00234152B81E85A1015941CDCCCCCCDF002341AE47E13AA101594148E17A94E10023419A999919A1015941C3F528DCE3002341CDCCCC0CA10159417B14AEC7E500234152B81EF5A0015941E17A142EE7002341F6285CBFA00159413D0AD7A3E6002341C3F5284CA0015941AE47E1FAE30023410AD7A3909F0159417B14AEC7DE002341D7A370FD9D01594185EB51B8D7002341713D0A379C015941CDCCCC4CD80023419A9999C99B015941A4703D8ADA0023415C8FC2A59B015941AE47E1FADC002341F6285CBF9B015941E17A14AEE1002341CDCCCCCC9C0159417B14AEC7E40023410AD7A3909D015941C3F528DCE7002341F6285CEF9D015941E17A142EEE00234152B81E459E0159413D0AD723F200234152B81E759E01594114AE4761F4002341C3F528AC9E01594185EB5138F70023415C8FC2159F01594100000000FA002341333333539F015941295C8FC2FC00234114AE47419F015941E17A14AEFF00234148E17A049F01594114AE47E10201234152B81EF59D01594114AE47E1FA00234152B81EF59B0159417B14AEC7EF002341EC51B89E98015941E17A142EE50023418FC2F588960159417B14AEC7E40023415C8FC2B595015941A4703D0ADB002341713D0A6794015941EC51B81ED3002341713D0A07930159413D0AD7A3BD00234185EB51888F015941713D0A57AD002341E17A142E8D0159417B14AE479D002341A4703D9A8A015941C3F5285C910023410AD7A3308801594114AE4761840023418FC2F53884015941295C8F427C002341B81E85EB800159413D0AD7A36F00234114AE4741780159411F85EBD1700023411F85EB8174015941EC51B89E6A002341333333A370015941AE47E17A670023419A9999796D015941D7A3703D63002341CDCCCCBC690159413D0AD7A35500234114AE47D165015941A4703D8A4A00234152B81E55630159413D0AD72344002341C3F5287C60015941713D0A57510023413D0AD79360015941000000006300234152B81E15620159413D0AD7236B0023416666667663015941EC51B81E7100234152B81E756501594114AE47617500234152B81E4567015941CDCCCCCC7F002341E17A14EE69015941A4703D0A89002341F6285CAF6C015941EC51B89E96002341713D0AA76F015941E17A142EA10023419A9999C971015941F6285C0FAF00234152B81E5574015941', 'topo_ar5_forest_sysdata', '1', '1');    
select topology.toTopoGeom('0102000020E864000019000000448B6CC72AFF2241DD24060114015941423EE8B98CFF22411D5A64F33F015941C13923CA97FF2241B07268015401594100000000B8FF224100000000590159416FF085E91F002341736891F55C0159410000000020002341000000005B0159410000000008002341000000005A01594100000000F8FF2241000000005601594100000000F0FF2241000000005201594100000000F8FF2241000000004C01594100000000D0FF2241000000004801594100000000C0FF2241000000004001594100000000D0FF2241000000003D01594100000000D0FF2241000000003201594100000000A8FF2241000000002901594100000000A8FF224100000000250159410000000090FF224100000000250159410000000090FF224100000000230159410000000078FF224100000000210159410000000078FF2241000000001E0159410000000068FF2241000000001D0159410000000068FF2241000000001A0159410000000048FF224100000000170159410000000048FF22410000000015015941448B6CC72AFF2241DD24060114015941', 'topo_ar5_forest_sysdata', '1', '10');

