6. Apéndice: Soluciones básicas para el taller

6.1. Soluciones a Enrutamiento peatonal

6.1.1. Ejercicio: 1 (Capítulo: Peatón)

Ejercicio 1: Ruteo para un solo peatón

 seq | path_seq | node  | edge  |          cost          |       agg_cost        
-----+----------+-------+-------+------------------------+-----------------------
   1 |        1 |  1993 |  4887 |  0.0004545680359898922 |                     0
   2 |        2 |  3247 | 13882 | 0.00030209455672831193 | 0.0004545680359898922
   3 |        3 | 10566 | 12748 | 0.00012886733502571394 | 0.0007566625927182041
   4 |        4 |  9433 |  3207 | 0.00026067430822788876 | 0.0008855299277439181
   5 |        5 |  2072 |  3208 | 0.00013233829380248532 | 0.0011462042359718068
   6 |        6 | 10858 | 14167 | 0.00030930909334481594 |  0.001278542529774292
   7 |        7 |  5049 |  7247 | 0.00010424667860573636 |  0.001587851623119108
   8 |        8 |  4948 |  7123 | 4.7217475577467746e-05 | 0.0016920983017248443
   9 |        9 | 10855 | 14164 | 0.00019537634330397507 |  0.001739315777302312
  10 |       10 |  2071 |  3206 |  0.0005348082810241019 | 0.0019346921206062871
  11 |       11 |  3234 |  4873 |  0.0009434187067426695 |  0.002469500401630389
  12 |       12 |  9434 | 15935 |  0.0001165127460835332 | 0.0034129191083730583
  13 |       13 |  2070 | 15062 | 0.00017240344338673923 | 0.0035294318544565914
  14 |       14 |  9909 | 13244 | 0.00012314109793537038 | 0.0037018352978433304
  15 |       15 |  6612 |  9210 | 0.00017367429285494398 |  0.003824976395778701
  16 |       16 |  6613 | 15679 | 0.00021035779044742807 |  0.003998650688633645
  17 |       17 | 10178 |  9216 |  0.0001646876691578203 |  0.004209008479081074
  18 |       18 |  6617 | 14158 |  6.012021290498655e-05 |  0.004373696148238894
  19 |       19 | 10849 | 14156 | 0.00033172715728052376 |  0.004433816361143881
  20 |       20 | 10847 |  6657 |  0.0001766296973907933 |  0.004765543518424405
  21 |       21 |  4582 | 15680 | 0.00012464132540815551 |  0.004942173215815198
  22 |       22 |  6618 |  4968 |  0.0003140189447241776 |  0.005066814541223354
  23 |       23 |  3309 |  5632 | 0.00018419789013868632 |  0.005380833485947531
  24 |       24 |  3818 |  9256 | 3.0591828979174773e-05 | 0.0055650313760862175
  25 |       25 |  6645 |  9257 | 0.00027118941719242527 |  0.005595623205065393
  26 |       26 |  6648 |  9262 |  0.0006729528871977118 |  0.005866812622257818
  27 |       27 |  6646 |    -1 |                      0 |   0.00653976550945553
(27 rows)

6.1.2. Ejercicio: 2 (Capítulo: Peatón)

Ejercicio 2: Muchos peatones van al mismo destino

 seq | path_seq | start_vid | node  | edge  |        cost        |      agg_cost      
-----+----------+-----------+-------+-------+--------------------+--------------------
   1 |        1 |      1993 |  1993 |  4887 |  50.15792152769706 |                  0
   2 |        2 |      1993 |  3247 | 13882 | 32.779781602585345 |  50.15792152769706
   3 |        3 |      1993 | 10566 | 12748 | 13.616161545814155 |  82.93770313028242
   4 |        4 |      1993 |  9433 |  3207 | 27.364347384393067 |  96.55386467609657
   5 |        5 |      1993 |  2072 |  3208 | 14.634014185530143 | 123.91821206048964
   6 |        6 |      1993 | 10858 | 14167 |  33.53478719410195 | 138.55222624601979
   7 |        7 |      1993 |  5049 |  7247 | 11.286628177242525 | 172.08701344012172
   8 |        8 |      1993 |  4948 |  7123 |  5.161507587906862 | 183.37364161736426
   9 |        9 |      1993 | 10855 | 14164 |  21.42892131749852 | 188.53514920527113
  10 |       10 |      1993 |  2071 |  3206 |  57.89952635635984 | 209.96407052276965
  11 |       11 |      1993 |  3234 |  4873 |  92.41336178131381 |  267.8635968791295
  12 |       12 |      1993 |  9434 | 15935 | 10.911460281087617 |  360.2769586604433
  13 |       13 |      1993 |  2070 | 15062 |  18.42375376447534 |  371.1884189415309
  14 |       14 |      1993 |  9909 | 13244 | 11.521142334504626 |  389.6121727060063
  15 |       15 |      1993 |  6612 |  9210 |  16.40531288099617 |  401.1333150405109
  16 |       16 |      1993 |  6613 | 15679 |  19.75472991290797 |  417.5386279215071
  17 |       17 |      1993 | 10178 |  9216 |  17.70823511970989 |  437.2933578344151
  18 |       18 |      1993 |  6617 | 14158 |  6.665103688509596 |   455.001592954125
  19 |       19 |      1993 | 10849 | 14156 |  36.75652827639297 |  461.6666966426346
  20 |       20 |      1993 | 10847 |  6657 |  19.56502203190901 |  498.4232249190276
  21 |       21 |      1993 |  4582 | 15680 | 11.966018587477372 |  517.9882469509366
  22 |       22 |      1993 |  6618 |  4968 | 29.364169061722507 |   529.954265538414
  23 |       23 |      1993 |  3309 |  5632 |  19.44687074462821 |  559.3184346001365
  24 |       24 |      1993 |  3818 |  9256 |   3.22587185408776 |  578.7653053447647
  25 |       25 |      1993 |  6645 |  9257 |  29.89968994651939 |  581.9911771988525
  26 |       26 |      1993 |  6648 |  9262 |  65.72095255170306 |  611.8908671453719
  27 |       27 |      1993 |  6646 |    -1 |                  0 |  677.6118196970749
  28 |        1 |      9129 |  9129 | 12438 | 61.882051751707415 |                  0
  29 |        2 |      9129 |  7257 | 10014 |  50.73234566317791 | 61.882051751707415
  30 |        3 |      9129 |  3238 |  4878 | 21.911441020168837 | 112.61439741488533
  31 |        4 |      9129 |  6634 |  9238 | 12.464363424799977 | 134.52583843505417
  32 |        5 |      9129 |  6630 |  9239 |  20.76711342446364 | 146.99020185985415
  33 |        6 |      9129 |  6631 | 13509 | 14.561182669463161 |  167.7573152843178
  34 |        7 |      9129 | 10178 |  9216 |  17.70823511970989 | 182.31849795378096
  35 |        8 |      9129 |  6617 | 14158 |  6.665103688509596 | 200.02673307349085
  36 |        9 |      9129 | 10849 | 14156 |  36.75652827639297 | 206.69183676200043
  37 |       10 |      9129 | 10847 |  6657 |  19.56502203190901 |  243.4483650383934
  38 |       11 |      9129 |  4582 | 15680 | 11.966018587477372 | 263.01338707030243
  39 |       12 |      9129 |  6618 |  4968 | 29.364169061722507 |  274.9794056577798
  40 |       13 |      9129 |  3309 |  5632 |  19.44687074462821 |  304.3435747195023
  41 |       14 |      9129 |  3818 |  9256 |   3.22587185408776 |  323.7904454641305
  42 |       15 |      9129 |  6645 |  9257 |  29.89968994651939 |  327.0163173182183
  43 |       16 |      9129 |  6648 |  9262 |  65.72095255170306 |  356.9160072647377
  44 |       17 |      9129 |  6646 |    -1 |                  0 | 422.63695981644076
(44 rows)

6.1.3. Ejercicio: 3 (Capítulo: Peatón)

Ejercicio 3: Muchos peatones que salen de la misma ubicación

 seq | path_seq | end_vid | node  | edge  |        cost        |      agg_cost      
-----+----------+---------+-------+-------+--------------------+--------------------
   1 |        1 |    1993 |  6646 |  9262 |  50.55457888592543 |                  0
   2 |        2 |    1993 |  6648 |  9257 |  22.99976149732261 |  50.55457888592543
   3 |        3 |    1993 |  6645 |  9256 |  2.481439887759815 |  73.55434038324805
   4 |        4 |    1993 |  3818 |  5632 |   14.9591313420217 |  76.03578027100787
   5 |        5 |    1993 |  3309 |  4968 |  22.58782235517116 |  90.99491161302956
   6 |        6 |    1993 |  6618 | 15680 |    9.2046296826749 | 113.58273396820071
   7 |        7 |    1993 |  4582 |  6657 | 15.050016947622314 | 122.78736365087562
   8 |        8 |    1993 | 10847 | 14156 | 28.274252520302284 | 137.83738059849793
   9 |        9 |    1993 | 10849 | 14158 |  5.127002837315074 | 166.11163311880023
  10 |       10 |    1993 |  6617 |  9216 | 13.621719322853762 |  171.2386359561153
  11 |       11 |    1993 | 10178 | 15679 | 15.195946086852283 | 184.86035527896905
  12 |       12 |    1993 |  6613 |  9210 |  12.61947144692013 | 200.05630136582133
  13 |       13 |    1993 |  6612 | 13244 |  8.862417180388174 | 212.67577281274146
  14 |       14 |    1993 |  9909 | 15062 | 14.172118280365645 | 221.53818999312963
  15 |       15 |    1993 |  2070 | 15935 |  8.393430985452014 |  235.7103082734953
  16 |       16 |    1993 |  9434 |  4873 |  71.08720137024139 | 244.10373925894731
  17 |       17 |    1993 |  3234 |  3206 | 44.538097197199875 | 315.19094062918873
  18 |       18 |    1993 |  2071 | 14164 | 16.483785628845016 |  359.7290378263886
  19 |       19 |    1993 | 10855 |  7123 |  3.970390452236048 |  376.2128234552336
  20 |       20 |    1993 |  4948 |  7247 |  8.682021674801941 |  380.1832139074697
  21 |       21 |    1993 |  5049 | 14167 | 25.795990149309194 |  388.8652355822716
  22 |       22 |    1993 | 10858 |  3208 |  11.25693398886934 |  414.6612257315808
  23 |       23 |    1993 |  2072 |  3207 | 21.049497987994666 | 425.91815972045015
  24 |       24 |    1993 |  9433 | 12748 | 10.473970419857041 |  446.9676577084448
  25 |       25 |    1993 | 10566 | 13882 |  25.21521661737334 | 457.44162812830183
  26 |       26 |    1993 |  3247 |  4887 |  38.58301655976697 |  482.6568447456752
  27 |       27 |    1993 |  1993 |    -1 |                  0 |  521.2398613054421
  28 |        1 |    9129 |  6646 |  9262 |  50.55457888592543 |                  0
  29 |        2 |    9129 |  6648 |  9257 |  22.99976149732261 |  50.55457888592543
  30 |        3 |    9129 |  6645 |  9256 |  2.481439887759815 |  73.55434038324805
  31 |        4 |    9129 |  3818 |  5632 |   14.9591313420217 |  76.03578027100787
  32 |        5 |    9129 |  3309 |  4968 |  22.58782235517116 |  90.99491161302956
  33 |        6 |    9129 |  6618 | 15680 |    9.2046296826749 | 113.58273396820071
  34 |        7 |    9129 |  4582 |  6657 | 15.050016947622314 | 122.78736365087562
  35 |        8 |    9129 | 10847 | 14156 | 28.274252520302284 | 137.83738059849793
  36 |        9 |    9129 | 10849 | 14158 |  5.127002837315074 | 166.11163311880023
  37 |       10 |    9129 |  6617 |  9216 | 13.621719322853762 |  171.2386359561153
  38 |       11 |    9129 | 10178 | 13509 | 11.200909745740892 | 184.86035527896905
  39 |       12 |    9129 |  6631 |  9239 | 15.974702634202801 | 196.06126502470994
  40 |       13 |    9129 |  6630 |  9238 |   9.58797186523075 | 212.03596765891274
  41 |       14 |    9129 |  6634 |  4878 | 16.854954630899105 | 221.62393952414348
  42 |       15 |    9129 |  3238 | 10014 |  39.02488127936762 | 238.47889415504258
  43 |       16 |    9129 |  7257 | 12438 |  47.60157827054417 |  277.5037754344102
  44 |       17 |    9129 |  9129 |    -1 |                  0 |  325.1053537049544
(44 rows)

6.1.4. Ejercicio: 4 (Capítulo: Peatón)

Ejercicio 4: Muchos peatones que van a diferentes destinos

 seq | path_seq | start_vid | end_vid | node  | edge  |        cost         |      agg_cost      
