-
Notifications
You must be signed in to change notification settings - Fork 0
/
datr_sablon.sql
11993 lines (8718 loc) · 342 KB
/
datr_sablon.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.15
-- Dumped by pg_dump version 9.6.17
-- Started on 2020-08-10 07:34:22
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 12 (class 2615 OID 26616704)
-- Name: datr_sablon; Type: SCHEMA; Schema: -; Owner: postgres
--
CREATE SCHEMA datr_sablon;
ALTER SCHEMA datr_sablon OWNER TO postgres;
--
-- TOC entry 51657 (class 0 OID 0)
-- Dependencies: 12
-- Name: SCHEMA datr_sablon; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA datr_sablon IS 'DatR-ből kiírt DAT feldolgozása... (datr_sablon)';
--
-- TOC entry 14656 (class 1255 OID 26619171)
-- Name: alosztaly_megirasok_generalasa(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.alosztaly_megirasok_generalasa() RETURNS SETOF text
LANGUAGE plpgsql
AS $$
DECLARE
BEGIN
RETURN QUERY
SELECT round(st_x(g.geometria)::numeric, 3) || ' ' ||
round(st_y(g.geometria)::numeric, 3) || ' ' ||
'0' || ' ' ||
CASE bf.muvel_ag
WHEN 1 THEN 'sz ' || bf.minoseg_oszt
WHEN 2 THEN 'r ' || bf.minoseg_oszt
WHEN 3 THEN 'sző ' || bf.minoseg_oszt
WHEN 4 THEN 'k ' || bf.minoseg_oszt
WHEN 5 THEN 'gy ' || bf.minoseg_oszt
WHEN 6 THEN 'l ' || bf.minoseg_oszt
WHEN 7 THEN 'n ' || bf.minoseg_oszt
WHEN 8 THEN 'e ' || bf.minoseg_oszt
WHEN 9 THEN 'mk'
WHEN 10 THEN 'halastó ' || bf.minoseg_oszt
WHEN 11 THEN 'fásítás ' || bf.minoseg_oszt
ELSE 'HIBA!'
END AS min_o_megiras
/*CASE bf.muvel_ag
WHEN 1 THEN 'szántó'
WHEN 2 THEN 'gyep (rét)'
WHEN 3 THEN 'szőlő'
WHEN 4 THEN 'kert'
WHEN 5 THEN 'gyümölcsös'
WHEN 6 THEN 'gyep (legelő)'
WHEN 7 THEN 'nádas'
WHEN 8 THEN 'erdő'
WHEN 9 THEN 'kivett'
WHEN 10 THEN 'halastó'
WHEN 11 THEN 'fásítás'
ELSE 'HIBA!'
END AS muvelesi_ag*/
FROM datr_sablon.t_obj_attrbf bf
LEFT JOIN ( SELECT t_obj_attrbf.felulet_id, st_pointonsurface(t_obj_attrbf.geometria) AS geometria
FROM datr_sablon.t_obj_attrbf
) g ON bf.felulet_id = g.felulet_id;
EXCEPTION
WHEN others THEN RETURN NEXT SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.alosztaly_megirasok_generalasa() OWNER TO postgres;
--
-- TOC entry 51658 (class 0 OID 0)
-- Dependencies: 14656
-- Name: FUNCTION alosztaly_megirasok_generalasa(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.alosztaly_megirasok_generalasa() IS 'Alosztály megírások beszúrási pontjának generálása';
--
-- TOC entry 14657 (class 1255 OID 26619172)
-- Name: bc_bd_letrehozas(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.bc_bd_letrehozas() RETURNS text
LANGUAGE sql
AS $$
CREATE OR REPLACE VIEW datr_sablon.bc_bd AS
SELECT bc.parcel_id id, bc.obj_fels, bc.felulet_id, bc.helyr_szam, bc.cim_id, bc.fekves, bc.kozter_jell, bc.terulet, bc.foldert, bc.forg_ertek, bc.val_nem, bc.szerv_tip, bc.jogi_jelleg, bc.jogallas, (-1) AS szemely_id, bc.ceg_id, bc.elhat_jell, bc.elhat_mod, bc.elozo_parcel_id elozo_id, bc.l_datum, bc.hatarozat, bc.valt_jell, bc.tar_hely, bc.blokk_id, bc.megsz_datum, bc.jelkulcs, bc.munkater_id, bc.pont_id, bc.geometria
FROM datr_sablon.t_obj_attrbc bc
UNION
SELECT bd.parcel_id id, bd.obj_fels, bd.felulet_id, bd.helyr_szam, bd.cim_id, bd.fekves, (-1) AS kozter_jell, bd.terulet, bd.foldert, bd.forg_ertek, bd.val_nem, bd.szerv_tip, bd.jogi_jelleg, bd.jogallas, bd.szemely_id, bd.ceg_id, bd.elhat_jell, bd.elhat_mod, bd.elozo_parcel_id elozo_id, bd.l_datum, bd.hatarozat, bd.valt_jell, bd.tar_hely, bd.blokk_id, bd.megsz_datum, bd.jelkulcs, bd.munkater_id, bd.pont_id, bd.geometria
FROM datr_sablon.t_obj_attrbd bd;
SELECT 'Kész!'::text;
$$;
ALTER FUNCTION datr_sablon.bc_bd_letrehozas() OWNER TO postgres;
--
-- TOC entry 51659 (class 0 OID 0)
-- Dependencies: 14657
-- Name: FUNCTION bc_bd_letrehozas(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.bc_bd_letrehozas() IS 'A BC és BD objektum-féleségeket egyetlen táblában összevonó funkció.';
--
-- TOC entry 14658 (class 1255 OID 26619173)
-- Name: find_el_id(numeric); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.find_el_id(hv_id numeric) RETURNS SETOF numeric
LANGUAGE sql
AS $_$
SELECT el_id
FROM datr_sablon.t_el
WHERE hatarvonal_id IN ($1)
$_$;
ALTER FUNCTION datr_sablon.find_el_id(hv_id numeric) OWNER TO postgres;
--
-- TOC entry 51660 (class 0 OID 0)
-- Dependencies: 14658
-- Name: FUNCTION find_el_id(hv_id numeric); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.find_el_id(hv_id numeric) IS '"Él" keresése "határvonal" azonosító alapján';
--
-- TOC entry 14659 (class 1255 OID 26619174)
-- Name: find_felulet_id(numeric); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.find_felulet_id(h_id numeric) RETURNS SETOF numeric
LANGUAGE sql
AS $_$
SELECT felulet_id
FROM datr_sablon.t_felulet
WHERE hatar_id IN ($1)
$_$;
ALTER FUNCTION datr_sablon.find_felulet_id(h_id numeric) OWNER TO postgres;
--
-- TOC entry 51661 (class 0 OID 0)
-- Dependencies: 14659
-- Name: FUNCTION find_felulet_id(h_id numeric); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.find_felulet_id(h_id numeric) IS '"Felület" keresése "határ" azonosító alapján';
--
-- TOC entry 14660 (class 1255 OID 26619175)
-- Name: find_gyuru_id(numeric); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.find_gyuru_id(h_id numeric) RETURNS SETOF numeric
LANGUAGE sql
AS $_$
SELECT gyuru_id
FROM datr_sablon.t_gyuru
WHERE hatar_id IN ($1)
$_$;
ALTER FUNCTION datr_sablon.find_gyuru_id(h_id numeric) OWNER TO postgres;
--
-- TOC entry 51662 (class 0 OID 0)
-- Dependencies: 14660
-- Name: FUNCTION find_gyuru_id(h_id numeric); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.find_gyuru_id(h_id numeric) IS '"Gyűrű" keresése "határ" azonosító alapján';
--
-- TOC entry 14661 (class 1255 OID 26619176)
-- Name: find_hatar_id(numeric); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.find_hatar_id(hv_id numeric) RETURNS SETOF numeric
LANGUAGE sql
AS $_$
SELECT hatar_id
FROM datr_sablon.t_hatar
WHERE hatarvonal_id IN ($1)
$_$;
ALTER FUNCTION datr_sablon.find_hatar_id(hv_id numeric) OWNER TO postgres;
--
-- TOC entry 51663 (class 0 OID 0)
-- Dependencies: 14661
-- Name: FUNCTION find_hatar_id(hv_id numeric); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.find_hatar_id(hv_id numeric) IS '"Határ" keresése "határvonal" azonosító alapján';
--
-- TOC entry 14662 (class 1255 OID 26619177)
-- Name: find_hatarvonal_id(numeric); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.find_hatarvonal_id(p_id numeric) RETURNS SETOF numeric
LANGUAGE sql
AS $_$
SELECT t_hatarvonal.hatarvonal_id
FROM datr_sablon.t_hatarvonal
WHERE pont_id_1 IN ($1)
OR pont_id_2 IN ($1)
$_$;
ALTER FUNCTION datr_sablon.find_hatarvonal_id(p_id numeric) OWNER TO postgres;
--
-- TOC entry 51664 (class 0 OID 0)
-- Dependencies: 14662
-- Name: FUNCTION find_hatarvonal_id(p_id numeric); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.find_hatarvonal_id(p_id numeric) IS '"Határvonal" keresése "pont" azonosító alapján';
--
-- TOC entry 14663 (class 1255 OID 26619178)
-- Name: find_pont_id(numeric, numeric); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.find_pont_id(x numeric, y numeric) RETURNS SETOF numeric
LANGUAGE sql
AS $_$
SELECT pont_id
FROM datr_sablon.t_pont
WHERE round(pont_x,2)=round($1,2)
AND round(pont_y,2)=round($2,2)
$_$;
ALTER FUNCTION datr_sablon.find_pont_id(x numeric, y numeric) OWNER TO postgres;
--
-- TOC entry 51665 (class 0 OID 0)
-- Dependencies: 14663
-- Name: FUNCTION find_pont_id(x numeric, y numeric); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.find_pont_id(x numeric, y numeric) IS '"Pont" keresése koordináta alapján';
--
-- TOC entry 14664 (class 1255 OID 26619179)
-- Name: geometria_mezo_feltoltes_ba(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_ba() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_ba(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_ba() OWNER TO postgres;
--
-- TOC entry 14665 (class 1255 OID 26619180)
-- Name: geometria_mezo_feltoltes_ba(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_ba(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();
SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrba');
SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrba;
if generalt then
UPDATE datr_sablon.t_obj_attrba AS ba SET geometria=poligon_epites.geometria
FROM (
SELECT linestring_epites.felulet_id,
ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria
FROM (
SELECT f.felulet_id,
ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria
FROM datr_sablon.t_pont p1,
datr_sablon.t_pont p2,
datr_sablon.t_hatarvonal hv,
datr_sablon.t_hatar h,
datr_sablon.t_felulet f,
datr_sablon.t_obj_attrba aba
WHERE hv.pont_id_1=p1.pont_id
AND hv.pont_id_2=p2.pont_id
AND h.hatarvonal_id=hv.hatarvonal_id
AND f.hatar_id=h.hatar_id
AND f.felulet_id=aba.felulet_id
) AS linestring_epites
GROUP BY felulet_id
) AS poligon_epites
WHERE poligon_epites.felulet_id=ba.felulet_id;
else
UPDATE datr_sablon.t_obj_attrba AS b SET geometria=f.geometria
FROM datr_sablon.t_felulet AS f
WHERE b.felulet_id=f.felulet_id;
end if;
--
SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrba WHERE geometria IS NOT NULL;
SELECT INTO befejezes clock_timestamp();
RETURN uzenet || chr(10) ||
'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) ||
'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_ba(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51666 (class 0 OID 0)
-- Dependencies: 14665
-- Name: FUNCTION geometria_mezo_feltoltes_ba(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_ba(generalt boolean) IS 'A BA tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14666 (class 1255 OID 26619181)
-- Name: geometria_mezo_feltoltes_bb(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bb() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_bb(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bb() OWNER TO postgres;
--
-- TOC entry 14667 (class 1255 OID 26619182)
-- Name: geometria_mezo_feltoltes_bb(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bb(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();
SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrbb');
SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrbb;
if generalt then
UPDATE datr_sablon.t_obj_attrbb AS bb SET geometria=poligon_epites.geometria
FROM (
SELECT linestring_epites.felulet_id,
ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria
FROM (
SELECT f.felulet_id,
ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria
FROM datr_sablon.t_pont p1,
datr_sablon.t_pont p2,
datr_sablon.t_hatarvonal hv,
datr_sablon.t_hatar h,
datr_sablon.t_felulet f,
datr_sablon.t_obj_attrbb abb
WHERE hv.pont_id_1=p1.pont_id
AND hv.pont_id_2=p2.pont_id
AND h.hatarvonal_id=hv.hatarvonal_id
AND f.hatar_id=h.hatar_id
AND f.felulet_id=abb.felulet_id
) AS linestring_epites
GROUP BY felulet_id
) AS poligon_epites
WHERE poligon_epites.felulet_id=bb.felulet_id;
else
UPDATE datr_sablon.t_obj_attrbb AS b SET geometria=f.geometria
FROM datr_sablon.t_felulet AS f
WHERE b.felulet_id=f.felulet_id;
end if;
--
SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrbb WHERE geometria IS NOT NULL;
SELECT INTO befejezes clock_timestamp();
RETURN uzenet || chr(10) ||
'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) ||
'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bb(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51667 (class 0 OID 0)
-- Dependencies: 14667
-- Name: FUNCTION geometria_mezo_feltoltes_bb(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bb(generalt boolean) IS 'A BB tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14668 (class 1255 OID 26619183)
-- Name: geometria_mezo_feltoltes_bc(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bc() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_bc(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bc() OWNER TO postgres;
--
-- TOC entry 14669 (class 1255 OID 26619184)
-- Name: geometria_mezo_feltoltes_bc(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bc(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();
SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrbc');
SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrbc;
if generalt then
UPDATE datr_sablon.t_obj_attrbc AS bc SET geometria=poligon_epites.geometria
FROM (
SELECT linestring_epites.felulet_id,
ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria
FROM (
SELECT f.felulet_id,
ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria
FROM datr_sablon.t_pont p1,
datr_sablon.t_pont p2,
datr_sablon.t_hatarvonal hv,
datr_sablon.t_hatar h,
datr_sablon.t_felulet f,
datr_sablon.t_obj_attrbc abc
WHERE hv.pont_id_1=p1.pont_id
AND hv.pont_id_2=p2.pont_id
AND h.hatarvonal_id=hv.hatarvonal_id
AND f.hatar_id=h.hatar_id
AND f.felulet_id=abc.felulet_id
) AS linestring_epites
GROUP BY felulet_id
) AS poligon_epites
WHERE poligon_epites.felulet_id=bc.felulet_id;
else
UPDATE datr_sablon.t_obj_attrbc AS b SET geometria=f.geometria
FROM datr_sablon.t_felulet AS f
WHERE b.felulet_id=f.felulet_id;
end if;
--
SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrbc WHERE geometria IS NOT NULL;
SELECT INTO befejezes clock_timestamp();
RETURN uzenet || chr(10) ||
'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) ||
'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bc(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51668 (class 0 OID 0)
-- Dependencies: 14669
-- Name: FUNCTION geometria_mezo_feltoltes_bc(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bc(generalt boolean) IS 'A BC tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14670 (class 1255 OID 26619185)
-- Name: geometria_mezo_feltoltes_bd(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bd() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_bd(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bd() OWNER TO postgres;
--
-- TOC entry 14671 (class 1255 OID 26619186)
-- Name: geometria_mezo_feltoltes_bd(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bd(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();
SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrbd');
SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrbd;
if generalt then
UPDATE datr_sablon.t_obj_attrbd AS bd SET geometria=poligon_epites.geometria
FROM (
SELECT linestring_epites.felulet_id,
ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria
FROM (
SELECT f.felulet_id,
ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria
FROM datr_sablon.t_pont p1,
datr_sablon.t_pont p2,
datr_sablon.t_hatarvonal hv,
datr_sablon.t_hatar h,
datr_sablon.t_felulet f,
datr_sablon.t_obj_attrbd abd
WHERE hv.pont_id_1=p1.pont_id
AND hv.pont_id_2=p2.pont_id
AND h.hatarvonal_id=hv.hatarvonal_id
AND f.hatar_id=h.hatar_id
AND f.felulet_id=abd.felulet_id
) AS linestring_epites
GROUP BY felulet_id
) AS poligon_epites
WHERE poligon_epites.felulet_id=bd.felulet_id;
else
UPDATE datr_sablon.t_obj_attrbd AS b SET geometria=f.geometria
FROM datr_sablon.t_felulet AS f
WHERE b.felulet_id=f.felulet_id;
end if;
--
SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrbd WHERE geometria IS NOT NULL;
SELECT INTO befejezes clock_timestamp();
RETURN uzenet || chr(10) ||
'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) ||
'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bd(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51669 (class 0 OID 0)
-- Dependencies: 14671
-- Name: FUNCTION geometria_mezo_feltoltes_bd(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bd(generalt boolean) IS 'A BD tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14672 (class 1255 OID 26619187)
-- Name: geometria_mezo_feltoltes_be(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_be() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_be(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_be() OWNER TO postgres;
--
-- TOC entry 51670 (class 0 OID 0)
-- Dependencies: 14672
-- Name: FUNCTION geometria_mezo_feltoltes_be(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_be() IS 'A BE tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14673 (class 1255 OID 26619188)
-- Name: geometria_mezo_feltoltes_be(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_be(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$DECLARE eredeti integer := 0; szamlalo integer := 0; uzenet text; kezdes timestamp; befejezes timestamp;BEGIN
SELECT INTO kezdes clock_timestamp(); SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrbe'); SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrbe; if generalt then
UPDATE datr_sablon.t_obj_attrbe AS be SET geometria=poligon_epites.geometria FROM ( SELECT linestring_epites.felulet_id, ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria FROM ( SELECT f.felulet_id, ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria FROM datr_sablon.t_pont p1, datr_sablon.t_pont p2, datr_sablon.t_hatarvonal hv, datr_sablon.t_hatar h, datr_sablon.t_felulet f, datr_sablon.t_obj_attrbe abe WHERE hv.pont_id_1=p1.pont_id AND hv.pont_id_2=p2.pont_id AND h.hatarvonal_id=hv.hatarvonal_id AND f.hatar_id=h.hatar_id AND f.felulet_id=abe.felulet_id ) AS linestring_epites GROUP BY felulet_id ) AS poligon_epites WHERE poligon_epites.felulet_id=be.felulet_id; else UPDATE datr_sablon.t_obj_attrbe AS b SET geometria=f.geometria FROM datr_sablon.t_felulet AS f WHERE b.felulet_id=f.felulet_id; end if;
-- SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrbe WHERE geometria IS NOT NULL; SELECT INTO befejezes clock_timestamp(); RETURN uzenet || chr(10) || 'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) || 'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;EXCEPTION WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_be(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51671 (class 0 OID 0)
-- Dependencies: 14673
-- Name: FUNCTION geometria_mezo_feltoltes_be(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_be(generalt boolean) IS 'A BE tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14674 (class 1255 OID 26619189)
-- Name: geometria_mezo_feltoltes_bf(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bf() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_bf(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bf() OWNER TO postgres;
--
-- TOC entry 51672 (class 0 OID 0)
-- Dependencies: 14674
-- Name: FUNCTION geometria_mezo_feltoltes_bf(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bf() IS 'A BF tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14675 (class 1255 OID 26619190)
-- Name: geometria_mezo_feltoltes_bf(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bf(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$DECLARE eredeti integer := 0; szamlalo integer := 0; uzenet text; kezdes timestamp; befejezes timestamp;BEGIN
SELECT INTO kezdes clock_timestamp(); SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrbf'); SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrbf; if generalt then
UPDATE datr_sablon.t_obj_attrbf AS bf SET geometria=poligon_epites.geometria FROM ( SELECT linestring_epites.felulet_id, ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria FROM ( SELECT f.felulet_id, ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria FROM datr_sablon.t_pont p1, datr_sablon.t_pont p2, datr_sablon.t_hatarvonal hv, datr_sablon.t_hatar h, datr_sablon.t_felulet f, datr_sablon.t_obj_attrbf abf WHERE hv.pont_id_1=p1.pont_id AND hv.pont_id_2=p2.pont_id AND h.hatarvonal_id=hv.hatarvonal_id AND f.hatar_id=h.hatar_id AND f.felulet_id=abf.felulet_id ) AS linestring_epites GROUP BY felulet_id ) AS poligon_epites WHERE poligon_epites.felulet_id=bf.felulet_id; else
UPDATE datr_sablon.t_obj_attrbf AS b SET geometria=f.geometria FROM datr_sablon.t_felulet AS f WHERE b.felulet_id=f.felulet_id; end if;
-- SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrbf WHERE geometria IS NOT NULL; SELECT INTO befejezes clock_timestamp(); RETURN uzenet || chr(10) || 'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) || 'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;EXCEPTION WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bf(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51673 (class 0 OID 0)
-- Dependencies: 14675
-- Name: FUNCTION geometria_mezo_feltoltes_bf(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bf(generalt boolean) IS 'A BF tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14676 (class 1255 OID 26619191)
-- Name: geometria_mezo_feltoltes_bg(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bg() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_bg(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bg() OWNER TO postgres;
--
-- TOC entry 51674 (class 0 OID 0)
-- Dependencies: 14676
-- Name: FUNCTION geometria_mezo_feltoltes_bg(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bg() IS 'A bg tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14677 (class 1255 OID 26619192)
-- Name: geometria_mezo_feltoltes_bg(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_bg(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$DECLARE eredeti integer := 0; szamlalo integer := 0; uzenet text; kezdes timestamp; befejezes timestamp;BEGIN
SELECT INTO kezdes clock_timestamp(); SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrbg'); SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrbg; if generalt then UPDATE datr_sablon.t_obj_attrbg AS bg SET geometria=poligon_epites.geometria FROM ( SELECT linestring_epites.felulet_id, ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria FROM ( SELECT f.felulet_id, ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria FROM datr_sablon.t_pont p1, datr_sablon.t_pont p2, datr_sablon.t_hatarvonal hv, datr_sablon.t_hatar h, datr_sablon.t_felulet f, datr_sablon.t_obj_attrbg abg WHERE hv.pont_id_1=p1.pont_id AND hv.pont_id_2=p2.pont_id AND h.hatarvonal_id=hv.hatarvonal_id AND f.hatar_id=h.hatar_id AND f.felulet_id=abg.felulet_id ) AS linestring_epites GROUP BY felulet_id ) AS poligon_epites WHERE poligon_epites.felulet_id=bg.felulet_id; else
UPDATE datr_sablon.t_obj_attrbg AS b SET geometria=f.geometria FROM datr_sablon.t_felulet AS f WHERE b.felulet_id=f.felulet_id; end if;
-- SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrbg WHERE geometria IS NOT NULL; SELECT INTO befejezes clock_timestamp(); RETURN uzenet || chr(10) || 'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) || 'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;EXCEPTION WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_bg(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51675 (class 0 OID 0)
-- Dependencies: 14677
-- Name: FUNCTION geometria_mezo_feltoltes_bg(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_bg(generalt boolean) IS 'A bg tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14678 (class 1255 OID 26619193)
-- Name: geometria_mezo_feltoltes_ca(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_ca() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
uzenet text;
BEGIN
SELECT INTO uzenet datr_sablon.geometria_mezo_feltoltes_ca(true);
RETURN uzenet;
EXCEPTION
WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_ca() OWNER TO postgres;
--
-- TOC entry 51676 (class 0 OID 0)
-- Dependencies: 14678
-- Name: FUNCTION geometria_mezo_feltoltes_ca(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_ca() IS 'A CA tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14679 (class 1255 OID 26619194)
-- Name: geometria_mezo_feltoltes_ca(boolean); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_ca(generalt boolean) RETURNS text
LANGUAGE plpgsql
AS $$DECLARE eredeti integer := 0; szamlalo integer := 0; uzenet text; kezdes timestamp; befejezes timestamp;BEGIN
SELECT INTO kezdes clock_timestamp(); SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('obj_attrca'); SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_obj_attrca;
if generalt then UPDATE datr_sablon.t_obj_attrca AS ca SET geometria=poligon_epites.geometria FROM ( SELECT linestring_epites.felulet_id, ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria FROM ( SELECT f.felulet_id, ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria FROM datr_sablon.t_pont p1, datr_sablon.t_pont p2, datr_sablon.t_hatarvonal hv, datr_sablon.t_hatar h, datr_sablon.t_felulet f, datr_sablon.t_obj_attrca aca WHERE hv.pont_id_1=p1.pont_id AND hv.pont_id_2=p2.pont_id AND h.hatarvonal_id=hv.hatarvonal_id AND f.hatar_id=h.hatar_id AND f.felulet_id=aca.felulet_id ) AS linestring_epites GROUP BY felulet_id ) AS poligon_epites WHERE poligon_epites.felulet_id=ca.felulet_id; else UPDATE datr_sablon.t_obj_attrca AS c SET geometria=f.geometria FROM datr_sablon.t_felulet AS f WHERE c.felulet_id=f.felulet_id;
end if; -- SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_obj_attrca WHERE geometria IS NOT NULL; SELECT INTO befejezes clock_timestamp(); RETURN '[datr_sablon.t_obj_attrca]' || chr(10) || uzenet || chr(10) || 'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) || 'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;EXCEPTION WHEN others THEN RETURN SQLSTATE || ': ' || SQLERRM;END;$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_ca(generalt boolean) OWNER TO postgres;
--
-- TOC entry 51677 (class 0 OID 0)
-- Dependencies: 14679
-- Name: FUNCTION geometria_mezo_feltoltes_ca(generalt boolean); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_ca(generalt boolean) IS 'A CA tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14680 (class 1255 OID 26619195)
-- Name: geometria_mezo_feltoltes_felirat(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_felirat() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();
SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('felirat');
SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_felirat;
UPDATE datr_sablon.t_felirat AS f
SET geometria=ST_GeomFromText('POINT(' || p.pont_y || ' ' || p.pont_x || ')', 23700)
FROM datr_sablon.t_pont p
WHERE f.pont_id_text = p.pont_id;
SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_felirat WHERE geometria IS NOT NULL;
SELECT INTO befejezes clock_timestamp();
RETURN uzenet || chr(10) ||
'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) ||
'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;
EXCEPTION
WHEN others THEN RETURN SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_felirat() OWNER TO postgres;
--
-- TOC entry 51678 (class 0 OID 0)
-- Dependencies: 14680
-- Name: FUNCTION geometria_mezo_feltoltes_felirat(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_felirat() IS 'A FELIRAT tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14681 (class 1255 OID 26619196)
-- Name: geometria_mezo_feltoltes_felulet(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_felulet() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();
SELECT INTO uzenet datr_sablon.geometria_mezo_keszites('felulet');
SELECT count (*) INTO STRICT eredeti FROM datr_sablon.t_felulet;
UPDATE datr_sablon.t_felulet AS f SET geometria=poligon_epites.geometria
FROM (
SELECT linestring_epites.felulet_id,
ST_BuildArea(ST_Union(linestring_epites.geometria)) AS geometria
FROM (
SELECT f.felulet_id,
ST_GeomFromText( 'LINESTRING (' || p1.pont_y || ' ' || p1.pont_x || ', ' || p2.pont_y || ' ' || p2.pont_x || ')' , 23700) AS geometria
FROM datr_sablon.t_pont p1,
datr_sablon.t_pont p2,
datr_sablon.t_hatarvonal hv,
datr_sablon.t_hatar h,
datr_sablon.t_felulet f
WHERE hv.pont_id_1=p1.pont_id
AND hv.pont_id_2=p2.pont_id
AND h.hatarvonal_id=hv.hatarvonal_id
AND f.hatar_id=h.hatar_id
) AS linestring_epites
GROUP BY felulet_id
) AS poligon_epites
WHERE poligon_epites.felulet_id=f.felulet_id;
SELECT count (*) INTO STRICT szamlalo FROM datr_sablon.t_felulet WHERE geometria IS NOT NULL;
SELECT INTO befejezes clock_timestamp();
RETURN uzenet || chr(10) ||
'A ' || eredeti || ' darab geometriát tároló mezőt ' || szamlalo || ' esetben feltöltöttem!' || chr(10) ||
'Kezdés: ' || kezdes || chr(10) || 'Befejezés: ' || befejezes || chr(10) || 'Időtartam: ' || befejezes-kezdes;
EXCEPTION
WHEN others THEN RETURN SQLERRM;
END;
$$;
ALTER FUNCTION datr_sablon.geometria_mezo_feltoltes_felulet() OWNER TO postgres;
--
-- TOC entry 51679 (class 0 OID 0)
-- Dependencies: 14681
-- Name: FUNCTION geometria_mezo_feltoltes_felulet(); Type: COMMENT; Schema: datr_sablon; Owner: postgres
--
COMMENT ON FUNCTION datr_sablon.geometria_mezo_feltoltes_felulet() IS 'A FELULET tábla geometriát tároló mezőjének feltöltése.';
--
-- TOC entry 14682 (class 1255 OID 26619197)
-- Name: geometria_mezo_feltoltes_hatar(); Type: FUNCTION; Schema: datr_sablon; Owner: postgres
--
CREATE FUNCTION datr_sablon.geometria_mezo_feltoltes_hatar() RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
eredeti integer := 0;
szamlalo integer := 0;
uzenet text;
kezdes timestamp;
befejezes timestamp;
BEGIN
SELECT INTO kezdes clock_timestamp();