-----+----------+-----------+---------+-------+-------+---------------------+--------------------
   1 |        1 |      1993 |    2197 |  1993 |  3095 |  1.2360713954351767 |                  0
   2 |        2 |      1993 |    2197 |  1995 |  5217 |  0.4728160774964071 | 1.2360713954351767
   3 |        3 |      1993 |    2197 |  3521 |  3389 |  0.8295136062216593 |  1.708887472931584
   4 |        4 |      1993 |    2197 |  2191 |  3394 |  1.5878157811361224 | 2.5384010791532434
   5 |        5 |      1993 |    2197 |  2194 |  3397 |  1.6538467580211758 |  4.126216860289366
   6 |        6 |      1993 |    2197 |  2195 |  3401 |  1.6675661802817965 | 5.7800636183105425
   7 |        7 |      1993 |    2197 |  2197 |    -1 |                   0 |  7.447629798592339
   8 |        1 |      1993 |   15011 |  1993 |  4887 |  0.6430502759961161 |                  0
   9 |        2 |      1993 |   15011 |  3247 | 13882 | 0.42025361028955566 | 0.6430502759961161
  10 |        3 |      1993 |   15011 | 10566 | 12748 |   0.174566173664284 | 1.0633038862856719
  11 |        4 |      1993 |   15011 |  9433 |  3207 |  0.3508249664665778 |  1.237870059949956
  12 |        5 |      1993 |   15011 |  2072 |  3208 | 0.18761556648115568 | 1.5886950264165338
  13 |        6 |      1993 |   15011 | 10858 | 14167 |  0.4299331691551532 | 1.7763105928976894
  14 |        7 |      1993 |   15011 |  5049 |  7247 | 0.14470036124669902 |  2.206243762052843
  15 |        8 |      1993 |   15011 |  4948 |  7123 | 0.06617317420393413 |  2.350944123299542
  16 |        9 |      1993 |   15011 | 10855 | 17565 |  0.3847323595382688 |  2.417117297503476
  17 |       10 |      1993 |   15011 | 15748 | 17564 |  0.4777123337673815 | 2.8018496570417444
  18 |       11 |      1993 |   15011 | 10857 |  7030 |  0.0879035460558817 |  3.279561990809126
  19 |       12 |      1993 |   15011 |  4881 |  9662 | 0.10292165256942362 | 3.3674655368650077
  20 |       13 |      1993 |   15011 |  6991 | 13883 | 0.17230399082241182 | 3.4703871894344314
  21 |       14 |      1993 |   15011 | 10567 | 13867 |  0.6075277865632972 | 3.6426911802568434
  22 |       15 |      1993 |   15011 | 10550 |  9661 | 0.22181592779863255 |  4.250218966820141
  23 |       16 |      1993 |   15011 |  6989 |  7008 | 0.06924443041952956 |  4.472034894618774
  24 |       17 |      1993 |   15011 |  4866 |  7582 | 0.08041207523572146 |  4.541279325038303
  25 |       18 |      1993 |   15011 |  5312 |  7026 | 0.44398181437791623 |  4.621691400274025
  26 |       19 |      1993 |   15011 |  4878 |  8093 | 0.20345982045936467 |  5.065673214651941
  27 |       20 |      1993 |   15011 |  5744 |  7132 |  0.3270525870120427 |  5.269133035111306
  28 |       21 |      1993 |   15011 |  4954 | 13852 |  0.2337784204033212 |  5.596185622123349
  29 |       22 |      1993 |   15011 | 10535 | 17365 |  0.6185518881271765 |   5.82996404252667
  30 |       23 |      1993 |   15011 | 15006 | 22636 |  0.4541036235318089 |  6.448515930653846
  31 |       24 |      1993 |   15011 | 15039 | 22680 | 0.45918190320272745 |  6.902619554185655
  32 |       25 |      1993 |   15011 | 14989 | 22612 |  0.3907957232573413 |  7.361801457388383
  33 |       26 |      1993 |   15011 | 14997 | 22675 |  0.6306996521628211 |  7.752597180645724
  34 |       27 |      1993 |   15011 | 15036 | 22642 |  0.4577881441301496 |  8.383296832808545
  35 |       28 |      1993 |   15011 | 15011 |    -1 |                   0 |  8.841084976938696
  36 |        1 |      9129 |    2197 |  9129 | 13868 |   1.295909946065931 |                  0
  37 |        2 |      9129 |    2197 | 10552 | 15529 |  0.6753696343895893 |  1.295909946065931
  38 |        3 |      9129 |    2197 |  4945 |  7119 |  0.5192806244382107 |   1.97127958045552
  39 |        4 |      9129 |    2197 | 10553 | 13869 |  0.5492219027424707 | 2.4905602048937308
  40 |        5 |      9129 |    2197 | 10555 | 13871 |  0.1333327980665985 | 3.0397821076362015
  41 |        6 |      9129 |    2197 |  3236 |  4876 | 0.21919498732084636 |    3.1731149057028
  42 |        7 |      9129 |    2197 |  6629 |  9236 |  0.5283489402259218 |  3.392309893023646
  43 |        8 |      9129 |    2197 |  4946 |  7120 |  0.3513205953144232 |  3.920658833249568
  44 |        9 |      9129 |    2197 |  4948 |  7247 | 0.14470036124669902 |  4.271979428563991
  45 |       10 |      9129 |    2197 |  5049 | 14167 |  0.4299331691551532 |   4.41667978981069
  46 |       11 |      9129 |    2197 | 10858 |  3208 | 0.18761556648115568 |  4.846612958965843
  47 |       12 |      9129 |    2197 |  2072 |  7540 |  0.3762433038952385 | 5.0342285254469985
  48 |       13 |      9129 |    2197 |  5271 |  3209 | 0.17366433764245764 |  5.410471829342237
  49 |       14 |      9129 |    2197 |  2073 |  3094 | 0.27209464135973077 | 5.5841361669846945
  50 |       15 |      9129 |    2197 |  1995 |  5217 |  0.4728160774964071 |  5.856230808344425
  51 |       16 |      9129 |    2197 |  3521 |  3389 |  0.8295136062216593 |  6.329046885840833
  52 |       17 |      9129 |    2197 |  2191 |  3394 |  1.5878157811361224 |  7.158560492062492
  53 |       18 |      9129 |    2197 |  2194 |  3397 |  1.6538467580211758 |  8.746376273198614
  54 |       19 |      9129 |    2197 |  2195 |  3401 |  1.6675661802817965 |  10.40022303121979
  55 |       20 |      9129 |    2197 |  2197 |    -1 |                   0 | 12.067789211501587
  56 |        1 |      9129 |   15011 |  9129 | 12438 |  0.7933596378424028 |                  0
  57 |        2 |      9129 |   15011 |  7257 | 10014 |  0.6504146879894603 | 0.7933596378424028
  58 |        3 |      9129 |   15011 |  3238 |  4878 |  0.2809159105149851 | 1.4437743258318632
  59 |        4 |      9129 |   15011 |  6634 |  9238 | 0.15979953108717918 | 1.7246902363468481
  60 |        5 |      9129 |   15011 |  6630 |  9239 |    0.26624504390338 | 1.8844897674340273
  61 |        6 |      9129 |   15011 |  6631 | 13509 | 0.18668182909568154 | 2.1507348113374074
  62 |        7 |      9129 |   15011 | 10178 |  9216 | 0.22702865538089603 |  2.337416640433089
  63 |        8 |      9129 |   15011 |  6617 |  9217 |  0.3885460351650076 |  2.564445295813985
  64 |        9 |      9129 |   15011 | 10848 | 14157 | 0.17428650220365932 | 2.9529913309789926
  65 |       10 |      9129 |   15011 |  4581 |  6656 | 0.05087236212698429 |  3.127277833182652
  66 |       11 |      9129 |   15011 |  4175 |  6137 |  0.9306836323636098 | 3.1781501953096365
  67 |       12 |      9129 |   15011 |  4176 |  6138 |  0.1660193699864557 |  4.108833827673246
  68 |       13 |      9129 |   15011 |  4177 | 23602 |   0.260001386597619 |  4.274853197659702
  69 |       14 |      9129 |   15011 | 15736 | 23605 | 0.07761435359444738 |  4.534854584257321
  70 |       15 |      9129 |   15011 | 15737 | 23603 | 0.19693126726250448 | 4.6124689378517685
  71 |       16 |      9129 |   15011 | 15012 | 22643 |  0.1526752074218148 |  4.809400205114273
  72 |       17 |      9129 |   15011 | 15013 | 22644 | 0.42606206978629163 |  4.962075412536088
  73 |       18 |      9129 |   15011 | 15036 | 22642 |  0.4577881441301496 |   5.38813748232238
  74 |       19 |      9129 |   15011 | 15011 |    -1 |                   0 |  5.845925626452529
(74 rows)

6.1.5. Ejercicio: 5 (Capítulo: Peatón)

Ejercicio 5: Muchos peatones que van a diferentes destinos devolviendo costos agregados

 start_vid | end_vid |      agg_cost      
-----------+---------+--------------------
      1993 |    2197 |  7.447629798592339
      1993 |   15011 |  8.841084976938696
      9129 |    2197 | 12.067789211501587
      9129 |   15011 |  5.845925626452529
(4 rows)

6.1.6. Ejercicio: 6 (Capítulo: Peatón)

Ejercicio 6: Muchos peatones van a diferentes destinos resumiendo costos totales por salida

 start_vid |        sum         
-----------+--------------------
      1993 | 16.288714775531034
      9129 | 17.913714837954117
(2 rows)

6.2. Solutions to Enrutamiento de vehículos

6.2.1. Ejercicio: 1 (Capítulo: vehículo)

Ejercicio 1: Ruteo de vehículos - ida

 seq | path_seq | node  | edge  |          cost          |       agg_cost        
-----+----------+-------+-------+------------------------+-----------------------
   1 |        1 |  6646 |  9262 |  0.0006729528871977118 |                     0
   2 |        2 |  6648 |  9257 | 0.00027118941719242527 | 0.0006729528871977118
   3 |        3 |  6645 | 22668 | 0.00012332303109770763 |  0.000944142304390137
   4 |        4 | 15032 | 22669 | 0.00034287128780452947 | 0.0010674653354878446
   5 |        5 | 15031 | 22667 |  6.735413869813915e-05 | 0.0014103366232923742
   6 |        6 | 15029 | 22664 |  0.0001040420107448162 | 0.0014776907619905133
   7 |        7 | 15028 | 22671 |  7.178648898256002e-05 | 0.0015817327727353295
   8 |        8 | 15033 | 22670 |  3.508917211712227e-05 | 0.0016535192617178895
   9 |        9 | 11482 | 18041 | 0.00020277208881354323 | 0.0016886084338350118
  10 |       10 |  4176 |  6137 |  0.0006848974886757874 |  0.001891380522648555
  11 |       11 |  4175 |  6656 |  3.660122948511633e-05 | 0.0025762780113243425
  12 |       12 |  4581 | 23628 | 0.00027912287069337745 |  0.002612879240809459
  13 |       13 | 15754 | 23627 |  0.0004395193953966955 | 0.0028920021115028363
  14 |       14 |  6613 |  9210 | 0.00017367429285494398 |  0.003331521506899532
  15 |       15 |  6612 | 13244 | 0.00012314109793537038 | 0.0035051957997544758
  16 |       16 |  9909 | 15062 | 0.00017240344338673923 | 0.0036283368976898463
  17 |       17 |  2070 | 15935 |  0.0001165127460835332 | 0.0038007403410765857
  18 |       18 |  9434 |  4873 |  0.0009434187067426695 |  0.003917253087160119
  19 |       19 |  3234 |  5821 | 0.00013751818061853136 | 0.0048606717939027886
  20 |       20 |  3984 |  5822 |  0.0006104659279593419 |   0.00499818997452132
  21 |       21 |  4946 |  7121 | 0.00040244455094685716 |  0.005608655902480662
  22 |       22 | 10556 | 13872 |  0.0006360958948803167 |  0.006011100453427519
  23 |       23 |  3983 |  5820 |  9.463852281834329e-05 |  0.006647196348307835
  24 |       24 |  4952 |  7129 | 0.00026737460925477675 | 0.0067418348711261785
  25 |       25 |  4950 |  7126 |  4.765553483265739e-05 |  0.007009209480380955
  26 |       26 |  6885 |  9539 |  0.0003667764912753431 |  0.007056865015213612
  27 |       27 |  6887 |  9542 |  0.0001804451440216899 |  0.007423641506488956
  28 |       28 |  1993 |    -1 |                      0 |  0.007604086650510646
(28 rows)

6.2.2. Ejercicio: 2 (Capítulo: Vehículo)

Ejercicio 2: Ruteo de vehículos - regreso

 seq | path_seq | node  | edge  |          cost          |       agg_cost        
-----+----------+-------+-------+------------------------+-----------------------
   1 |        1 |  1993 |  9542 |  0.0001804451440216899 |                     0
   2 |        2 |  6887 |  9539 |  0.0003667764912753431 | 0.0001804451440216899
   3 |        3 |  6885 |  7126 |  4.765553483265739e-05 | 0.0005472216352970329
   4 |        4 |  4950 |  7129 | 0.00026737460925477675 | 0.0005948771701296903
   5 |        5 |  4952 |  5820 |  9.463852281834329e-05 | 0.0008622517793844671
   6 |        6 |  3983 | 13872 |  0.0006360958948803167 | 0.0009568903022028104
   7 |        7 | 10556 |  7121 | 0.00040244455094685716 |  0.001592986197083127
   8 |        8 |  4946 |  5822 |  0.0006104659279593419 |  0.001995430748029984
   9 |        9 |  3984 | 13870 |  0.0004632938151908683 |  0.002605896675989326
  10 |       10 | 10554 |  7122 |  0.0008796105936538006 | 0.0030691904911801945
  11 |       11 |  4947 |  5824 | 0.00019210447678387105 |  0.003948801084833995
  12 |       12 |  3985 |  9237 |  0.0001550584728403412 |  0.004140905561617866
  13 |       13 |  6630 |  9239 | 0.00019673294080977473 |  0.004295964034458207
  14 |       14 |  6631 | 13509 | 0.00013711312847659846 |  0.004492696975267982
  15 |       15 | 10178 |  9216 |  0.0001646876691578203 | 0.0046298101037445805
  16 |       16 |  6617 | 14158 |  6.012021290498655e-05 |  0.004794497772902401
  17 |       17 | 10849 | 14156 | 0.00033172715728052376 |  0.004854617985807387
  18 |       18 | 10847 |  6657 |  0.0001766296973907933 | 0.0051863451430879115
  19 |       19 |  4582 | 15680 | 0.00012464132540815551 |  0.005362974840478705
  20 |       20 |  6618 |  4968 |  0.0003140189447241776 | 0.0054876161658868605
  21 |       21 |  3309 |  5632 | 0.00018419789013868632 |  0.005801635110611038
  22 |       22 |  3818 |  9256 | 3.0591828979174773e-05 |  0.005985833000749724
  23 |       23 |  6645 |  9257 | 0.00027118941719242527 | 0.0060164248297288996
  24 |       24 |  6648 |  9262 |  0.0006729528871977118 |  0.006287614246921325
  25 |       25 |  6646 |    -1 |                      0 |  0.006960567134119037
(25 rows)

6.2.3. Ejercicio: 3 (Capítulo: Vehículo)

Ejercicio 3: Ruteo de vehículos cuando el tiempo es dinero

 seq | path_seq | node  | edge  |         cost         |      agg_cost       
-----+----------+-------+-------+----------------------+---------------------
   1 |        1 |  1993 |  9542 |  0.03691610955663628 |                   0
   2 |        2 |  6887 |  9539 |  0.07495606620382238 | 0.03691610955663628
   3 |        3 |  6885 |  7126 | 0.009530918627867053 | 0.11187217576045866
   4 |        4 |  4950 |  7129 |  0.05849778408537126 | 0.12140309438832571
   5 |        5 |  4952 |  5820 | 0.020966377931768664 | 0.17990087847369696
   6 |        6 |  3983 | 13872 |    0.134486304115897 | 0.20086725640546563
   7 |        7 | 10556 |  7121 |  0.08585539166664587 |  0.3353535605213626
   8 |        8 |  4946 |  5822 |  0.13333235741928365 | 0.42120895218800847
   9 |        9 |  3984 |  5821 | 0.026107231719643187 |  0.5545413096072921
  10 |       10 |  3234 |  4872 | 0.039358730038486146 |  0.5806485413269353
  11 |       11 |  6626 |  9567 |  0.08875688272178962 |  0.6200072713654214
  12 |       12 |  6910 |  9571 |   0.1414420617180735 |   0.708764154087211
  13 |       13 |  6911 |  4966 |  0.07680621274723812 |  0.8502062158052845
  14 |       14 |  3308 |  4879 | 0.038659570128913585 |  0.9270124285525226
  15 |       15 |  3239 |  4967 |  0.18344569354182863 |  0.9656719986814363
  16 |       16 |  3309 |  5632 |  0.04861717686157053 |  1.1491176922232649
  17 |       17 |  3818 |  9256 | 0.008064679635219398 |  1.1977348690848355
  18 |       18 |  6645 |  9257 |  0.05979937989303878 |   1.205799548720055
  19 |       19 |  6648 |  9262 |  0.13144190510340611 |  1.2655989286130938
  20 |       20 |  6646 |    -1 |                    0 |     1.3970408337165
(20 rows)

6.2.4. Ejercicio: 4 (Capítulo: Vehículo)

Ejercicio 4: Ruteo de vehículos sin penalización

ALTER TABLE
UPDATE 36
 seq | path_seq | node  | edge  |        cost         |      agg_cost      
-----+----------+-------+-------+---------------------+--------------------
   1 |        1 |  6646 |  9262 |    4.73190858372262 |                  0
   2 |        2 |  6648 |  9257 |   2.152777676149396 |   4.73190858372262
   3 |        3 |  6645 | 22668 |  0.9380904698808861 |  6.884686259872016
   4 |        4 | 15032 | 22669 |  2.2718648639202517 |  7.822776729752902
   5 |        5 | 15031 | 22667 |  0.5082107881118311 | 10.094641593673153
   6 |        6 | 15029 | 22664 |  0.7850444418148111 | 10.602852381784984
   7 |        7 | 15028 | 22671 | 0.49434286882616607 | 11.387896823599796
   8 |        8 | 15033 | 22670 | 0.26696588409519467 | 11.882239692425962
   9 |        9 | 11482 | 18041 |  1.5430144648638813 | 12.149205576521156
  10 |       10 |  4176 |  6137 |  5.2267192793540325 | 13.692220041385038
  11 |       11 |  4175 |  6656 | 0.28569918570514374 |  18.91893932073907
  12 |       12 |  4581 | 23628 |   2.153681313407521 | 19.204638506444216
  13 |       13 | 15754 | 23627 |   3.021741336601282 | 21.358319819851737
  14 |       14 |  6613 |  9210 |  1.1811825274317242 | 24.380061156453017
  15 |       15 |  6612 | 13244 |  0.8295222480843331 |  25.56124368388474
  16 |       16 |  9909 | 15062 |  1.3265102710422243 | 26.390765931969074
  17 |       17 |  2070 | 15935 |  0.5611608144559347 |   27.7172762030113
  18 |       18 |  9434 |  4873 |   5.544801706878828 | 28.278437017467233
  19 |       19 |  3234 |  3206 |    3.47397158138159 |  33.82323872434606
  20 |       20 |  2071 | 14164 |  1.2857352790499113 |  37.29721030572765
  21 |       21 | 10855 |  7123 |  0.3096904552744117 |  38.58294558477756
  22 |       22 |  4948 |  7247 |  0.6771976906345515 | 38.892636040051975
  23 |       23 |  5049 | 14167 |   2.012087231646117 | 39.569833730686526
  24 |       24 | 10858 |  3208 |  0.8780408511318085 | 41.581920962332646
  25 |       25 |  2072 |  7540 |  1.7608186622297164 |  42.45996181346445
  26 |       26 |  5271 |  3209 |  0.8127491001667018 |  44.22078047569417
  27 |       27 |  2073 |  3094 |    1.27340292156354 |  45.03352957586087
  28 |       28 |  1995 |  3095 |  6.9417769567639525 | 46.306932497424405
  29 |       29 |  1993 |    -1 |                   0 |  53.24870945418836
(29 rows)

6.2.5. Ejercicio: 5 (Capítulo: Vehículo)

Ejercicio 5: Ruteo de vehículos con penalización

 seq | path_seq | node  | edge  |         cost         |      agg_cost      
-----+----------+-------+-------+----------------------+--------------------
   1 |        1 |  6646 |  9259 |    4.562824647626956 |                  0
   2 |        2 |  6649 |  9263 |   2.1797689059943934 |  4.562824647626956
   3 |        3 |  6647 |  4971 |   10.104455517121892 |  6.742593553621349
   4 |        4 |  3312 |  9926 |   0.6620707732914729 |  16.84704907074324
   5 |        5 |  7195 |  9925 |   2.3930993578220168 |  17.50911984403471
   6 |        6 |  7194 |  9227 |   0.4414393359723376 | 19.902219201856727
   7 |        7 |  6623 |  9223 |   1.5803588408297848 | 20.343658537829064
   8 |        8 |  6621 |  4580 |  0.27324632366968254 |  21.92401737865885
   9 |        9 |  2995 |  6139 |   0.9285491696541688 |  22.19726370232853
  10 |       10 |  4178 |  2767 |    3.108017711398723 |   23.1258128719827
  11 |       11 |  1787 |  2079 |    3.800641424190119 | 26.233830583381422
  12 |       12 |  1364 |  6990 |   0.4135317204612034 |  30.03447200757154
  13 |       13 |  4853 | 12477 |   0.8283301814280698 | 30.448003728032745
  14 |       14 |  9175 | 12476 |   0.3203839116639407 | 31.276333909460813
  15 |       15 |  9174 |  3481 |   1.1316355322615805 | 31.596717821124756
  16 |       16 |  2249 |  3809 |   1.3365466767813203 |  32.72835335338634
  17 |       17 |  2481 |  2765 |    1.083496320918464 |  34.06490003016766
  18 |       18 |  1786 | 14992 |   1.8583795125569047 |  35.14839635108612
  19 |       19 |  1793 | 10095 |   1.5008613652548752 |  37.00677586364303
  20 |       20 |  7319 | 12408 |   1.4575845880862743 | 38.507637228897906
  21 |       21 |  9100 |  2764 |  0.17621184246907487 |  39.96522181698418
  22 |       22 |  1785 |  3167 |   2.1726755845647636 | 40.141433659453256
  23 |       23 |  2044 |  9877 |   0.6741851243991747 |  42.31410924401802
  24 |       24 |  7153 |  5012 |   1.0795291943661662 |  42.98829436841719
  25 |       25 |  3346 | 14032 |  0.10489123274588835 |  44.06782356278336
  26 |       26 | 10715 | 12406 |   1.7921476798204787 | 44.172714795529245
  27 |       27 |  9098 |  2801 |   0.2671991860064837 | 45.964862475349726
  28 |       28 |  1808 | 12407 |    0.389817318285568 |  46.23206166135621
  29 |       29 |  9099 |  3500 |   0.7678072813883624 |  46.62187897964178
  30 |       30 |  2263 |  3507 |  0.30243960294974626 |  47.38968626103014
  31 |       31 |  2271 | 14091 |   0.6827013893558918 |  47.69212586397989
  32 |       32 | 10774 | 14090 | 0.038797932893193714 |  48.37482725333578
  33 |       33 | 10773 |  2802 |  0.44121507075984523 |  48.41362518622898
  34 |       34 |  1809 |  5622 |    3.521186036279464 |  48.85484025698882
  35 |       35 |  3809 |  2636 |   0.6439288068535786 |  52.37602629326829
  36 |       36 |  1693 | 23987 |  0.37475618316504916 |  53.01995510012187
  37 |       37 | 16019 | 17636 |   1.7882257348399646 |  53.39471128328692
  38 |       38 |  2090 | 20268 |    1.033391568698944 |  55.18293701812688
  39 |       39 | 13225 | 16981 |  0.14610314995872714 | 56.216328586825824
  40 |       40 |  2262 | 15403 |   1.6998149780677272 |  56.36243173678455
  41 |       41 |  3811 | 17802 |   1.1967351292407056 |  58.06224671485228
  42 |       42 | 11295 | 16443 |    0.958265557258808 | 59.258981844092986
  43 |       43 |  1792 | 12692 |   0.5645234384169898 |  60.21724740135179
  44 |       44 |  9385 |  7542 |   1.7355962247235905 |  60.78177083976878
  45 |       45 |  5272 |  3161 |     2.17093164155467 | 62.517367064492376
  46 |       46 |  2040 |  4973 |   0.7360484951194465 |  64.68829870604705
  47 |       47 |  3314 |  2832 |   0.7971126547302078 |   65.4243472011665
  48 |       48 |  1831 |  7579 |   1.1980986164429523 |  66.22145985589671
  49 |       49 |  5309 |  7018 |  0.24604609796671933 |  67.41955847233966
  50 |       50 |  4872 |  2822 |   2.0606874419154746 |  67.66560457030639
  51 |       51 |  1825 |  2769 |    1.313880540356831 |  69.72629201222186
  52 |       52 |  1788 | 14420 |    2.729000052959075 |   71.0401725525787
  53 |       53 | 11106 |  2826 |  0.22444314962244186 |  73.76917260553778
  54 |       54 |  1827 | 13813 |   0.6514836992135348 |  73.99361575516022
  55 |       55 | 10496 | 15684 |   1.1691545683769122 |  74.64509945437375
  56 |       56 |  6636 | 15682 |   0.1768657515584622 |  75.81425402275066
  57 |       57 |  6632 | 15306 |   0.6508603738743078 |  75.99111977430913
  58 |       58 |  3265 | 15059 |    2.434005678570533 |  76.64198014818344
  59 |       59 |  2054 | 15683 |  0.23379156600989814 |  79.07598582675396
  60 |       60 |  6635 | 15303 |    2.085142635585158 |  79.30977739276386
  61 |       61 |  3237 | 15657 |   0.5451331919427183 |  81.39492002834902
  62 |       62 |  6631 | 15001 |  0.42283214221778714 |  81.94005322029174
  63 |       63 |  1823 |  3205 |     0.53007179892001 |  82.36288536250953
  64 |       64 |  2070 | 15935 |   0.1683482443367804 |  82.89295716142954
  65 |       65 |  9434 |  4873 |   1.6634405120636484 |  83.06130540576632
  66 |       66 |  3234 |  3206 |    1.042191474414477 |  84.72474591782996
  67 |       67 |  2071 | 14164 |  0.38572058371497336 |  85.76693739224444
  68 |       68 | 10855 |  7123 |  0.09290713658232351 |  86.15265797595941
  69 |       69 |  4948 |  7247 |  0.20315930719036543 |  86.24556511254174
  70 |       70 |  5049 | 14167 |   0.6036261694938351 |   86.4487244197321
  71 |       71 | 10858 |  3208 |  0.26341225533954254 |  87.05235058922594
  72 |       72 |  2072 |  7540 |   0.5282455986689149 |  87.31576284456548
  73 |       73 |  5271 |  3209 |   0.2438247300500105 |   87.8440084432344
  74 |       74 |  2073 |  3094 |    0.382020876469062 |  88.08783317328441
  75 |       75 |  1995 |  5217 |   0.6638337728049555 |  88.46985404975347
  76 |       76 |  3521 |  3389 |   1.1646371031352094 |  89.13368782255841
  77 |       77 |  2191 | 15089 |   47.723575728434284 |  90.29832492569362
  78 |       78 |  2190 |  3091 |   46.281901986594946 |  138.0219006541279
  79 |       79 |  1993 |    -1 |                    0 | 184.30380264072284
(79 rows)

6.3. Solutions to Función SQL

6.3.1. Ejercicio: 1 (Capítulo: SQL)

Ejercicio 1: Creación de una vista para el ruteo

CREATE VIEW
 count 
-------
 24414
(1 row)

 count 
-------
 14437
(1 row)

6.3.2. Ejercicio: 2 (Capítulo: SQL)

Ejercicio 2: Limitar la red viaria dentro de un área

CREATE VIEW
 count 
-------
   921
(1 row)

6.3.3. Ejercicio: 3 (Capítulo: SQL)

Ejercicio 3: Creación de una vista materializada para ruteo de los peatones

SELECT 23763
 count 
-------
 23763
(1 row)

6.3.4. Ejercicio: 4 (Capítulo: SQL)

Ejercicio 4: Probar las vistas para el ruteo

 seq |  id   |      seconds       
-----+-------+--------------------
   1 |  9259 |  4.562824647626956
   2 |  9263 | 2.1797689059943934
   3 |  4971 |  2.020891103424378
   4 |  9926 |  2.206902577638243
   5 |  9925 |  7.976997859406723
   6 |  9227 | 1.4714644532411254
   7 |  9223 |   5.26786280276595
   8 |  4580 | 0.9108210788989419
   9 |  6139 | 3.0951638988472294
  10 |  2767 | 10.360059037995743
  11 | 12409 | 1.0678201185800953
  12 |  9923 |  2.929107217373415
  13 | 13066 | 0.8554599855783996
  14 | 13064 |  7.723204031905286
  15 |  6146 |  5.635262444476295
  16 |  5626 |  2.455103047366677
  17 |  2770 | 2.1401759333842985
  18 | 14420 |  9.096666843196918
  19 |  2826 | 0.7481438320748062
  20 | 13813 | 2.1716123307117825
  21 | 15684 |  3.897181894589708
  22 | 15682 |  0.589552505194874
  23 | 15306 | 2.1695345795810264
  24 | 15059 |  8.113352261901777
  25 | 15683 | 0.7793052200329939
  26 | 15303 |  6.950475451950527
  27 | 15657 |  1.817110639809061
  28 | 15001 | 1.4094404740592905
  29 |  3205 | 1.7669059964000335
  30 | 15935 | 0.5611608144559347
  31 |  4873 |  5.544801706878828
  32 |  3206 |   3.47397158138159
  33 | 14164 | 1.2857352790499113
  34 |  7123 | 0.3096904552744117
  35 |  7247 | 0.6771976906345515
  36 | 14167 |  2.012087231646117
  37 |  3208 | 0.8780408511318085
  38 |  7540 | 1.7608186622297164
  39 |  3209 | 0.8127491001667018
  40 |  3094 |   1.27340292156354
  41 |  5217 |  2.212779242683185
  42 |  3389 |  3.882123677117365
  43 | 15089 |  9.544715145686856
  44 |  3091 |  9.256380397318988
  45 |    -1 |                  0
(45 rows)

 seq | id | seconds 
-----+----+---------
(0 rows)

 seq |  id   |      seconds       
-----+-------+--------------------
   1 |  9262 |  32.86047627585153
   2 |  9257 | 14.949844973259696
   3 |  9256 |   1.61293592704388
   4 |  5632 |  9.723435372314105
   5 |  4967 |   55.0337080625486
   6 |  4879 | 11.597871038674077
   7 |  4966 | 23.041863824171436
   8 |  9571 |  35.36051542951837
   9 |  9567 | 17.751376544357925
  10 |  9231 | 12.210237164411874
  11 |  4874 |  20.33474622449208
  12 | 14164 |  10.71446065874926
  13 |  7123 |  2.580753793953431
  14 |  7247 | 5.6433140886212625
  15 | 14167 | 16.767393597050976
  16 |  3208 |  7.317007092765071
  17 |  3207 | 13.682173692196534
  18 | 12748 |  6.808080772907077
  19 | 13882 | 16.389890801292673
  20 |  4887 |  25.07896076384853
  21 |    -1 |                  0
(21 rows)

6.3.5. Ejercicio: 5 (Capítulo: SQL)

Ejercicio 5: Obtener información adicional

 seq |  id   |      seconds       |                name                 |      length_m      
-----+-------+--------------------+-------------------------------------+--------------------
   1 |  9259 |  4.562824647626956 |                                     | 63.372564550374385
   2 |  9263 | 2.1797689059943934 |                                     |  30.27456813881102
   3 |  4971 |  2.020891103424378 | Juan A. Bibiloni                    | 22.454345593604202
   4 |  9926 |  2.206902577638243 | Avenida Presidente Figueroa Alcorta |  36.78170962730405
   5 |  9925 |  7.976997859406723 | Avenida Presidente Figueroa Alcorta | 132.94996432344539
   6 |  9227 | 1.4714644532411254 | Avenida Presidente Figueroa Alcorta | 24.524407554018758
   7 |  9223 |   5.26786280276595 | Avenida Presidente Figueroa Alcorta |  87.79771337943251
   8 |  4580 | 0.9108210788989419 | Avenida Presidente Figueroa Alcorta | 15.180351314982367
   9 |  6139 | 3.0951638988472294 | Avenida Presidente Figueroa Alcorta | 51.586064980787164
  10 |  2767 | 10.360059037995743 | Avenida Presidente Figueroa Alcorta |  172.6676506332624
  11 | 12409 | 1.0678201185800953 | Tagle                               | 11.864667984223281
  12 |  9923 |  2.929107217373415 | Tagle                               |   32.5456357485935
  13 | 13066 | 0.8554599855783996 | Tagle                               |  9.505110950871106
  14 | 13064 |  7.723204031905286 | Tagle                               |  85.81337813228096
  15 |  6146 |  5.635262444476295 | Tagle                               |  62.61402716084772
  16 |  5626 |  2.455103047366677 | Tagle                               |  27.27892274851863
  17 |  2770 | 2.1401759333842985 | Tagle                               |  23.77973259315887
  18 | 14420 |  9.096666843196918 | Avenida del Libertador              | 176.87963306216227
  19 |  2826 | 0.7481438320748062 | Avenida del Libertador              |  14.54724117923234
  20 | 13813 | 2.1716123307117825 | Avenida del Libertador              | 42.225795319395765
  21 | 15684 |  3.897181894589708 | Avenida del Libertador              |  75.77853683924431
  22 | 15682 |  0.589552505194874 | Avenida del Libertador              | 11.463520934344771
  23 | 15306 | 2.1695345795810264 | Avenida del Libertador              |   42.1853946029644
  24 | 15059 |  8.113352261901777 | Avenida del Libertador              | 157.75962731475676
  25 | 15683 | 0.7793052200329939 | Avenida del Libertador              |   15.1531570561971
  26 | 15303 |  6.950475451950527 | Avenida del Libertador              |  135.1481337879269
  27 | 15657 |  1.817110639809061 | Avenida del Libertador              |  35.33270688517619
  28 | 15001 | 1.4094404740592905 | Avenida del Libertador              | 27.405786995597314
  29 |  3205 | 1.7669059964000335 | Avenida del Libertador              | 34.356505485556205
  30 | 15935 | 0.5611608144559347 | Avenida del Libertador              | 10.911460281087617
  31 |  4873 |  5.544801706878828 | Avenida Alvear                      |  92.41336178131381
  32 |  3206 |   3.47397158138159 | Avenida Alvear                      |  57.89952635635984
  33 | 14164 | 1.2857352790499113 | Avenida Alvear                      |  21.42892131749852
  34 |  7123 | 0.3096904552744117 | Avenida Alvear                      |  5.161507587906862
  35 |  7247 | 0.6771976906345515 | Avenida Alvear                      | 11.286628177242525
  36 | 14167 |  2.012087231646117 | Avenida Alvear                      |  33.53478719410195
  37 |  3208 | 0.8780408511318085 | Avenida Alvear                      | 14.634014185530143
  38 |  7540 | 1.7608186622297164 | Avenida Alvear                      | 29.346977703828607
  39 |  3209 | 0.8127491001667018 | Avenida Alvear                      | 13.545818336111697
  40 |  3094 |   1.27340292156354 | Avenida Alvear                      | 21.223382026059003
  41 |  5217 |  2.212779242683185 | Avenida Alvear                      |  36.87965404471975
  42 |  3389 |  3.882123677117365 | Avenida Alvear                      |  64.70206128528942
  43 | 15089 |  9.544715145686856 | Ayacucho                            | 106.05239050763174
  44 |  3091 |  9.256380397318988 | Avenida Presidente Quintana         |  102.8486710813221
  45 |    -1 |                  0 |                                     |                   
(45 rows)

6.3.6. Ejercicio: 6 (Capítulo: SQL)

Ejercicio 6: Geometría de la ruta (legible para humanos)

 seq |  id   |      seconds       |                                                                                                                       route_readable                                                                                                                       
-----+-------+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |  9259 |  4.562824647626956 | LINESTRING(-58.3927465 -34.5827453,-58.3926854 -34.5827222,-58.3926425 -34.5827066,-58.3925915 -34.5827132,-58.3921304 -34.5829209)
   2 |  9263 | 2.1797689059943934 | LINESTRING(-58.3930552 -34.5828417,-58.3927465 -34.5827453)
   3 |  4971 |  2.020891103424378 | LINESTRING(-58.3930552 -34.5828417,-58.3930944 -34.5828972,-58.3931786 -34.5830165)
   4 |  9926 |  2.206902577638243 | LINESTRING(-58.3931786 -34.5830165,-58.3935264 -34.5828516)
   5 |  9925 |  7.976997859406723 | LINESTRING(-58.3935264 -34.5828516,-58.3947735 -34.5822413)
   6 |  9227 | 1.4714644532411254 | LINESTRING(-58.3947735 -34.5822413,-58.395007 -34.5821337)
   7 |  9223 |   5.26786280276595 | LINESTRING(-58.395007 -34.5821337,-58.3958426 -34.581748)
   8 |  4580 | 0.9108210788989419 | LINESTRING(-58.3958426 -34.581748,-58.395988 -34.5816827)
   9 |  6139 | 3.0951638988472294 | LINESTRING(-58.395988 -34.5816827,-58.3964785 -34.5814554)
  10 |  2767 | 10.360059037995743 | LINESTRING(-58.3964785 -34.5814554,-58.3977689 -34.5808646,-58.3979404 -34.5807861,-58.3981269 -34.5807045)
  11 | 12409 | 1.0678201185800953 | LINESTRING(-58.3981269 -34.5807045,-58.3981409 -34.5807456,-58.3981541 -34.5807741,-58.3981699 -34.5808052)
  12 |  9923 |  2.929107217373415 | LINESTRING(-58.3981699 -34.5808052,-58.3982536 -34.5809237,-58.3983457 -34.58106)
  13 | 13066 | 0.8554599855783996 | LINESTRING(-58.3983457 -34.58106,-58.3983926 -34.5811364)
  14 | 13064 |  7.723204031905286 | LINESTRING(-58.3983926 -34.5811364,-58.3988159 -34.5818262)
  15 |  6146 |  5.635262444476295 | LINESTRING(-58.3988159 -34.5818262,-58.3991248 -34.5823295)
  16 |  5626 |  2.455103047366677 | LINESTRING(-58.3991248 -34.5823295,-58.399248 -34.5825533)
  17 |  2770 | 2.1401759333842985 | LINESTRING(-58.399248 -34.5825533,-58.3993344 -34.5827554)
  18 | 14420 |  9.096666843196918 | LINESTRING(-58.3993344 -34.5827554,-58.3992235 -34.5827828,-58.3978301 -34.5829964,-58.3974425 -34.5830593)
  19 |  2826 | 0.7481438320748062 | LINESTRING(-58.3974425 -34.5830593,-58.3972869 -34.5830845)
  20 | 13813 | 2.1716123307117825 | LINESTRING(-58.3972869 -34.5830845,-58.3968412 -34.5831794)
  21 | 15684 |  3.897181894589708 | LINESTRING(-58.3968412 -34.5831794,-58.396548 -34.5832419,-58.396237 -34.5833149,-58.3960486 -34.5833701)
  22 | 15682 |  0.589552505194874 | LINESTRING(-58.3960486 -34.5833701,-58.3959318 -34.5834068)
  23 | 15306 | 2.1695345795810264 | LINESTRING(-58.3959318 -34.5834068,-58.395502 -34.5835419)
  24 | 15059 |  8.113352261901777 | LINESTRING(-58.395502 -34.5835419,-58.3938967 -34.5840515)
  25 | 15683 | 0.7793052200329939 | LINESTRING(-58.3938967 -34.5840515,-58.3937423 -34.5841)
  26 | 15303 |  6.950475451950527 | LINESTRING(-58.3937423 -34.5841,-58.3930659 -34.5843172,-58.3926644 -34.5844472,-58.3925197 -34.5844931,-58.3923706 -34.584544)
  27 | 15657 |  1.817110639809061 | LINESTRING(-58.3923706 -34.584544,-58.3920077 -34.5846506)
  28 | 15001 | 1.4094404740592905 | LINESTRING(-58.3920077 -34.5846506,-58.391729 -34.5847395)
  29 |  3205 | 1.7669059964000335 | LINESTRING(-58.391729 -34.5847395,-58.3913795 -34.5848507)
  30 | 15935 | 0.5611608144559347 | LINESTRING(-58.3913795 -34.5848507,-58.3912684 -34.5848858)
  31 |  4873 |  5.544801706878828 | LINESTRING(-58.3912684 -34.5848858,-58.3911601 -34.5849577,-58.3910265 -34.5850266,-58.3908826 -34.5851028,-58.3907893 -34.5851572,-58.3906961 -34.5852183,-58.390627 -34.5852654,-58.3905694 -34.5853111,-58.3905246 -34.5853546,-58.3904834 -34.5853999)
  32 |  3206 |   3.47397158138159 | LINESTRING(-58.3904834 -34.5853999,-58.3904458 -34.5854479,-58.390416 -34.5854958,-58.3903907 -34.5855423,-58.3903692 -34.5856043,-58.3903523 -34.5856663,-58.3903324 -34.5857349,-58.3902883 -34.585892)
  33 | 14164 | 1.2857352790499113 | LINESTRING(-58.3902883 -34.585892,-58.3903156 -34.5860035,-58.39034 -34.5860803)
  34 |  7123 | 0.3096904552744117 | LINESTRING(-58.39034 -34.5860803,-58.3903543 -34.5861253)
  35 |  7247 | 0.6771976906345515 | LINESTRING(-58.3903543 -34.5861253,-58.3903947 -34.5862214)
  36 | 14167 |  2.012087231646117 | LINESTRING(-58.3903947 -34.5862214,-58.3904912 -34.5864442,-58.3905081 -34.5864974,-58.3905101 -34.5865079)
  37 |  3208 | 0.8780408511318085 | LINESTRING(-58.3905101 -34.5865079,-58.3905154 -34.5865367,-58.3905184 -34.5865754,-58.3905147 -34.5866117,-58.3905092 -34.5866389)
  38 |  7540 | 1.7608186622297164 | LINESTRING(-58.3905092 -34.5866389,-58.3904996 -34.5866685,-58.3904835 -34.586706,-58.3904651 -34.586735,-58.3904328 -34.5867767,-58.3903983 -34.5868184,-58.3903528 -34.5868668)
  39 |  3209 | 0.8127491001667018 | LINESTRING(-58.3903528 -34.5868668,-58.3902421 -34.5869476)
  40 |  3094 |   1.27340292156354 | LINESTRING(-58.3902421 -34.5869476,-58.3900602 -34.5870658)
  41 |  5217 |  2.212779242683185 | LINESTRING(-58.3900602 -34.5870658,-58.3897471 -34.5872743)
  42 |  3389 |  3.882123677117365 | LINESTRING(-58.3897471 -34.5872743,-58.3891977 -34.58764)
  43 | 15089 |  9.544715145686856 | LINESTRING(-58.3891977 -34.58764,-58.3899926 -34.5883341)
  44 |  3091 |  9.256380397318988 | LINESTRING(-58.3899926 -34.5883341,-58.3907953 -34.5876869)
  45 |    -1 |                  0 | 
(45 rows)

6.3.7. Ejercicio: 7 (Capítulo: SQL)

Ejercicio 7: Geometría de ruta (formato binario)

 seq |  id   |      seconds       |                                                                                                                                                                         route_geom                                                                                                                                                                         
-----+-------+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |  9259 |  4.562824647626956 | 0102000020E6100000050000002A8F6E8445324DC0E8B2E265974A41C0EF4EE38343324DC09BD31BA4964A41C08542041C42324DC0E9143F21964A41C00398327040324DC048799C58964A41C03AE2355431324DC0D3D3EC269D4A41C0
   2 |  9263 | 2.1797689059943934 | 0102000020E610000002000000E9C2FEA14F324DC05E1F8C8E9A4A41C02A8F6E8445324DC0E8B2E265974A41C0
   3 |  4971 |  2.020891103424378 | 0102000020E610000003000000E9C2FEA14F324DC05E1F8C8E9A4A41C0D11ED4EA50324DC009771D609C4A41C0583E26AD53324DC0A243E048A04A41C0
   4 |  9926 |  2.206902577638243 | 0102000020E610000002000000583E26AD53324DC0A243E048A04A41C06A0EB5125F324DC0EC3598E19A4A41C0
   5 |  9925 |  7.976997859406723 | 0102000020E6100000020000006A0EB5125F324DC0EC3598E19A4A41C0EAE923F087324DC0B5F006E2864A41C0
   6 |  9227 | 1.4714644532411254 | 0102000020E610000002000000EAE923F087324DC0B5F006E2864A41C07558E1968F324DC022B3695B834A41C0
   7 |  9223 |   5.26786280276595 | 0102000020E6100000020000007558E1968F324DC022B3695B834A41C08BAE66F8AA324DC0B741EDB7764A41C0
   8 |  4580 | 0.9108210788989419 | 0102000020E6100000020000008BAE66F8AA324DC0B741EDB7764A41C0E2CD1ABCAF324DC012932694744A41C0
   9 |  6139 | 3.0951638988472294 | 0102000020E610000002000000E2CD1ABCAF324DC012932694744A41C09888B7CEBF324DC0938A6B216D4A41C0
  10 |  2767 | 10.360059037995743 | 0102000020E6100000040000009888B7CEBF324DC0938A6B216D4A41C0D66E6017EA324DC0BA336EC5594A41C0EBE005B6EF324DC056BCEC32574A41C035947FD2F5324DC0ED116A86544A41C0
  11 | 12409 | 1.0678201185800953 | 0102000020E61000000400000035947FD2F5324DC0ED116A86544A41C09A59F047F6324DC0E0A52FDF554A41C05822ABB6F6324DC092EE42CE564A41C03460353BF7324DC062AC25D3574A41C0
  12 |  9923 |  2.929107217373415 | 0102000020E6100000030000003460353BF7324DC062AC25D3574A41C0D3C155F9F9324DC0547C32B55B4A41C04900EDFDFC324DC0C381902C604A41C0
  13 | 13066 | 0.8554599855783996 | 0102000020E6100000020000004900EDFDFC324DC0C381902C604A41C0F5FB5987FE324DC0F14174AD624A41C0
  14 | 13064 |  7.723204031905286 | 0102000020E610000002000000F5FB5987FE324DC0F14174AD624A41C0FACF3F660C334DC05D7AEA47794A41C0
  15 |  6146 |  5.635262444476295 | 0102000020E610000002000000FACF3F660C334DC05D7AEA47794A41C0E3827D8516334DC07EFFE6C5894A41C0
  16 |  5626 |  2.455103047366677 | 0102000020E610000002000000E3827D8516334DC07EFFE6C5894A41C0287FF78E1A334DC0A4D6451B914A41C0
  17 |  2770 | 2.1401759333842985 | 0102000020E610000002000000287FF78E1A334DC0A4D6451B914A41C07A15BE631D334DC0A1489CBA974A41C0
  18 | 14420 |  9.096666843196918 | 0102000020E6100000040000007A15BE631D334DC0A1489CBA974A41C0B72572C119334DC0ED5575A0984A41C0A56EC218EC324DC0C6D743A09F4A41C02EC55565DF324DC07890E8AFA14A41C0
  19 |  2826 | 0.7481438320748062 | 0102000020E6100000020000002EC55565DF324DC07890E8AFA14A41C08A50114CDA324DC0FA264D83A24A41C0
  20 | 13813 | 2.1716123307117825 | 0102000020E6100000020000008A50114CDA324DC0FA264D83A24A41C04ADA43B1CB324DC0B759619FA54A41C0
  21 | 15684 |  3.897181894589708 | 0102000020E6100000040000004ADA43B1CB324DC0B759619FA54A41C0A9A5B915C2324DC01514ABABA74A41C08A3BDEE4B7324DC07F620910AA4A41C0345074B8B1324DC06D7B16DFAB4A41C0
  22 | 15682 |  0.589552505194874 | 0102000020E610000002000000345074B8B1324DC06D7B16DFAB4A41C02439AAE4AD324DC0CB21F312AD4A41C0
  23 | 15306 | 2.1695345795810264 | 0102000020E6100000020000002439AAE4AD324DC0CB21F312AD4A41C055C03DCF9F324DC0402C4080B14A41C0
  24 | 15059 |  8.113352261901777 | 0102000020E61000000200000055C03DCF9F324DC0402C4080B14A41C04C4002356B324DC002D71533C24A41C0
  25 | 15683 | 0.7793052200329939 | 0102000020E6100000020000004C4002356B324DC002D71533C24A41C0A2C6CE2566324DC0FBCBEEC9C34A41C0
  26 | 15303 |  6.950475451950527 | 0102000020E610000005000000A2C6CE2566324DC0FBCBEEC9C34A41C01FD6C0FB4F324DC0C23EF0E7CA4A41C0D826BAD342324DC0901E752ACF4A41C09344E5153E324DC06C9E7EABD04A41C0B974273339324DC059897956D24A41C0
  27 | 15657 |  1.817110639809061 | 0102000020E610000002000000B974273339324DC059897956D24A41C0DDA3ED4E2D324DC01C4BB3D4D54A41C0
  28 | 15001 | 1.4094404740592905 | 0102000020E610000002000000DDA3ED4E2D324DC01C4BB3D4D54A41C088F2052D24324DC0F69672BED84A41C0
  29 |  3205 | 1.7669059964000335 | 0102000020E61000000200000088F2052D24324DC0F69672BED84A41C0946934B918324DC077C54263DC4A41C0
  30 | 15935 | 0.5611608144559347 | 0102000020E610000002000000946934B918324DC077C54263DC4A41C0A8FA3A1515324DC08972B389DD4A41C0
  31 |  4873 |  5.544801706878828 | 0102000020E61000000A000000A8FA3A1515324DC08972B389DD4A41C00380BE8811324DC08D85D7E4DF4A41C047AF06280D324DC02125D126E24A41C0A8C9E77008324DC0266607A6E44A41C039903F6205324DC06C825E6EE64A41C05E166E5402324DC0A7C2E96EE84A41C0A1F7C61000324DC07C3D04FAE94A41C0BFE8972DFE314DC02E3E6079EB4A41C049A4C8B5FC314DC016C847E6EC4A41C0C1502C5CFB314DC074CA4862EE4A41C0
  32 |  3206 |   3.47397158138159 | 0102000020E610000008000000C1502C5CFB314DC074CA4862EE4A41C027EEC220FA314DC08501F0F4EF4A41C0E6EAC726F9314DC00179C086F14A41C0CE948C52F8314DC05A76D20CF34A41C0CFAE319EF7314DC0D072EA14F54A41C08E356D10F7314DC0466F021DF74A41C0DB487E69F6314DC01BD0775CF94A41C077418EF7F4314DC0787E5182FE4A41C0
  33 | 14164 | 1.2857352790499113 | 0102000020E61000000300000077418EF7F4314DC0787E5182FE4A41C02F8F90DCF5314DC0B7EBA529024B41C00B293FA9F6314DC039AAE4AD044B41C0
  34 |  7123 | 0.3096904552744117 | 0102000020E6100000020000000B293FA9F6314DC039AAE4AD044B41C02E2D3421F7314DC0D96D6127064B41C0
  35 |  7247 | 0.6771976906345515 | 0102000020E6100000020000002E2D3421F7314DC0D96D6127064B41C010841A74F8314DC0909B864D094B41C0
  36 | 14167 |  2.012087231646117 | 0102000020E61000000400000010841A74F8314DC0909B864D094B41C01AB09A9DFB314DC0E6F6819A104B41C05B295F2BFC314DC03218C858124B41C0FC20263CFC314DC03EACDCB0124B41C0
  37 |  3208 | 0.8780408511318085 | 0102000020E610000005000000FC20263CFC314DC03EACDCB0124B41C0CCCA9B68FC314DC0AF3374A2134B41C03D3EC681FC314DC0AED117E7144B41C0BA8DBC62FC314DC0B9799917164B41C0C0649934FC314DC0DC07C5FB164B41C0
  38 |  7540 | 1.7608186622297164 | 0102000020E610000007000000C0649934FC314DC0DC07C5FB164B41C0F08C11E4FB314DC0F48B12F4174B41C05610035DFB314DC0F92EA52E194B41C05C5DA9C2FA314DC09335EA211A4B41C092A4B5B3F9314DC00447B87F1B4B41C0FE744D92F8314DC0745886DD1C4B41C076F39E14F7314DC0D98D88731E4B41C0
  39 |  3209 | 0.8127491001667018 | 0102000020E61000000200000076F39E14F7314DC0D98D88731E4B41C0DD820074F3314DC09C3B5519214B41C0
  40 |  3094 |   1.27340292156354 | 0102000020E610000002000000DD820074F3314DC09C3B5519214B41C0513C1D7EED314DC0CFCCDDF8244B41C0
  41 |  5217 |  2.212779242683185 | 0102000020E610000002000000513C1D7EED314DC0CFCCDDF8244B41C0FD1AA43BE3314DC00124E4CD2B4B41C0
  42 |  3389 |  3.882123677117365 | 0102000020E610000002000000FD1AA43BE3314DC00124E4CD2B4B41C0D696F03AD1314DC025E99AC9374B41C0
  43 | 15089 |  9.544715145686856 | 0102000020E610000002000000D696F03AD1314DC025E99AC9374B41C04C570B47EB314DC0904F23884E4B41C0
  44 |  3091 |  9.256380397318988 | 0102000020E6100000020000004C570B47EB314DC0904F23884E4B41C01B77949405324DC0D1E40753394B41C0
  45 |    -1 |                  0 | 
(45 rows)

6.3.8. Ejercicio: 8 (Capítulo: SQL)

Ejercicio 8: Direccionalidad de la geometría de la ruta

 seq |  id   |      seconds       |                                                                                                                       route_readable                                                                                                                       |                                                                                                                                                                         route_geom                                                                                                                                                                         
-----+-------+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |  9259 |  4.562824647626956 | LINESTRING(-58.3921304 -34.5829209,-58.3925915 -34.5827132,-58.3926425 -34.5827066,-58.3926854 -34.5827222,-58.3927465 -34.5827453)                                                                                                                        | 0102000020E6100000050000003AE2355431324DC0D3D3EC269D4A41C00398327040324DC048799C58964A41C08542041C42324DC0E9143F21964A41C0EF4EE38343324DC09BD31BA4964A41C02A8F6E8445324DC0E8B2E265974A41C0
   2 |  9263 | 2.1797689059943934 | LINESTRING(-58.3927465 -34.5827453,-58.3930552 -34.5828417)                                                                                                                                                                                                | 0102000020E6100000020000002A8F6E8445324DC0E8B2E265974A41C0E9C2FEA14F324DC05E1F8C8E9A4A41C0
   3 |  4971 |  2.020891103424378 | LINESTRING(-58.3930552 -34.5828417,-58.3930944 -34.5828972,-58.3931786 -34.5830165)                                                                                                                                                                        | 0102000020E610000003000000E9C2FEA14F324DC05E1F8C8E9A4A41C0D11ED4EA50324DC009771D609C4A41C0583E26AD53324DC0A243E048A04A41C0
   4 |  9926 |  2.206902577638243 | LINESTRING(-58.3931786 -34.5830165,-58.3935264 -34.5828516)                                                                                                                                                                                                | 0102000020E610000002000000583E26AD53324DC0A243E048A04A41C06A0EB5125F324DC0EC3598E19A4A41C0
   5 |  9925 |  7.976997859406723 | LINESTRING(-58.3935264 -34.5828516,-58.3947735 -34.5822413)                                                                                                                                                                                                | 0102000020E6100000020000006A0EB5125F324DC0EC3598E19A4A41C0EAE923F087324DC0B5F006E2864A41C0
   6 |  9227 | 1.4714644532411254 | LINESTRING(-58.3947735 -34.5822413,-58.395007 -34.5821337)                                                                                                                                                                                                 | 0102000020E610000002000000EAE923F087324DC0B5F006E2864A41C07558E1968F324DC022B3695B834A41C0
   7 |  9223 |   5.26786280276595 | LINESTRING(-58.395007 -34.5821337,-58.3958426 -34.581748)                                                                                                                                                                                                  | 0102000020E6100000020000007558E1968F324DC022B3695B834A41C08BAE66F8AA324DC0B741EDB7764A41C0
   8 |  4580 | 0.9108210788989419 | LINESTRING(-58.3958426 -34.581748,-58.395988 -34.5816827)                                                                                                                                                                                                  | 0102000020E6100000020000008BAE66F8AA324DC0B741EDB7764A41C0E2CD1ABCAF324DC012932694744A41C0
   9 |  6139 | 3.0951638988472294 | LINESTRING(-58.395988 -34.5816827,-58.3964785 -34.5814554)                                                                                                                                                                                                 | 0102000020E610000002000000E2CD1ABCAF324DC012932694744A41C09888B7CEBF324DC0938A6B216D4A41C0
  10 |  2767 | 10.360059037995743 | LINESTRING(-58.3964785 -34.5814554,-58.3977689 -34.5808646,-58.3979404 -34.5807861,-58.3981269 -34.5807045)                                                                                                                                                | 0102000020E6100000040000009888B7CEBF324DC0938A6B216D4A41C0D66E6017EA324DC0BA336EC5594A41C0EBE005B6EF324DC056BCEC32574A41C035947FD2F5324DC0ED116A86544A41C0
  11 | 12409 | 1.0678201185800953 | LINESTRING(-58.3981269 -34.5807045,-58.3981409 -34.5807456,-58.3981541 -34.5807741,-58.3981699 -34.5808052)                                                                                                                                                | 0102000020E61000000400000035947FD2F5324DC0ED116A86544A41C09A59F047F6324DC0E0A52FDF554A41C05822ABB6F6324DC092EE42CE564A41C03460353BF7324DC062AC25D3574A41C0
  12 |  9923 |  2.929107217373415 | LINESTRING(-58.3981699 -34.5808052,-58.3982536 -34.5809237,-58.3983457 -34.58106)                                                                                                                                                                          | 0102000020E6100000030000003460353BF7324DC062AC25D3574A41C0D3C155F9F9324DC0547C32B55B4A41C04900EDFDFC324DC0C381902C604A41C0
  13 | 13066 | 0.8554599855783996 | LINESTRING(-58.3983457 -34.58106,-58.3983926 -34.5811364)                                                                                                                                                                                                  | 0102000020E6100000020000004900EDFDFC324DC0C381902C604A41C0F5FB5987FE324DC0F14174AD624A41C0
  14 | 13064 |  7.723204031905286 | LINESTRING(-58.3983926 -34.5811364,-58.3988159 -34.5818262)                                                                                                                                                                                                | 0102000020E610000002000000F5FB5987FE324DC0F14174AD624A41C0FACF3F660C334DC05D7AEA47794A41C0
  15 |  6146 |  5.635262444476295 | LINESTRING(-58.3988159 -34.5818262,-58.3991248 -34.5823295)                                                                                                                                                                                                | 0102000020E610000002000000FACF3F660C334DC05D7AEA47794A41C0E3827D8516334DC07EFFE6C5894A41C0
  16 |  5626 |  2.455103047366677 | LINESTRING(-58.3991248 -34.5823295,-58.399248 -34.5825533)                                                                                                                                                                                                 | 0102000020E610000002000000E3827D8516334DC07EFFE6C5894A41C0287FF78E1A334DC0A4D6451B914A41C0
  17 |  2770 | 2.1401759333842985 | LINESTRING(-58.399248 -34.5825533,-58.3993344 -34.5827554)                                                                                                                                                                                                 | 0102000020E610000002000000287FF78E1A334DC0A4D6451B914A41C07A15BE631D334DC0A1489CBA974A41C0
  18 | 14420 |  9.096666843196918 | LINESTRING(-58.3993344 -34.5827554,-58.3992235 -34.5827828,-58.3978301 -34.5829964,-58.3974425 -34.5830593)                                                                                                                                                | 0102000020E6100000040000007A15BE631D334DC0A1489CBA974A41C0B72572C119334DC0ED5575A0984A41C0A56EC218EC324DC0C6D743A09F4A41C02EC55565DF324DC07890E8AFA14A41C0
  19 |  2826 | 0.7481438320748062 | LINESTRING(-58.3974425 -34.5830593,-58.3972869 -34.5830845)                                                                                                                                                                                                | 0102000020E6100000020000002EC55565DF324DC07890E8AFA14A41C08A50114CDA324DC0FA264D83A24A41C0
  20 | 13813 | 2.1716123307117825 | LINESTRING(-58.3972869 -34.5830845,-58.3968412 -34.5831794)                                                                                                                                                                                                | 0102000020E6100000020000008A50114CDA324DC0FA264D83A24A41C04ADA43B1CB324DC0B759619FA54A41C0
  21 | 15684 |  3.897181894589708 | LINESTRING(-58.3968412 -34.5831794,-58.396548 -34.5832419,-58.396237 -34.5833149,-58.3960486 -34.5833701)                                                                                                                                                  | 0102000020E6100000040000004ADA43B1CB324DC0B759619FA54A41C0A9A5B915C2324DC01514ABABA74A41C08A3BDEE4B7324DC07F620910AA4A41C0345074B8B1324DC06D7B16DFAB4A41C0
  22 | 15682 |  0.589552505194874 | LINESTRING(-58.3960486 -34.5833701,-58.3959318 -34.5834068)                                                                                                                                                                                                | 0102000020E610000002000000345074B8B1324DC06D7B16DFAB4A41C02439AAE4AD324DC0CB21F312AD4A41C0
  23 | 15306 | 2.1695345795810264 | LINESTRING(-58.3959318 -34.5834068,-58.395502 -34.5835419)                                                                                                                                                                                                 | 0102000020E6100000020000002439AAE4AD324DC0CB21F312AD4A41C055C03DCF9F324DC0402C4080B14A41C0
  24 | 15059 |  8.113352261901777 | LINESTRING(-58.395502 -34.5835419,-58.3938967 -34.5840515)                                                                                                                                                                                                 | 0102000020E61000000200000055C03DCF9F324DC0402C4080B14A41C04C4002356B324DC002D71533C24A41C0
  25 | 15683 | 0.7793052200329939 | LINESTRING(-58.3938967 -34.5840515,-58.3937423 -34.5841)                                                                                                                                                                                                   | 0102000020E6100000020000004C4002356B324DC002D71533C24A41C0A2C6CE2566324DC0FBCBEEC9C34A41C0
  26 | 15303 |  6.950475451950527 | LINESTRING(-58.3937423 -34.5841,-58.3930659 -34.5843172,-58.3926644 -34.5844472,-58.3925197 -34.5844931,-58.3923706 -34.584544)                                                                                                                            | 0102000020E610000005000000A2C6CE2566324DC0FBCBEEC9C34A41C01FD6C0FB4F324DC0C23EF0E7CA4A41C0D826BAD342324DC0901E752ACF4A41C09344E5153E324DC06C9E7EABD04A41C0B974273339324DC059897956D24A41C0
  27 | 15657 |  1.817110639809061 | LINESTRING(-58.3923706 -34.584544,-58.3920077 -34.5846506)                                                                                                                                                                                                 | 0102000020E610000002000000B974273339324DC059897956D24A41C0DDA3ED4E2D324DC01C4BB3D4D54A41C0
  28 | 15001 | 1.4094404740592905 | LINESTRING(-58.3920077 -34.5846506,-58.391729 -34.5847395)                                                                                                                                                                                                 | 0102000020E610000002000000DDA3ED4E2D324DC01C4BB3D4D54A41C088F2052D24324DC0F69672BED84A41C0
  29 |  3205 | 1.7669059964000335 | LINESTRING(-58.391729 -34.5847395,-58.3913795 -34.5848507)                                                                                                                                                                                                 | 0102000020E61000000200000088F2052D24324DC0F69672BED84A41C0946934B918324DC077C54263DC4A41C0
  30 | 15935 | 0.5611608144559347 | LINESTRING(-58.3913795 -34.5848507,-58.3912684 -34.5848858)                                                                                                                                                                                                | 0102000020E610000002000000946934B918324DC077C54263DC4A41C0A8FA3A1515324DC08972B389DD4A41C0
  31 |  4873 |  5.544801706878828 | LINESTRING(-58.3912684 -34.5848858,-58.3911601 -34.5849577,-58.3910265 -34.5850266,-58.3908826 -34.5851028,-58.3907893 -34.5851572,-58.3906961 -34.5852183,-58.390627 -34.5852654,-58.3905694 -34.5853111,-58.3905246 -34.5853546,-58.3904834 -34.5853999) | 0102000020E61000000A000000A8FA3A1515324DC08972B389DD4A41C00380BE8811324DC08D85D7E4DF4A41C047AF06280D324DC02125D126E24A41C0A8C9E77008324DC0266607A6E44A41C039903F6205324DC06C825E6EE64A41C05E166E5402324DC0A7C2E96EE84A41C0A1F7C61000324DC07C3D04FAE94A41C0BFE8972DFE314DC02E3E6079EB4A41C049A4C8B5FC314DC016C847E6EC4A41C0C1502C5CFB314DC074CA4862EE4A41C0
  32 |  3206 |   3.47397158138159 | LINESTRING(-58.3904834 -34.5853999,-58.3904458 -34.5854479,-58.390416 -34.5854958,-58.3903907 -34.5855423,-58.3903692 -34.5856043,-58.3903523 -34.5856663,-58.3903324 -34.5857349,-58.3902883 -34.585892)                                                  | 0102000020E610000008000000C1502C5CFB314DC074CA4862EE4A41C027EEC220FA314DC08501F0F4EF4A41C0E6EAC726F9314DC00179C086F14A41C0CE948C52F8314DC05A76D20CF34A41C0CFAE319EF7314DC0D072EA14F54A41C08E356D10F7314DC0466F021DF74A41C0DB487E69F6314DC01BD0775CF94A41C077418EF7F4314DC0787E5182FE4A41C0
  33 | 14164 | 1.2857352790499113 | LINESTRING(-58.3902883 -34.585892,-58.3903156 -34.5860035,-58.39034 -34.5860803)                                                                                                                                                                           | 0102000020E61000000300000077418EF7F4314DC0787E5182FE4A41C02F8F90DCF5314DC0B7EBA529024B41C00B293FA9F6314DC039AAE4AD044B41C0
  34 |  7123 | 0.3096904552744117 | LINESTRING(-58.39034 -34.5860803,-58.3903543 -34.5861253)                                                                                                                                                                                                  | 0102000020E6100000020000000B293FA9F6314DC039AAE4AD044B41C02E2D3421F7314DC0D96D6127064B41C0
  35 |  7247 | 0.6771976906345515 | LINESTRING(-58.3903543 -34.5861253,-58.3903947 -34.5862214)                                                                                                                                                                                                | 0102000020E6100000020000002E2D3421F7314DC0D96D6127064B41C010841A74F8314DC0909B864D094B41C0
  36 | 14167 |  2.012087231646117 | LINESTRING(-58.3903947 -34.5862214,-58.3904912 -34.5864442,-58.3905081 -34.5864974,-58.3905101 -34.5865079)                                                                                                                                                | 0102000020E61000000400000010841A74F8314DC0909B864D094B41C01AB09A9DFB314DC0E6F6819A104B41C05B295F2BFC314DC03218C858124B41C0FC20263CFC314DC03EACDCB0124B41C0
  37 |  3208 | 0.8780408511318085 | LINESTRING(-58.3905101 -34.5865079,-58.3905154 -34.5865367,-58.3905184 -34.5865754,-58.3905147 -34.5866117,-58.3905092 -34.5866389)                                                                                                                        | 0102000020E610000005000000FC20263CFC314DC03EACDCB0124B41C0CCCA9B68FC314DC0AF3374A2134B41C03D3EC681FC314DC0AED117E7144B41C0BA8DBC62FC314DC0B9799917164B41C0C0649934FC314DC0DC07C5FB164B41C0
  38 |  7540 | 1.7608186622297164 | LINESTRING(-58.3905092 -34.5866389,-58.3904996 -34.5866685,-58.3904835 -34.586706,-58.3904651 -34.586735,-58.3904328 -34.5867767,-58.3903983 -34.5868184,-58.3903528 -34.5868668)                                                                          | 0102000020E610000007000000C0649934FC314DC0DC07C5FB164B41C0F08C11E4FB314DC0F48B12F4174B41C05610035DFB314DC0F92EA52E194B41C05C5DA9C2FA314DC09335EA211A4B41C092A4B5B3F9314DC00447B87F1B4B41C0FE744D92F8314DC0745886DD1C4B41C076F39E14F7314DC0D98D88731E4B41C0
  39 |  3209 | 0.8127491001667018 | LINESTRING(-58.3903528 -34.5868668,-58.3902421 -34.5869476)                                                                                                                                                                                                | 0102000020E61000000200000076F39E14F7314DC0D98D88731E4B41C0DD820074F3314DC09C3B5519214B41C0
  40 |  3094 |   1.27340292156354 | LINESTRING(-58.3902421 -34.5869476,-58.3900602 -34.5870658)                                                                                                                                                                                                | 0102000020E610000002000000DD820074F3314DC09C3B5519214B41C0513C1D7EED314DC0CFCCDDF8244B41C0
  41 |  5217 |  2.212779242683185 | LINESTRING(-58.3900602 -34.5870658,-58.3897471 -34.5872743)                                                                                                                                                                                                | 0102000020E610000002000000513C1D7EED314DC0CFCCDDF8244B41C0FD1AA43BE3314DC00124E4CD2B4B41C0
  42 |  3389 |  3.882123677117365 | LINESTRING(-58.3897471 -34.5872743,-58.3891977 -34.58764)                                                                                                                                                                                                  | 0102000020E610000002000000FD1AA43BE3314DC00124E4CD2B4B41C0D696F03AD1314DC025E99AC9374B41C0
  43 | 15089 |  9.544715145686856 | LINESTRING(-58.3891977 -34.58764,-58.3899926 -34.5883341)                                                                                                                                                                                                  | 0102000020E610000002000000D696F03AD1314DC025E99AC9374B41C04C570B47EB314DC0904F23884E4B41C0
  44 |  3091 |  9.256380397318988 | LINESTRING(-58.3899926 -34.5883341,-58.3907953 -34.5876869)                                                                                                                                                                                                | 0102000020E6100000020000004C570B47EB314DC0904F23884E4B41C01B77949405324DC0D1E40753394B41C0
  45 |    -1 |                  0 |                                                                                                                                                                                                                                                            | 
(45 rows)

6.3.9. Ejercicio: 9 (Capítulo: SQL)

Ejercicio 9: Uso de la geometría

 seq |  id   |      seconds       |      azimuth       
-----+-------+--------------------+--------------------
   1 |  9259 |  4.562824647626956 |    285.90854105506
   2 |  9263 | 2.1797689059943934 | 252.65760108358864
   3 |  4971 |  2.020891103424378 |  35.22016667182774
   4 |  9926 |  2.206902577638243 | 115.36670876388965
   5 |  9925 |  7.976997859406723 | 116.07598650259274
   6 |  9227 | 1.4714644532411254 | 114.74089789675759
   7 |  9223 |   5.26786280276595 | 114.77731465177128
   8 |  4580 | 0.9108210788989419 | 114.18513038970802
   9 |  6139 | 3.0951638988472294 | 114.86322749554624
  10 |  2767 | 10.360059037995743 | 114.49081359662146
  11 | 12409 | 1.0678201185800953 | 23.123011521874176
  12 |  9923 |  2.929107217373415 |  34.60384745894784
  13 | 13066 | 0.8554599855783996 |  31.54469631742492
  14 | 13064 |  7.723204031905286 |  31.53561472038264
  15 |  6146 |  5.635262444476295 | 31.539490514421022
  16 |  5626 |  2.455103047366677 | 28.832410340849307
  17 |  2770 | 2.1401759333842985 | 23.147247155948207
  18 | 14420 |  9.096666843196918 |  279.1255899308699
  19 |  2826 | 0.7481438320748062 | 279.19938972837974
  20 | 13813 | 2.1716123307117825 | 282.02011321925767
  21 | 15684 |  3.897181894589708 |  283.5282640887705
  22 | 15682 |  0.589552505194874 |  287.4433616442469
  23 | 15306 | 2.1695345795810264 |  287.4496148741448
  24 | 15059 |  8.113352261901777 |  287.6119602424034
  25 | 15683 | 0.7793052200329939 |  287.4385035888885
  26 | 15303 |  6.950475451950527 | 287.93603786329453
  27 | 15657 |  1.817110639809061 | 286.36987838437926
  28 | 15001 | 1.4094404740592905 |  287.6916939168716
  29 |  3205 | 1.7669059964000335 |  287.6494475566775
  30 | 15935 | 0.5611608144559347 | 287.53297252623884
  31 |  4873 |  5.544801706878828 |  303.2209679661638
  32 |  3206 |   3.47397158138159 | 338.37344992877877
  33 | 14164 | 1.2857352790499113 | 15.352910542458273
  34 |  7123 | 0.3096904552744117 | 17.629100171571206
  35 |  7247 | 0.6771976906345515 |  22.80166175085434
  36 | 14167 |  2.012087231646117 | 21.939197423380595
  37 |  3208 | 0.8780408511318085 | 359.60637106509364
  38 |  7540 | 1.7608186622297164 | 325.53951885404285
  39 |  3209 | 0.8127491001667018 |  306.1257298647106
  40 |  3094 |   1.27340292156354 | 303.01611680188796
  41 |  5217 |  2.212779242683185 | 303.66049660349967
  42 |  3389 |  3.882123677117365 |  303.6491350967826
  43 | 15089 |  9.544715145686856 |  48.87281142812603
  44 |  3091 |  9.256380397318988 |  128.8784966855187
  45 |    -1 |                  0 |                   
(45 rows)

6.3.10. Ejercicio: 10 (Capítulo: SQL)

Ejercicio 10: Función para una aplicación

CREATE FUNCTION

6.3.11. Ejercicio: 11 (Capítulo: SQL)

Ejercicio 11: Uso de la función

 seq |  id   |      seconds       |                name                 |      length_m      |                                                                                                                       route_readable                                                                                                                       |                                                                                                                                                                         route_geom                                                                                                                                                                         |      azimuth       
-----+-------+--------------------+-------------------------------------+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------
   1 |  9259 |  4.562824647626956 |                                     | 63.372564550374385 | LINESTRING(-58.3921304 -34.5829209,-58.3925915 -34.5827132,-58.3926425 -34.5827066,-58.3926854 -34.5827222,-58.3927465 -34.5827453)                                                                                                                        | 0102000020E6100000050000003AE2355431324DC0D3D3EC269D4A41C00398327040324DC048799C58964A41C08542041C42324DC0E9143F21964A41C0EF4EE38343324DC09BD31BA4964A41C02A8F6E8445324DC0E8B2E265974A41C0                                                                                                                                                                 |    285.90854105506
   2 |  9263 | 2.1797689059943934 |                                     |  30.27456813881102 | LINESTRING(-58.3927465 -34.5827453,-58.3930552 -34.5828417)                                                                                                                                                                                                | 0102000020E6100000020000002A8F6E8445324DC0E8B2E265974A41C0E9C2FEA14F324DC05E1F8C8E9A4A41C0                                                                                                                                                                                                                                                                 | 252.65760108358864
   3 |  4971 |  2.020891103424378 | Juan A. Bibiloni                    | 22.454345593604202 | LINESTRING(-58.3931786 -34.5830165,-58.3930944 -34.5828972,-58.3930552 -34.5828417)                                                                                                                                                                        | 0102000020E610000003000000583E26AD53324DC0A243E048A04A41C0D11ED4EA50324DC009771D609C4A41C0E9C2FEA14F324DC05E1F8C8E9A4A41C0                                                                                                                                                                                                                                 |  35.22016667182774
   4 |  9926 |  2.206902577638243 | Avenida Presidente Figueroa Alcorta |  36.78170962730405 | LINESTRING(-58.3935264 -34.5828516,-58.3931786 -34.5830165)                                                                                                                                                                                                | 0102000020E6100000020000006A0EB5125F324DC0EC3598E19A4A41C0583E26AD53324DC0A243E048A04A41C0                                                                                                                                                                                                                                                                 | 115.36670876388965
   5 |  9925 |  7.976997859406723 | Avenida Presidente Figueroa Alcorta | 132.94996432344539 | LINESTRING(-58.3947735 -34.5822413,-58.3935264 -34.5828516)                                                                                                                                                                                                | 0102000020E610000002000000EAE923F087324DC0B5F006E2864A41C06A0EB5125F324DC0EC3598E19A4A41C0                                                                                                                                                                                                                                                                 | 116.07598650259274
   6 |  9227 | 1.4714644532411254 | Avenida Presidente Figueroa Alcorta | 24.524407554018758 | LINESTRING(-58.395007 -34.5821337,-58.3947735 -34.5822413)                                                                                                                                                                                                 | 0102000020E6100000020000007558E1968F324DC022B3695B834A41C0EAE923F087324DC0B5F006E2864A41C0                                                                                                                                                                                                                                                                 | 114.74089789675759
   7 |  9223 |   5.26786280276595 | Avenida Presidente Figueroa Alcorta |  87.79771337943251 | LINESTRING(-58.3958426 -34.581748,-58.395007 -34.5821337)                                                                                                                                                                                                  | 0102000020E6100000020000008BAE66F8AA324DC0B741EDB7764A41C07558E1968F324DC022B3695B834A41C0                                                                                                                                                                                                                                                                 | 114.77731465177128
   8 |  4580 | 0.9108210788989419 | Avenida Presidente Figueroa Alcorta | 15.180351314982367 | LINESTRING(-58.395988 -34.5816827,-58.3958426 -34.581748)                                                                                                                                                                                                  | 0102000020E610000002000000E2CD1ABCAF324DC012932694744A41C08BAE66F8AA324DC0B741EDB7764A41C0                                                                                                                                                                                                                                                                 | 114.18513038970802
   9 |  6139 | 3.0951638988472294 | Avenida Presidente Figueroa Alcorta | 51.586064980787164 | LINESTRING(-58.3964785 -34.5814554,-58.395988 -34.5816827)                                                                                                                                                                                                 | 0102000020E6100000020000009888B7CEBF324DC0938A6B216D4A41C0E2CD1ABCAF324DC012932694744A41C0                                                                                                                                                                                                                                                                 | 114.86322749554624
  10 |  2767 | 10.360059037995743 | Avenida Presidente Figueroa Alcorta |  172.6676506332624 | LINESTRING(-58.3981269 -34.5807045,-58.3979404 -34.5807861,-58.3977689 -34.5808646,-58.3964785 -34.5814554)                                                                                                                                                | 0102000020E61000000400000035947FD2F5324DC0ED116A86544A41C0EBE005B6EF324DC056BCEC32574A41C0D66E6017EA324DC0BA336EC5594A41C09888B7CEBF324DC0938A6B216D4A41C0                                                                                                                                                                                                 | 114.49081359662146
  11 | 12409 | 1.0678201185800953 | Tagle                               | 11.864667984223281 | LINESTRING(-58.3981699 -34.5808052,-58.3981541 -34.5807741,-58.3981409 -34.5807456,-58.3981269 -34.5807045)                                                                                                                                                | 0102000020E6100000040000003460353BF7324DC062AC25D3574A41C05822ABB6F6324DC092EE42CE564A41C09A59F047F6324DC0E0A52FDF554A41C035947FD2F5324DC0ED116A86544A41C0                                                                                                                                                                                                 | 23.123011521874176
  12 |  9923 |  2.929107217373415 | Tagle                               |   32.5456357485935 | LINESTRING(-58.3983457 -34.58106,-58.3982536 -34.5809237,-58.3981699 -34.5808052)                                                                                                                                                                          | 0102000020E6100000030000004900EDFDFC324DC0C381902C604A41C0D3C155F9F9324DC0547C32B55B4A41C03460353BF7324DC062AC25D3574A41C0                                                                                                                                                                                                                                 |  34.60384745894784
  13 | 13066 | 0.8554599855783996 | Tagle                               |  9.505110950871106 | LINESTRING(-58.3983926 -34.5811364,-58.3983457 -34.58106)                                                                                                                                                                                                  | 0102000020E610000002000000F5FB5987FE324DC0F14174AD624A41C04900EDFDFC324DC0C381902C604A41C0                                                                                                                                                                                                                                                                 |  31.54469631742492
  14 | 13064 |  7.723204031905286 | Tagle                               |  85.81337813228096 | LINESTRING(-58.3988159 -34.5818262,-58.3983926 -34.5811364)                                                                                                                                                                                                | 0102000020E610000002000000FACF3F660C334DC05D7AEA47794A41C0F5FB5987FE324DC0F14174AD624A41C0                                                                                                                                                                                                                                                                 |  31.53561472038264
  15 |  6146 |  5.635262444476295 | Tagle                               |  62.61402716084772 | LINESTRING(-58.3991248 -34.5823295,-58.3988159 -34.5818262)                                                                                                                                                                                                | 0102000020E610000002000000E3827D8516334DC07EFFE6C5894A41C0FACF3F660C334DC05D7AEA47794A41C0                                                                                                                                                                                                                                                                 | 31.539490514421022
  16 |  5626 |  2.455103047366677 | Tagle                               |  27.27892274851863 | LINESTRING(-58.399248 -34.5825533,-58.3991248 -34.5823295)                                                                                                                                                                                                 | 0102000020E610000002000000287FF78E1A334DC0A4D6451B914A41C0E3827D8516334DC07EFFE6C5894A41C0                                                                                                                                                                                                                                                                 | 28.832410340849307
  17 |  2770 | 2.1401759333842985 | Tagle                               |  23.77973259315887 | LINESTRING(-58.3993344 -34.5827554,-58.399248 -34.5825533)                                                                                                                                                                                                 | 0102000020E6100000020000007A15BE631D334DC0A1489CBA974A41C0287FF78E1A334DC0A4D6451B914A41C0                                                                                                                                                                                                                                                                 | 23.147247155948207
  18 | 14420 |  9.096666843196918 | Avenida del Libertador              | 176.87963306216227 | LINESTRING(-58.3974425 -34.5830593,-58.3978301 -34.5829964,-58.3992235 -34.5827828,-58.3993344 -34.5827554)                                                                                                                                                | 0102000020E6100000040000002EC55565DF324DC07890E8AFA14A41C0A56EC218EC324DC0C6D743A09F4A41C0B72572C119334DC0ED5575A0984A41C07A15BE631D334DC0A1489CBA974A41C0                                                                                                                                                                                                 |  279.1255899308699
  19 |  2826 | 0.7481438320748062 | Avenida del Libertador              |  14.54724117923234 | LINESTRING(-58.3972869 -34.5830845,-58.3974425 -34.5830593)                                                                                                                                                                                                | 0102000020E6100000020000008A50114CDA324DC0FA264D83A24A41C02EC55565DF324DC07890E8AFA14A41C0                                                                                                                                                                                                                                                                 | 279.19938972837974
  20 | 13813 | 2.1716123307117825 | Avenida del Libertador              | 42.225795319395765 | LINESTRING(-58.3968412 -34.5831794,-58.3972869 -34.5830845)                                                                                                                                                                                                | 0102000020E6100000020000004ADA43B1CB324DC0B759619FA54A41C08A50114CDA324DC0FA264D83A24A41C0                                                                                                                                                                                                                                                                 | 282.02011321925767
  21 | 15684 |  3.897181894589708 | Avenida del Libertador              |  75.77853683924431 | LINESTRING(-58.3960486 -34.5833701,-58.396237 -34.5833149,-58.396548 -34.5832419,-58.3968412 -34.5831794)                                                                                                                                                  | 0102000020E610000004000000345074B8B1324DC06D7B16DFAB4A41C08A3BDEE4B7324DC07F620910AA4A41C0A9A5B915C2324DC01514ABABA74A41C04ADA43B1CB324DC0B759619FA54A41C0                                                                                                                                                                                                 |  283.5282640887705
  22 | 15682 |  0.589552505194874 | Avenida del Libertador              | 11.463520934344771 | LINESTRING(-58.3959318 -34.5834068,-58.3960486 -34.5833701)                                                                                                                                                                                                | 0102000020E6100000020000002439AAE4AD324DC0CB21F312AD4A41C0345074B8B1324DC06D7B16DFAB4A41C0                                                                                                                                                                                                                                                                 |  287.4433616442469
  23 | 15306 | 2.1695345795810264 | Avenida del Libertador              |   42.1853946029644 | LINESTRING(-58.395502 -34.5835419,-58.3959318 -34.5834068)                                                                                                                                                                                                 | 0102000020E61000000200000055C03DCF9F324DC0402C4080B14A41C02439AAE4AD324DC0CB21F312AD4A41C0                                                                                                                                                                                                                                                                 |  287.4496148741448
  24 | 15059 |  8.113352261901777 | Avenida del Libertador              | 157.75962731475676 | LINESTRING(-58.3938967 -34.5840515,-58.395502 -34.5835419)                                                                                                                                                                                                 | 0102000020E6100000020000004C4002356B324DC002D71533C24A41C055C03DCF9F324DC0402C4080B14A41C0                                                                                                                                                                                                                                                                 |  287.6119602424034
  25 | 15683 | 0.7793052200329939 | Avenida del Libertador              |   15.1531570561971 | LINESTRING(-58.3937423 -34.5841,-58.3938967 -34.5840515)                                                                                                                                                                                                   | 0102000020E610000002000000A2C6CE2566324DC0FBCBEEC9C34A41C04C4002356B324DC002D71533C24A41C0                                                                                                                                                                                                                                                                 |  287.4385035888885
  26 | 15303 |  6.950475451950527 | Avenida del Libertador              |  135.1481337879269 | LINESTRING(-58.3923706 -34.584544,-58.3925197 -34.5844931,-58.3926644 -34.5844472,-58.3930659 -34.5843172,-58.3937423 -34.5841)                                                                                                                            | 0102000020E610000005000000B974273339324DC059897956D24A41C09344E5153E324DC06C9E7EABD04A41C0D826BAD342324DC0901E752ACF4A41C01FD6C0FB4F324DC0C23EF0E7CA4A41C0A2C6CE2566324DC0FBCBEEC9C34A41C0                                                                                                                                                                 | 287.93603786329453
  27 | 15657 |  1.817110639809061 | Avenida del Libertador              |  35.33270688517619 | LINESTRING(-58.3920077 -34.5846506,-58.3923706 -34.584544)                                                                                                                                                                                                 | 0102000020E610000002000000DDA3ED4E2D324DC01C4BB3D4D54A41C0B974273339324DC059897956D24A41C0                                                                                                                                                                                                                                                                 | 286.36987838437926
  28 | 15001 | 1.4094404740592905 | Avenida del Libertador              | 27.405786995597314 | LINESTRING(-58.391729 -34.5847395,-58.3920077 -34.5846506)                                                                                                                                                                                                 | 0102000020E61000000200000088F2052D24324DC0F69672BED84A41C0DDA3ED4E2D324DC01C4BB3D4D54A41C0                                                                                                                                                                                                                                                                 |  287.6916939168716
  29 |  3205 | 1.7669059964000335 | Avenida del Libertador              | 34.356505485556205 | LINESTRING(-58.3913795 -34.5848507,-58.391729 -34.5847395)                                                                                                                                                                                                 | 0102000020E610000002000000946934B918324DC077C54263DC4A41C088F2052D24324DC0F69672BED84A41C0                                                                                                                                                                                                                                                                 |  287.6494475566775
  30 | 15935 | 0.5611608144559347 | Avenida del Libertador              | 10.911460281087617 | LINESTRING(-58.3912684 -34.5848858,-58.3913795 -34.5848507)                                                                                                                                                                                                | 0102000020E610000002000000A8FA3A1515324DC08972B389DD4A41C0946934B918324DC077C54263DC4A41C0                                                                                                                                                                                                                                                                 | 287.53297252623884
  31 |  4873 |  5.544801706878828 | Avenida Alvear                      |  92.41336178131381 | LINESTRING(-58.3904834 -34.5853999,-58.3905246 -34.5853546,-58.3905694 -34.5853111,-58.390627 -34.5852654,-58.3906961 -34.5852183,-58.3907893 -34.5851572,-58.3908826 -34.5851028,-58.3910265 -34.5850266,-58.3911601 -34.5849577,-58.3912684 -34.5848858) | 0102000020E61000000A000000C1502C5CFB314DC074CA4862EE4A41C049A4C8B5FC314DC016C847E6EC4A41C0BFE8972DFE314DC02E3E6079EB4A41C0A1F7C61000324DC07C3D04FAE94A41C05E166E5402324DC0A7C2E96EE84A41C039903F6205324DC06C825E6EE64A41C0A8C9E77008324DC0266607A6E44A41C047AF06280D324DC02125D126E24A41C00380BE8811324DC08D85D7E4DF4A41C0A8FA3A1515324DC08972B389DD4A41C0 |  303.2209679661638
  32 |  3206 |   3.47397158138159 | Avenida Alvear                      |  57.89952635635984 | LINESTRING(-58.3902883 -34.585892,-58.3903324 -34.5857349,-58.3903523 -34.5856663,-58.3903692 -34.5856043,-58.3903907 -34.5855423,-58.390416 -34.5854958,-58.3904458 -34.5854479,-58.3904834 -34.5853999)                                                  | 0102000020E61000000800000077418EF7F4314DC0787E5182FE4A41C0DB487E69F6314DC01BD0775CF94A41C08E356D10F7314DC0466F021DF74A41C0CFAE319EF7314DC0D072EA14F54A41C0CE948C52F8314DC05A76D20CF34A41C0E6EAC726F9314DC00179C086F14A41C027EEC220FA314DC08501F0F4EF4A41C0C1502C5CFB314DC074CA4862EE4A41C0                                                                 | 338.37344992877877
  33 | 14164 | 1.2857352790499113 | Avenida Alvear                      |  21.42892131749852 | LINESTRING(-58.39034 -34.5860803,-58.3903156 -34.5860035,-58.3902883 -34.585892)                                                                                                                                                                           | 0102000020E6100000030000000B293FA9F6314DC039AAE4AD044B41C02F8F90DCF5314DC0B7EBA529024B41C077418EF7F4314DC0787E5182FE4A41C0                                                                                                                                                                                                                                 | 15.352910542458273
  34 |  7123 | 0.3096904552744117 | Avenida Alvear                      |  5.161507587906862 | LINESTRING(-58.3903543 -34.5861253,-58.39034 -34.5860803)                                                                                                                                                                                                  | 0102000020E6100000020000002E2D3421F7314DC0D96D6127064B41C00B293FA9F6314DC039AAE4AD044B41C0                                                                                                                                                                                                                                                                 | 17.629100171571206
  35 |  7247 | 0.6771976906345515 | Avenida Alvear                      | 11.286628177242525 | LINESTRING(-58.3903947 -34.5862214,-58.3903543 -34.5861253)                                                                                                                                                                                                | 0102000020E61000000200000010841A74F8314DC0909B864D094B41C02E2D3421F7314DC0D96D6127064B41C0                                                                                                                                                                                                                                                                 |  22.80166175085434
  36 | 14167 |  2.012087231646117 | Avenida Alvear                      |  33.53478719410195 | LINESTRING(-58.3905101 -34.5865079,-58.3905081 -34.5864974,-58.3904912 -34.5864442,-58.3903947 -34.5862214)                                                                                                                                                | 0102000020E610000004000000FC20263CFC314DC03EACDCB0124B41C05B295F2BFC314DC03218C858124B41C01AB09A9DFB314DC0E6F6819A104B41C010841A74F8314DC0909B864D094B41C0                                                                                                                                                                                                 | 21.939197423380595
  37 |  3208 | 0.8780408511318085 | Avenida Alvear                      | 14.634014185530143 | LINESTRING(-58.3905092 -34.5866389,-58.3905147 -34.5866117,-58.3905184 -34.5865754,-58.3905154 -34.5865367,-58.3905101 -34.5865079)                                                                                                                        | 0102000020E610000005000000C0649934FC314DC0DC07C5FB164B41C0BA8DBC62FC314DC0B9799917164B41C03D3EC681FC314DC0AED117E7144B41C0CCCA9B68FC314DC0AF3374A2134B41C0FC20263CFC314DC03EACDCB0124B41C0                                                                                                                                                                 | 359.60637106509364
  38 |  7540 | 1.7608186622297164 | Avenida Alvear                      | 29.346977703828607 | LINESTRING(-58.3903528 -34.5868668,-58.3903983 -34.5868184,-58.3904328 -34.5867767,-58.3904651 -34.586735,-58.3904835 -34.586706,-58.3904996 -34.5866685,-58.3905092 -34.5866389)                                                                          | 0102000020E61000000700000076F39E14F7314DC0D98D88731E4B41C0FE744D92F8314DC0745886DD1C4B41C092A4B5B3F9314DC00447B87F1B4B41C05C5DA9C2FA314DC09335EA211A4B41C05610035DFB314DC0F92EA52E194B41C0F08C11E4FB314DC0F48B12F4174B41C0C0649934FC314DC0DC07C5FB164B41C0                                                                                                 | 325.53951885404285
  39 |  3209 | 0.8127491001667018 | Avenida Alvear                      | 13.545818336111697 | LINESTRING(-58.3902421 -34.5869476,-58.3903528 -34.5868668)                                                                                                                                                                                                | 0102000020E610000002000000DD820074F3314DC09C3B5519214B41C076F39E14F7314DC0D98D88731E4B41C0                                                                                                                                                                                                                                                                 |  306.1257298647106
  40 |  3094 |   1.27340292156354 | Avenida Alvear                      | 21.223382026059003 | LINESTRING(-58.3900602 -34.5870658,-58.3902421 -34.5869476)                                                                                                                                                                                                | 0102000020E610000002000000513C1D7EED314DC0CFCCDDF8244B41C0DD820074F3314DC09C3B5519214B41C0                                                                                                                                                                                                                                                                 | 303.01611680188796
  41 |  5217 |  2.212779242683185 | Avenida Alvear                      |  36.87965404471975 | LINESTRING(-58.3897471 -34.5872743,-58.3900602 -34.5870658)                                                                                                                                                                                                | 0102000020E610000002000000FD1AA43BE3314DC00124E4CD2B4B41C0513C1D7EED314DC0CFCCDDF8244B41C0                                                                                                                                                                                                                                                                 | 303.66049660349967
  42 |  3389 |  3.882123677117365 | Avenida Alvear                      |  64.70206128528942 | LINESTRING(-58.3891977 -34.58764,-58.3897471 -34.5872743)                                                                                                                                                                                                  | 0102000020E610000002000000D696F03AD1314DC025E99AC9374B41C0FD1AA43BE3314DC00124E4CD2B4B41C0                                                                                                                                                                                                                                                                 |  303.6491350967826
  43 | 15089 |  9.544715145686856 | Ayacucho                            | 106.05239050763174 | LINESTRING(-58.3899926 -34.5883341,-58.3891977 -34.58764)                                                                                                                                                                                                  | 0102000020E6100000020000004C570B47EB314DC0904F23884E4B41C0D696F03AD1314DC025E99AC9374B41C0                                                                                                                                                                                                                                                                 |  48.87281142812603
  44 |  3091 |  9.256380397318988 | Avenida Presidente Quintana         |  102.8486710813221 | LINESTRING(-58.3907953 -34.5876869,-58.3899926 -34.5883341)                                                                                                                                                                                                | 0102000020E6100000020000001B77949405324DC0D1E40753394B41C04C570B47EB314DC0904F23884E4B41C0                                                                                                                                                                                                                                                                 |  128.8784966855187
  45 |    -1 |                  0 |                                     |                    |                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                                                                                            |                   
(45 rows)

 seq | id | seconds | name | length_m | route_readable | route_geom | azimuth 
-----+----+---------+------+----------+----------------+------------+---------
(0 rows)

 seq |  id   |      seconds       |                name                 |      length_m      |                                                                                                                                 route_readable                                                                                                                                  |                                                                                                                                                                                         route_geom                                                                                                                                                                                         |      azimuth       
-----+-------+--------------------+-------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------
   1 |  9262 |  32.86047627585153 |                                     |  65.72095255170306 | LINESTRING(-58.3915873 -34.5832605,-58.3916018 -34.5831882,-58.3916232 -34.5831548,-58.3916742 -34.5831197,-58.3921304 -34.5829209)                                                                                                                                             | 0102000020E610000005000000B4835B881F324DC03946B247A84A41C00107FE0120324DC0E13433E9A54A41C06C2D82B520324DC0B24005D1A44A41C0EED7536122324DC0A09394AAA34A41C03AE2355431324DC0D3D3EC269D4A41C0                                                                                                                                                                                                 |  302.0177093670652
   2 |  9257 | 14.949844973259696 |                                     |  29.89968994651939 | LINESTRING(-58.391534 -34.5835264,-58.3915873 -34.5832605)                                                                                                                                                                                                                      | 0102000020E610000002000000D3A23EC91D324DC0222D3AFEB04A41C0B4835B881F324DC03946B247A84A41C0                                                                                                                                                                                                                                                                                                 |  348.6652067614885
   3 |  9256 |   1.61293592704388 | Julio Víctor González               |   3.22587185408776 | LINESTRING(-58.391534 -34.5835264,-58.3915509 -34.5835519)                                                                                                                                                                                                                      | 0102000020E610000002000000D3A23EC91D324DC0222D3AFEB04A41C0141C03571E324DC0640223D4B14A41C0                                                                                                                                                                                                                                                                                                 | 213.53423169206005
   4 |  5632 |  9.723435372314105 | Julio Víctor González               |  19.44687074462821 | LINESTRING(-58.3915509 -34.5835519,-58.3915711 -34.5835828,-58.3916515 -34.5837062)                                                                                                                                                                                             | 0102000020E610000003000000141C03571E324DC0640223D4B14A41C0854776001F324DC00A4158D7B24A41C0F5F6E7A221324DC079BC7FE2B64A41C0                                                                                                                                                                                                                                                                 | 213.10341237699458
   5 |  4967 |   55.0337080625486 | Avenida Presidente Figueroa Alcorta |  110.0674161250972 | LINESTRING(-58.3916515 -34.5837062,-58.3914232 -34.5838072,-58.3911459 -34.58393,-58.3911278 -34.583938,-58.3905936 -34.5841741)                                                                                                                                                | 0102000020E610000005000000F5F6E7A221324DC079BC7FE2B64A41C0A572C9271A324DC0AD95BF31BA4A41C0743BA01111324DC09F93DE37BE4A41C039C7CA7910324DC02272FA7ABE4A41C0720399F8FE314DC0CA558737C64A41C0                                                                                                                                                                                                 | 113.85939118267152
   6 |  4879 | 11.597871038674077 | Avenida Presidente Figueroa Alcorta | 23.195742077348154 | LINESTRING(-58.3905936 -34.5841741,-58.3903715 -34.584274)                                                                                                                                                                                                                      | 0102000020E610000002000000720399F8FE314DC0CA558737C64A41C02EE57CB1F7314DC099F38C7DC94A41C0                                                                                                                                                                                                                                                                                                 | 114.21809071503708
   7 |  4966 | 23.041863824171436 | Avenida Presidente Figueroa Alcorta |  46.08372764834287 | LINESTRING(-58.3903715 -34.584274,-58.38993 -34.5844721)                                                                                                                                                                                                                        | 0102000020E6100000020000002EE57CB1F7314DC099F38C7DC94A41C059DDEA39E9314DC0547655FBCF4A41C0                                                                                                                                                                                                                                                                                                 |  114.1656603827795
   8 |  9571 |  35.36051542951837 |                                     |  70.72103085903674 | LINESTRING(-58.38993 -34.5844721,-58.3899051 -34.5845996,-58.3898889 -34.5846544,-58.3898825 -34.5846956,-58.3898855 -34.584753,-58.3898914 -34.5847828,-58.3899102 -34.5848255,-58.3899427 -34.5848598,-58.3899814 -34.584895,-58.3901019 -34.5849929,-58.3901365 -34.5850295) | 0102000020E61000000B00000059DDEA39E9314DC0547655FBCF4A41C095850A69E8314DC099A0E128D44A41C0664925E1E7314DC033BB93F4D54A41C0306475ABE7314DC0BC0E304ED74A41C0A1D79FC4E7314DC0739EB12FD94A41C0EFFE1DF6E7314DC0B4A1AC29DA4A41C03CB0D293E8314DC0F52EDE8FDB4A41C02FE873A4E9314DC05FDF98AFDC4A41C02F8617E9EA314DC0064CE0D6DD4A41C0C14DEBDBEE314DC034F21E0CE14A41C0EA3C2AFEEF314DC0FDD8243FE24A41C0 | 200.32815842886262
   9 |  9567 | 17.751376544357925 | Posadas                             |  35.50275308871585 | LINESTRING(-58.3901365 -34.5850295,-58.3901909 -34.5850971,-58.3902136 -34.5851288,-58.3902313 -34.5851545,-58.3902467 -34.5851784,-58.3902599 -34.5852019,-58.3902735 -34.5852298,-58.3902845 -34.5852582,-58.3902909 -34.585284,-58.3902937 -34.5853171)                      | 0102000020E61000000A000000EA3C2AFEEF314DC0FDD8243FE24A41C0315981C6F1314DC002BE3676E44A41C02B3AED84F2314DC04FF92180E54A41C013B06719F3314DC0BA4DB857E64A41C09BEF969AF3314DC0AD293520E74A41C059B85109F4314DC04E0757E5E74A41C06B7F677BF4314DC083D261CFE84A41C05FD1ADD7F4314DC0A05B9EBDE94A41C094B65D0DF5314DC0A06F0B96EA4A41C0DCAADA24F5314DC01025B5ABEB4A41C0                                 | 208.66068484270227
  10 |  9231 | 12.210237164411874 | Posadas                             | 24.420474328823747 | LINESTRING(-58.3902937 -34.5853171,-58.3902891 -34.5853617,-58.3902644 -34.5854448,-58.3902348 -34.5855312)                                                                                                                                                                     | 0102000020E610000004000000DCAADA24F5314DC01025B5ABEB4A41C01D3E44FEF4314DC05DEAD621ED4A41C08365112FF4314DC07FCEEEDAEF4A41C06CE1C336F3314DC0D164B5AFF24A41C0                                                                                                                                                                                                                                 |  164.6181509701793
  11 |  4874 |  20.33474622449208 | Avenida Alvear                      |  40.66949244898416 | LINESTRING(-58.3902348 -34.5855312,-58.3902321 -34.5856519,-58.390233 -34.5857142,-58.3902883 -34.585892)                                                                                                                                                                       | 0102000020E6100000040000006CE1C336F3314DC0D164B5AFF24A41C0B9AC1D20F3314DC08EAB36A4F64A41C0F568AA27F3314DC0C2E6D2AEF84A41C077418EF7F4314DC0787E5182FE4A41C0                                                                                                                                                                                                                                 | 188.43445069131323
  12 | 14164 |  10.71446065874926 | Avenida Alvear                      |  21.42892131749852 | LINESTRING(-58.39034 -34.5860803,-58.3903156 -34.5860035,-58.3902883 -34.585892)                                                                                                                                                                                                | 0102000020E6100000030000000B293FA9F6314DC039AAE4AD044B41C02F8F90DCF5314DC0B7EBA529024B41C077418EF7F4314DC0787E5182FE4A41C0                                                                                                                                                                                                                                                                 | 15.352910542458273
  13 |  7123 |  2.580753793953431 | Avenida Alvear                      |  5.161507587906862 | LINESTRING(-58.3903543 -34.5861253,-58.39034 -34.5860803)                                                                                                                                                                                                                       | 0102000020E6100000020000002E2D3421F7314DC0D96D6127064B41C00B293FA9F6314DC039AAE4AD044B41C0                                                                                                                                                                                                                                                                                                 | 17.629100171571206
  14 |  7247 | 5.6433140886212625 | Avenida Alvear                      | 11.286628177242525 | LINESTRING(-58.3903947 -34.5862214,-58.3903543 -34.5861253)                                                                                                                                                                                                                     | 0102000020E61000000200000010841A74F8314DC0909B864D094B41C02E2D3421F7314DC0D96D6127064B41C0                                                                                                                                                                                                                                                                                                 |  22.80166175085434
  15 | 14167 | 16.767393597050976 | Avenida Alvear                      |  33.53478719410195 | LINESTRING(-58.3905101 -34.5865079,-58.3905081 -34.5864974,-58.3904912 -34.5864442,-58.3903947 -34.5862214)                                                                                                                                                                     | 0102000020E610000004000000FC20263CFC314DC03EACDCB0124B41C05B295F2BFC314DC03218C858124B41C01AB09A9DFB314DC0E6F6819A104B41C010841A74F8314DC0909B864D094B41C0                                                                                                                                                                                                                                 | 21.939197423380595
  16 |  3208 |  7.317007092765071 | Avenida Alvear                      | 14.634014185530143 | LINESTRING(-58.3905092 -34.5866389,-58.3905147 -34.5866117,-58.3905184 -34.5865754,-58.3905154 -34.5865367,-58.3905101 -34.5865079)                                                                                                                                             | 0102000020E610000005000000C0649934FC314DC0DC07C5FB164B41C0BA8DBC62FC314DC0B9799917164B41C03D3EC681FC314DC0AED117E7144B41C0CCCA9B68FC314DC0AF3374A2134B41C0FC20263CFC314DC03EACDCB0124B41C0                                                                                                                                                                                                 | 359.60637106509364
  17 |  3207 | 13.682173692196534 | Presidente Eduardo Victor Haedo     | 27.364347384393067 | LINESTRING(-58.3905092 -34.5866389,-58.390532 -34.5866909,-58.3905444 -34.5867141,-58.3905588 -34.5867389,-58.3905712 -34.586757,-58.3905863 -34.5867773,-58.3905999 -34.5867942,-58.3906558 -34.5868514)                                                                       | 0102000020E610000008000000C0649934FC314DC0DC07C5FB164B41C04F05DCF3FC314DC02F2EFAAF184B41C067D1E05BFD314DC011CD9772194B41C01F95ACD4FD314DC04065A1421A4B41C03661B13CFE314DC07BD976DA1A4B41C001625CBBFE314DC081C4C0841B4B41C01229722DFF314DC0C23D85121C4B41C0117F5E0201324DC0504E59F21D4B41C0                                                                                                 | 214.60110875325924
  18 | 12748 |  6.808080772907077 | Presidente Eduardo Victor Haedo     | 13.616161545814155 | LINESTRING(-58.3906558 -34.5868514,-58.3907047 -34.5869252,-58.3907256 -34.5869597)                                                                                                                                                                                             | 0102000020E610000003000000117F5E0201324DC0504E59F21D4B41C05E72929C02324DC061996D5D204B41C0E1DAE44B03324DC0F5C8D57E214B41C0                                                                                                                                                                                                                                                                 |  212.8020232260342
  19 | 13882 | 16.389890801292673 | Presidente Eduardo Victor Haedo     | 32.779781602585345 | LINESTRING(-58.3907256 -34.5869597,-58.3907449 -34.5869861,-58.3907595 -34.5870135,-58.39077 -34.5870454,-58.3907926 -34.5871059,-58.3908331 -34.5872401)                                                                                                                       | 0102000020E610000006000000E1DAE44B03324DC0F5C8D57E214B41C0164ACBED03324DC0715A4B5C224B41C0F88C446804324DC0BE672442234B41C0042159C004324DC03522BD4D244B41C06842EE7D05324DC0F2E43F49264B41C0DF58ABD106324DC02C3300AF2A4B41C0                                                                                                                                                                 | 200.97586880634915
  20 |  4887 |  25.07896076384853 | Presidente Eduardo Victor Haedo     |  50.15792152769706 | LINESTRING(-58.3908331 -34.5872401,-58.3908426 -34.5873243,-58.3908477 -34.5874167,-58.390847 -34.5874895,-58.390833 -34.5875682,-58.3908152 -34.587627,-58.3907953 -34.5876869)                                                                                                | 0102000020E610000007000000DF58ABD106324DC02C3300AF2A4B41C01A715C2107324DC0B35252712D4B41C0C19B244C07324DC0E7CF6D78304B41C0AF5E454607324DC0279F1EDB324B41C04A99D4D006324DC0B5954D6F354B41C0CD63833B06324DC0909F8D5C374B41C01B77949405324DC0D1E40753394B41C0                                                                                                                                 | 175.16420008880607
  21 |    -1 |                  0 |                                     |                    |                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                                                                                                                                                            |                   
(21 rows)

6.4. Solutions to Función pl/pgsql

6.4.1. Ejercicio: 1 (Capítulo: pl/pgsql)

Ejercicio 1: Número de vértices

Para ways_vertices_pgr:

 count 
-------
 16351
(1 row)

Para vehicle_net:

 count 
-------
 10134
(1 row)

Para taxi_net:

 count 
-------
   759
(1 row)

Para walk_net:

 count 
-------
 16212
(1 row)

6.4.2. Ejercicio: 2 (Capítulo: pl/pgsql)

Ejercicio 2: Vértices en una tabla

Para vehicle_net:

SELECT 10134

Para taxi_net:

SELECT 759

Para walk_net:

SELECT 16212

6.4.3. Ejercicio: 3 (Capítulo: pl/pgsql)

Ejercicio 3: Vértice más cercano

Para ways_vertices_pgr:

  osm_id   
-----------
 195491825
(1 row)

Para``vehicle_net_vertices_pgr``:

    id     
-----------
 195491825
(1 row)

Para taxi_net_vertices_pgr:

    id     
-----------
 195491916
(1 row)

Para walk_net_vertices_pgr:

    id     
-----------
 195491825
(1 row)

6.4.4. Ejercicio: 4 (Capítulo: pl/pgsql)

Ejercicio 4: Función de vértice más cercano

CREATE FUNCTION

6.4.5. Ejercicio: 5 (Capítulo: pl/pgsql)

Ejercicio 5: Prueba de la función vértice más cercano

Para ways_vertices_pgr:

 wrk_nearestosm 
----------------
           2083
(1 row)

Para``vehicle_net_vertices_pgr``:

 wrk_nearestosm 
----------------
      195491825
(1 row)

Para taxi_net_vertices_pgr:

 wrk_nearestosm 
----------------
      195491916
(1 row)

Para walk_net_vertices_pgr:

 wrk_nearestosm 
----------------
      195491825
(1 row)

6.4.6. Ejercicio: 6 (Capítulo: pl/pgsql)

Ejercicio 6: Creación de la función principal

CREATE FUNCTION

6.4.7. Ejercicio: 7 (Capítulo: pl/pgsql)

Ejercicio 7: Uso de la función principal

Para vehicle_net

 seq |  id   |       seconds       |         name         |      length_m      |                                   route_readable                                    |                                                         route_geom                                                         |      azimuth       
-----+-------+---------------------+----------------------+--------------------+-------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+--------------------
   1 |  3256 |   6.984691544281976 | Güemes               |  77.60768382535528 | LINESTRING(-58.4105085 -34.5907728,-58.4111692 -34.5903359)                         | 0102000020E610000002000000711DE38A8B344DC0E5AE6F719E4B41C0AE8F3D31A1344DC0CE137420904B41C0                                 |  303.4754024564509
   2 |  3053 |  15.061150538600472 | Billinghurst         |  167.3461170955608 | LINESTRING(-58.4094591 -34.5895389,-58.4096056 -34.5897115,-58.4105085 -34.5907728) | 0102000020E61000000300000059C6E12769344DC0239CBB02764B41C01521D0F46D344DC09D499BAA7B4B41C0711DE38A8B344DC0E5AE6F719E4B41C0 | 220.38030316027312
   3 |  3056 |   9.240362016994661 | Billinghurst         | 102.67068907771845 | LINESTRING(-58.4088262 -34.5887756,-58.4094591 -34.5895389)                         | 0102000020E610000002000000BD5FBB6A54344DC06557B5FF5C4B41C059C6E12769344DC0239CBB02764B41C0                                 |  219.6642610744725
   4 |  3058 |   7.528021549560599 | Billinghurst         |  83.64468388400665 | LINESTRING(-58.4082723 -34.5881767,-58.4083786 -34.5882894,-58.4088262 -34.5887756) | 0102000020E6100000030000006D2E484442344DC07562C55F494B41C071B1FDBF45344DC0AFCA2A114D4B41C0BD5FBB6A54344DC06557B5FF5C4B41C0 | 222.76457174076234
   5 |  3060 |  11.546134366635505 | Billinghurst         |  128.2903818515056 | LINESTRING(-58.4074377 -34.5872488,-58.4082723 -34.5881767)                         | 0102000020E610000002000000285426EB26344DC0C04EFBF72A4B41C06D2E484442344DC07562C55F494B41C0                                 | 221.96980918986102
   6 |  3062 |  11.290663302520567 | Billinghurst         | 125.45181447245074 | LINESTRING(-58.4066142 -34.586346,-58.4067038 -34.5864442,-58.4074377 -34.5872488)  | 0102000020E6100000030000006B8B21EF0B344DC0F911BF620D4B41C05814C0DE0E344DC0E6F6819A104B41C0285426EB26344DC0C04EFBF72A4B41C0 |  222.3698873367805
   7 | 13889 | 0.38757755574084346 | Billinghurst         | 4.3064172860093715 | LINESTRING(-58.4065866 -34.5863146,-58.4066142 -34.586346)                          | 0102000020E610000002000000F4FE9A070B344DC06B15585B0C4B41C06B8B21EF0B344DC0F911BF620D4B41C0                                 | 221.31485335001545
   8 |  3064 |    9.74003930945908 | Billinghurst         | 108.22265899398978 | LINESTRING(-58.405894 -34.5855249,-58.4059909 -34.5856354,-58.4065866 -34.5863146)  | 0102000020E61000000300000042D2A755F4334DC0313FDC7AF24A41C09FFC8282F7334DC0A030CD19F64A41C0F4FE9A070B344DC06B15585B0C4B41C0 | 221.25211972628958
   9 |  3016 |  12.045759734158914 | Peña                 | 133.84177482398792 | LINESTRING(-58.4070755 -34.5848172,-58.405894 -34.5855249)                          | 0102000020E6100000020000005DC0CB0C1B344DC0B4113E4ADB4A41C042D2A755F4334DC0313FDC7AF24A41C0                                 | 120.92094844647038
  10 | 12970 |  0.2728514982527776 | Avenida Coronel Díaz |  4.547524970879627 | LINESTRING(-58.4071007 -34.5848525,-58.4070755 -34.5848172)                         | 0102000020E610000002000000E05630E01B344DC0EE3D5C72DC4A41C05DC0CB0C1B344DC0B4113E4ADB4A41C0                                 |   35.5223211191664
  11 | 12967 |  1.9671933972157942 | Avenida Coronel Díaz |  32.78655662026324 | LINESTRING(-58.4072826 -34.5851069,-58.4071007 -34.5848525)                         | 0102000020E6100000020000006C9D13D621344DC0FC146CC8E44A41C0E05630E01B344DC0EE3D5C72DC4A41C0                                 |  35.56536411216841
  12 |    -1 |                   0 |                      |                    |                                                                                     |                                                                                                                            |                   
(12 rows)

Para taxi_net

  • El mensaje ADVERTENCIA:

      SELECT *
      FROM wrk_dijkstra(
        'taxi_net',
        (SELECT wrk_NearestOSM(
            'taxi_net_vertices_pgr',
            -34.59, -58.4112)),
        (SELECT wrk_NearestOSM('taxi_net_vertices_pgr', -34.5850, -58.4077))
      )
    
  • Los resultados de la consulta:

 seq | id | seconds | name | length_m | route_readable | route_geom | azimuth 
-----+----+---------+------+----------+----------------+------------+---------
(0 rows)

Para walk_net

SELECT 11
 seq |  id   |      seconds       |         name         |      length_m      |                                                          route_readable                                                           |                                                                                         route_geom                                                                                         |      azimuth       
-----+-------+--------------------+----------------------+--------------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------
   1 |  3223 |   88.9655410372209 | Avenida Coronel Díaz |  177.9310820744418 | LINESTRING(-58.4111692 -34.5903359,-58.4103103 -34.5892882,-58.4100839 -34.5890066)                                               | 0102000020E610000003000000AE8F3D31A1344DC0CE137420904B41C021DB430C85344DC09875B5CB6D4B41C0DD8E15A17D344DC067107A91644B41C0                                                                 |  39.22973846273955
   2 | 15387 |  49.70800474611268 | Avenida Coronel Díaz |  99.41600949222536 | LINESTRING(-58.4100839 -34.5890066,-58.4098695 -34.5887219,-58.4097681 -34.5885842,-58.4095167 -34.588243)                        | 0102000020E610000004000000DD8E15A17D344DC067107A91644B41C05E10919A76344DC031783D3D5B4B41C0D738F64773344DC09EF820BA564B41C03AD5100B6B344DC0EB8CEF8B4B4B41C0                                 |  36.60486439123078
   3 | 14979 | 42.993638618130234 | Avenida Coronel Díaz |  85.98727723626047 | LINESTRING(-58.4095167 -34.588243,-58.4090454 -34.587573)                                                                         | 0102000020E6100000020000003AD5100B6B344DC0EB8CEF8B4B4B41C024CA83995B344DC09D819197354B41C0                                                                                                 | 35.123812120372406
   4 |  2595 |  64.77054196008629 | Avenida Coronel Díaz | 129.54108392017258 | LINESTRING(-58.4090454 -34.587573,-58.4083268 -34.5865678)                                                                        | 0102000020E61000000200000024CA83995B344DC09D819197354B41C0480A760D44344DC07EF156A7144B41C0                                                                                                 |  35.56031709998604
   5 |   739 | 25.642496050756172 | Avenida Coronel Díaz | 51.284992101512344 | LINESTRING(-58.4083268 -34.5865678,-58.4080424 -34.5861698)                                                                       | 0102000020E610000002000000480A760D44344DC07EF156A7144B41C0D0B0BDBB3A344DC09173AC9C074B41C0                                                                                                 |  35.54857052562149
   6 |  2685 |  38.91942297546744 | Avenida Coronel Díaz |  77.83884595093488 | LINESTRING(-58.4080424 -34.5861698,-58.4079919 -34.5860992,-58.4078273 -34.585869,-58.4076586 -34.585633,-58.4076106 -34.5855658) | 0102000020E610000005000000D0B0BDBB3A344DC09173AC9C074B41C036C41D1439344DC01B1B704C054B41C03FF559AF33344DC0C05E61C1FD4A41C0717731282E344DC0AC3AAB05F64A41C060408A952C344DC0FA53F4D1F34A41C0 |  35.56100157750908
   7 |  2575 | 1.8180273574340564 | Avenida Coronel Díaz |  3.636054714868113 | LINESTRING(-58.4076106 -34.5855658,-58.4075898 -34.5855379)                                                                       | 0102000020E61000000200000060408A952C344DC0FA53F4D1F34A41C072970EE72B344DC0C588E9E7F24A41C0                                                                                                 | 36.705255057193085
   8 | 13887 | 3.6318937316413344 | Avenida Coronel Díaz |  7.263787463282669 | LINESTRING(-58.4075898 -34.5855379,-58.4075502 -34.5854812)                                                                       | 0102000020E61000000200000072970EE72B344DC0C588E9E7F24A41C0383DDE9A2A344DC01F36470CF14A41C0                                                                                                 |  34.93093729605471
   9 |  8176 | 3.1044670414183297 | Avenida Coronel Díaz | 6.2089340828366595 | LINESTRING(-58.4075502 -34.5854812,-58.4075158 -34.585433)                                                                        | 0102000020E610000002000000383DDE9A2A344DC01F36470CF14A41C038CD4C7A29344DC0E57FF277EF4A41C0                                                                                                 |  35.51518240094338
  10 | 16480 | 22.670707317300863 |                      | 45.341414634601726 | LINESTRING(-58.4075158 -34.585433,-58.4077448 -34.5850708)                                                                        | 0102000020E61000000200000038CD4C7A29344DC0E57FF277EF4A41C09A8E4AFB30344DC01AEC9799E34A41C0                                                                                                 | 327.69698641844263
  11 |    -1 |                  0 |                      |                    |                                                                                                                                   |                                                                                                                                                                                            |                   
(11 rows)