Dear community,
I have a web application for which i try to add the functionality that when a user clicks on a layer’s feature, a table is shown with all the features (and their attributes) that at least (partially) overlap with the clicked feature. Because I also want to generate derived attributes like (the intersection geometry and area) I could not do it with the standard spatial filters.
My workflow:
I created a function in my postgis database that looks like this:
RETURNS TABLE (
uvid TEXT,
area TEXT,
geom GEOMETRY
)
AS
$$
SELECT i.uvid, ST_Area(ST_Intersection(i.geom, ST_GeomFromText(input_wkt, 28992))), ST_Intersection(i.geom, ST_GeomFromText(input_wkt, 28992))
FROM igg AS i
WHERE ST_Intersects(i.geom, ST_GeomFromText(input_wkt, 28992))
AND NOT ST_Touches(i.geom, ST_GeomFromText(input_wkt, 28992));
$$
LANGUAGE sql STABLE;
Then I configured a new SQL view in geoserver like this:
Then every time a user clicks on a geometry a XML with the following body structure is send as POST request to the geoserver:
GEOMETRYCOLLECTION(POLYGON((78077.559 445573.532\,78101.101 445559.521\,78136.715 445592.072\,78197.798 445526.365\,78199.87 445524.136\,78222.128 445500.193\,78250.382 445536.042\,78344.959 445461.86\,78384.347 445513.107\,78399.467 445532.778\,78412.936 445523.11\,78459.899 445489.399\,78460.453 445488.967\,78511.231 445449.41\,78517.135 445445.068\,78524.238 445440.276\,78528.59 445437.881\,78536.742 445433.641\,78539.915 445432.224\,78543.443 445430.648\,78546.493 445430.201\,78569.695 445417.808\,78576.102 445414.386\,78607.457 445400.871\,78611.408 445399.275\,78618.757 445397.334\,78642.359 445388.76\,78725.019 445356.754\,78737.972 445350.918\,78746.773 445347.079\,78751.424 445345.834\,78753.573 445345.536\,78756.924 445343.74\,78757.101 445344.11\,78869.906 445290.407\,78973.924 445240.888\,78973.294 445174.151\,78972.655 445106.504\,78972.381 445077.512\,78973.068 445045.052\,78973.18 445039.758\,79010.765 445039.559\,79039.061 444975\,79052.889 444973.762\,79074.232 444937.574\,79081 444937\,79105 444905\,79090.533 444880.432\,79111.661 444855.717\,79112.815 444854.368\,79124.61 444840.432\,79117.065 444827.909\,79116.79 444827.057\,79116.585 444826.186\,79116.452 444825.301\,79116.392 444824.408\,79116.404 444823.513\,79116.489 444822.622\,79116.646 444821.741\,79116.875 444820.875\,79117.173 444820.031\,79117.539 444819.214\,79117.97 444818.43\,79118.463 444817.683\,79121.263 444814.839\,79124.064 444811.994\,79134.678 444803.464\,79135.244 444803.112\,79135.841 444802.816\,79136.463 444802.578\,79137.106 444802.401\,79137.762 444802.285\,79138.426 444802.232\,79139.093 444802.243\,79139.755 444802.316\,79140.407 444802.453\,79148.325 444794.645\,79148.246 444793.864\,79148.127 444792.696\,79148.329 444790.796\,79149.03 444789.247\,79151.811 444786.195\,79166.401 444770.187\,79168.383 444768.013\,79169.063 444767.267\,79173.742 444762.302\,79176.69 444759.383\,79180.681 444755.499\,79182.155 444754.052\,79183.274 444753.139\,79185.586 444751.058\,79188.611 444748.52\,79193.032 444744.738\,79196.387 444741.895\,79199.259 444739.51\,79207.987 444731.192\,79208.511 444730.651\,79211.942 444727.378\,79214.866 444724.154\,79217.229 444721.768\,79220.331 444718.569\,79221.474 444717.427\,79224.787 444713.362\,79241.629 444724.557\,79281.843 444786.145\,79284.466 444790.24\,79289.49 444798.22\,79295.453 444807.393\,79298.345 444811.916\,79301.999 444817.353\,79309.306 444828.636\,79312.58 444833.592\,79315.42 444838.191\,79316.74 444840.401\,79323.636 444851.773\,79386.155 444953.883\,79387.957 444956.932\,79393.588 444966.131\,79395.669 444969.637\,79397.267 444972.179\,79398.46 444974.262\,79399.272 444975.609\,79400.008 444976.803\,79400.718 444978.048\,79401.657 444979.878\,79402.672 444981.554\,79404.244 444983.867\,79405.259 444985.239\,79406.249 444986.79\,79409.801 444992.253\,79418.393 445006.218\,79420.54 445009.705\,79425.481 445017.681\,79462.003 445076.75\,79467.247 445085.231\,79479.984 445084.054\,79507.578 445080.081\,79521.479 445075.499\,79528.181 445072.657\,79534.882 445069.514\,79545.686 445062.827\,79549.739 445059.732\,79554.695 445053.489\,79559.002 445046.894\,79563.362 445037.051\,79566.12 445029.705\,79568.383 445019.358\,79570.592 445011.862\,79573.098 445006.465\,79575.951 445002.919\,79580.555 444998.575\,79594.363 444987.891\,79601.82 444980.101\,79608.179 444971.859\,79615.538 444961.768\,79622.7 444950.477\,79630.164 444937.538\,79637.177 444925.047\,79640.234 444918.452\,79644.341 444909.048\,79646.92 444902.322\,79647.78 444899.291\,79648.937 444895.341\,79649.934 444891.401\,79650.825 444887.065\,79667.852 444809.694\,79693.434 444696.436\,79710.926 444618.547\,79717.229 444590.483\,79742.959 444474.899\,79757.687 444408.345\,79757.75 444408.059\,79764.423 444409.782\,79771.3 444411.558\,79778.07 444413.305\,79825.194 444425.471\,79854.095 444433.156\,79937.799 444454.745\,79991.304 444468.191\,80001.564 444470.77\,80014.001 444474.012\,80014.913 444467.867\,80015.103 444467.102\,80015.783 444463.787\,80016.717 444458.996\,80017.908 444452.878\,80019.284 444447.214\,80020.759 444441.321\,80021.907 444436.615\,80022.2 444435.313\,80022.79 444432.369\,80023.378 444429.615\,80024.008 444426.378\,80025.805 444417.074\,80027.231 444409.835\,80028.319 444404.825\,80028.549 444403.767\,80030.399 444394.589\,80031.908 444387.755\,80033.172 444381.458\,80034.402 444375.714\,80034.63 444374.65\,80035.769 444368.432\,80037.089 444362.49\,80038.517 444355.378\,80039.522 444350.255\,80041.053 444343.191\,80041.654 444339.751\,80041.917 444338.857\,80042.382 444337.757\,80042.898 444336.757\,80043.385 444335.555\,80043.62 444334.408\,80043.75 444333.11\,80043.817 444332.423\,80045.657 444333.109\,80047.689 444323.183\,80056.782 444278.77\,80058.69 444269.449\,80078 444280\,80204.279 444305.076\,80219 444308\,80227 444305\,80233 444300\,80254 444202\,80257 444198\,80260 444194\,80301 444174\,80306 444173\,80312 444173\,80428 444202\,80435 444201\,80447.221 444192.271\,80471.733 444126.129\,80473.316 444121.859\,80479.829 444113.267\,80507.6624 444076.5509\,80517.045 444064.174\,80518.062 444062.831\,80524 444055\,80515.789 444049.174\,80512.44 444046.798\,80507.981 444043.635\,80507.574 444043.346\,80504.496 444041.162\,80501.283 444038.883\,80496.062 444035.18\,80492.5711 444032.7037\,80485.206 444027.479\,80479.571 444023.481\,80457.677 444007.95\,80414.587 443977.382\,80407 443972\,80363 443929\,80361.387 443927.739\,80227.499 443823.021\,80225.336 443821.33\,80221.923 443818.661\,80184 443789\,80163 443783\,80125.579 443788.567\,80121.77 443789.134\,80042 443801\,80028 443799\,79868.573 443674.941\,79866.378 443673.233\,79684.365 443531.598\,79493.125 443382.783\,79487.431 443378.352\,79442 443343\,79559.782 443180.441\,79563 443176\,79407.09 443062.228\,79405.477 443061.051\,79297.209 442982.044\,79267 442960\,79264.137 442963.657\,79259.231 442969.921\,79257.647 442971.943\,79249.345 442982.544\,79202 443043\,79091.619 442962.808\,79089.076 442960.961\,79086.479 442959.074\,79076.1962 442951.6041\,78967.444 443102.607\,78946.477 443131.741\,78941.44 443138.74\,78928.877 443129.425\,78791.711 443027.721\,78655.176 443212.136\,78661.366 443216.721\,78628.212 443261.549\,78618.509 443274.927\,78617 443277\,78617 443282\,78558 443361\,78555.68 443359.452\,78552 443357\,78475.293 443383.929\,78472.386 443384.949\,78458 443390\,78410.823 443273.801\,78406.573 443263.334\,78366.92 443165.665\,78367 443148\,78371.638 443129.163\,78393.651 443039.779\,78400 443014\,78395.846 443011.448\,78330 442971\,78424 442817\,78441 442803\,78446.919 442793.427\,78448.44 442790.967\,78564.897 442602.608\,78655.525 442456.03\,78654.578 442455.435\,78665.943 442438.155\,78669.123 442434.036\,78671 442431\,78667.96 442428.973\,78650 442417\,78592.028 442397.364\,78588 442396\,78510.814 442348.94\,78377.095 442267.412\,78368.555 442262.205\,78365.865 442260.565\,78298.276 442219.356\,78293.591 442216.499\,78227.623 442176.279\,78189.455 442153.008\,78183.648 442149.468\,78023.243 442051.669\,77963.856 442015.461\,77935.39 441998.105\,77929.403 441994.455\,77857.819 441950.811\,77782.006 441904.588\,77781.349 441904.187\,77775.216 441900.448\,77771.528 441898.199\,77763 441893\,77700 441909\,77685 441909\,77485 441795\,77450 441782\,77414.189 441774.838\,77405 441773\,77328.39 441761.153\,77308 441758\,77258 441752\,77208 441750\,77155 441755\,77103.367 441763.98\,77086 441767\,77058.893 441751.361\,77054.286 441748.703\,77049.469 441745.924\,77038.241 441739.446\,77038.007 441739.311\,77030.498 441734.979\,77029.554 441734.429\,77029.113 441734.172\,77019.353 441728.483\,77016.355 441733.47\,77014.485 441736.581\,77014.348 441736.809\,77000.977 441731.748\,76960.025 441716.247\,76958.781 441715.73\,76957.57 441715.226\,76937.552 441707.076\,76916.808 441696.129\,76915.816 441695.632\,76915.467 441695.457\,76853.745 441663.697\,76851.505 441662.544\,76706.997 441588.186\,76686.986 441577.889\,76669.602 441568.944\,76657.863 441562.903\,76655.059 441568.357\,76654.976 441568.518\,76620.804 441550.96\,76553.148 441516.198\,76522.573 441500.489\,76520.709 441499.532\,76513.861 441512.86\,76513.839 441512.903\,76513.64 441512.801\,76481.095 441496.08\,76429.876 441469.764\,76370.684 441439.351\,76366.48 441447.533\,76365.954 441448.558\,76361.12 441446.426\,76317.042 441426.981\,76316.542 441426.76\,76289.387 441414.781\,76289.353 441414.766\,76241.693 441393.742\,76241.385 441393.606\,76157.367 441356.576\,76115.652 441335.105\,75986.705 441283.802\,75967.303 441275.803\,75953.657 441270.085\,75952.847 441269.816\,75952.062 441269.483\,75951.306 441269.088\,75950.584 441268.633\,75949.902 441268.122\,75949.262 441267.558\,75948.67 441266.943\,75948.129 441266.284\,75947.644 441265.582\,75947.216 441264.844\,75946.849 441264.074\,75946.545 441263.277\,75946.306 441262.458\,75946.134 441261.623\,75946.03 441260.776\,75945.994 441259.924\,75957.735 441237.39\,75957.068 441237.112\,75954.803 441236.168\,75944.001 441231.667\,75942.302 441230.959\,75940 441230\,75903 441244\,75877.634 441233.853\,75876.432 441233.372\,75814.548 441208.619\,75810.617 441207.047\,75724.2142 441172.4853\,75695.1689 441194.9341\,75675.6119 441234.0041\,75672.0499 441241.1191\,75667.5509 441248.3971\,75666.2049 441250.5151\,75664.8739 441252.6411\,75663.5549 441254.7761\,75662.2519 441256.9181\,75660.9599 441259.0691\,75659.6819 441261.2291\,75658.4179 441263.3961\,75657.1669 441265.5711\,75655.9299 441267.7541\,75654.7069 441269.9451\,75653.4979 441272.1421\,75652.3019 441274.3481\,75651.1199 441276.5621\,75649.9519 441278.7831\,75648.7989 441281.0111\,75647.6589 441283.2461\,75646.5329 441285.4881\,75645.4219 441287.7381\,75644.3249 441289.9931\,75643.2409 441292.2561\,75642.1719 441294.5261\,75641.1169 441296.8031\,75640.0769 441299.0861\,75639.0509 441301.3761\,75638.0389 441303.6721\,75637.0409 441305.9731\,75636.0589 441308.2821\,75635.0899 441310.5961\,75634.1359 441312.9171\,75633.197 441315.2441\,75632.273 441317.5761\,75631.363 441319.9151\,75630.468 441322.2591\,75629.587 441324.6071\,75628.721 441326.9621\,75627.871 441329.3231\,75627.035 441331.6881\,75626.214 441334.0591\,75625.408 441336.4351\,75624.617 441338.8171\,75606.715 441395.7671\,75605.379 441400.0171\,75603.657 441405.2591\,75602.621 441408.4131\,75554.121 441556.0811\,75546.232 441582.3241\,75542.595 441595.2191\,75541.789 441598.3741\,75540.969 441601.5251\,75540.134 441604.6721\,75539.284 441607.8151\,75538.42 441610.9541\,75537.54 441614.0891\,75536.646 441617.2201\,75535.737 441620.3461\,75534.813 441623.4691\,75533.874 441626.5861\,75532.92 441629.6991\,75531.952 441632.8081\,75530.969 441635.9121\,75529.972 441639.0121\,75528.959 441642.1071\,75527.933 441645.1961\,75526.892 441648.2811\,75525.836 441651.3611\,75524.765 441654.4361\,75523.68 441657.5061\,75522.581 441660.5701\,75521.466 441663.6301\,75520.338 441666.6841\,75519.195 441669.7331\,75518.037 441672.7771\,75516.8659 441675.8151\,75515.6089 441678.8101\,75514.3399 441681.8001\,75513.0559 441684.7851\,75511.7589 441687.7641\,75510.4499 441690.7371\,75509.1249 441693.7031\,75507.7879 441696.6641\,75506.4359 441699.6181\,75505.0709 441702.5671\,75503.6929 441705.5091\,75502.3019 441708.4451\,75500.8969 441711.3741\,75499.4599 441714.3331\,75498.0089 441717.2851\,75496.5449 441720.2311\,75495.0679 441723.1701\,75493.5779 441726.1021\,75492.0729 441729.0271\,75490.5549 441731.9451\,75489.0239 441734.8571\,75432.1423 441783.1727\,75408.7599 441825.3484\,75387.1257 441860.7498\,75355.0022 441909.0444\,75322.3929 441958.1073\,75315.132 441969.0319\,75272.1615 442035.9165\,75228.3244 442106.108\,75177.3395 442190.0704\,75096.8445 442324.6322\,75025.6835 442436.6259\,74904.7099 442629.9465\,74734.8682 442908.5085\,74713.0366 442944.3153\,74638.7036 443066.2309\,74615.3221 443106.8943\,74597.5448 443141.7527\,74580.0978 443188.4975\,74573.5413 443209.8221\,74563.7218 443255.8597\,74554.1046 443323.0229\,74555.7519 443384.1033\,74565.7877 443422.1518\,74599.4822 443549.896\,74624.431 443577.5191\,74628.404 443589.3701\,74633.76 443605.3451\,74655.486 443669.8631\,74666.683 443703.1161\,74703.18 443811.5031\,74706.362 443820.952\,74713.7989 443824.7751\,74737.5119 443837.1961\,74772.0339 443854.6221\,74825.6179 443881.7461\,74908.8149 443924.0661\,74916.0869 443926.4261\,74926.8849 443929.9321\,74954.6679 443939.1421\,74997.4209 443953.7061\,75036.6659 443967.0461\,75062.8229 443976.4821\,75090.8679 443986.4641\,75107.4069 443993.1161\,75123.4999 444000.9411\,75132.7449 444005.6471\,75137.4299 444008.3111\,75148.6799 444014.7691\,75170.6349 444029.3731\,75188.8339 444042.7341\,75210.1049 444058.3781\,75224.3009 444069.0461\,75247.0039 444086.2431\,75260.8159 444096.8981\,75272.4429 444105.6481\,75281.5209 444112.6751\,75286.9539 444116.3781\,75293.5749 444120.9591\,75300.7919 444125.5481\,75307.0519 444129.4091\,75315.0109 444133.9211\,75320.112 444136.6591\,75318.0719 444142.6121\,75325.3279 444146.8511\,75333.2279 444150.7651\,75352.8259 444159.8661\,75362.3609 444163.8591\,75374.3599 444168.9061\,75406.2979 444182.2811\,75437.0069 444194.9341\,75463.7009 444205.9931\,75477.4209 444211.5051\,75490.3759 444216.8011\,75502.8469 444221.5781\,75514.3019 444224.6861\,75519.0799 444225.6501\,75525.1399 444226.2571\,75531.3839 444226.6211\,75540.9439 444227.0781\,75548.6099 444227.3841\,75554.9559 444227.8721\,75561.6969 444228.4021\,75566.2529 444229.1941\,75568.2659 444229.3931\,75575.2159 444230.7771\,75581.5559 444232.3151\,75587.2089 444233.6551\,75591.8429 444234.8001\,75599.7929 444237.7811\,75605.5719 444239.7751\,75609.4379 444241.2721\,75615.8629 444244.0691\,75624.0499 444248.0541\,75635.5859 444255.2021\,75639.2379 444257.4731\,75651.6299 444265.9931\,75660.6249 444272.0491\,75663.8559 444274.3461\,75686.5939 444290.2031\,75695.7419 444296.5381\,75730.9969 444321.2361\,75750.2989 444334.7861\,75755.0769 444338.2471\,75797.9809 444367.9951\,75847.9263 444402.5029\,75884.7809 444427.9661\,76047.8699 444540.7391\,76075.0136 444559.6106\,76149.9129 444611.6841\,76251.9399 444682.4061\,76363.4109 444758.8571\,76448.3129 444817.2931\,76492.4379 444847.5131\,76559.1329 444893.6181\,76632.1039 444943.6041\,76656.2874 444960.2572\,76663.4655 444965.2001\,76675.5009 444973.4879\,76727.5616 445009.3376\,76751.8459 445026.0601\,76758.0404 445030.3257\,76827.0899 445077.8741\,76829.812 445097.7791\,76914.4355 445120.4378\,76942.2949 445142.5461\,76953.4149 445150.5591\,76993.0689 445174.2031\,77036.0639 445199.8211\,77039.3819 445201.8501\,77042.4019 445204.0811\,77045.1749 445206.1921\,77048.0689 445208.8491\,77051.2889 445212.1671\,77053.9069 445215.6551\,77056.3609 445219.6041\,77059.2569 445225.1741\,77062.1619 445232.4141\,77068.7389 445248.9151\,77075.1129 445263.2281\,77078.5339 445269.4521\,77080.5939 445273.0031\,77082.7759 445276.2371\,77085.1429 445279.3351\,77087.9689 445282.6351\,77096.8189 445291.4761\,77101.3289 445296.3671\,77109.1899 445305.6281\,77112.7789 445310.6011\,77115.5849 445315.0871\,77117.7739 445317.7641\,77122.6659 445323.3761\,77125.2279 445326.1601\,77128.2159 445328.6601\,77131.0309 445330.6991\,77135.1929 445332.7511\,77138.7419 445334.0901\,77142.2649 445335.2131\,77146.0039 445335.9671\,77167.4289 445338.3621\,77172.1939 445339.1111\,77176.7779 445340.2311\,77179.6209 445341.2851\,77183.3979 445342.7251\,77189.4659 445345.5521\,77199.5949 445352.8531\,77216.6009 445366.3271\,77236.6999 445382.7551\,77239.9169 445385.0501\,77245.8529 445388.3381\,77253.2619 445390.5271\,77258.1619 445391.4651\,77278.0339 445392.4891\,77282.2939 445394.8311\,77293.7069 445401.1691\,77303.2839 445409.6731\,77322.3349 445426.7601\,77341.7609 445442.0931\,77380.8629 445471.2101\,77391.0429 445478.6171\,77433.3399 445505.4961\,77466.7559 445527.3911\,77491.8959 445544.9191\,77497.6619 445548.9661\,77509.1409 445559.5921\,77523.7959 445571.5771\,77551.1859 445591.4631\,77560.2579 445598.0991\,77572.1389 445607.1971\,77577.5669 445611.1401\,77604.1899 445632.0431\,77606.8789 445633.8341\,77651.6679 445663.2141\,77717.0889 445708.9161\,77750.1489 445726.4791\,77774.6019 445744.3971\,77793.4649 445756.6301\,77818.2509 445772.9341\,77832.3019 445781.9101\,77868.5099 445809.5311\,77883.6289 445821.1291\,77900.9489 445833.3421\,77903.9326 445835.5527\,77945.336 445866.228\,77945.5171 445866.3108\,77946.5588 445866.787\,77947.8827 445867.3922\,77947.8885 445867.3867\,77947.886 445867.385\,77951.425 445864.037\,77960.467 445855.484\,77964.949 445846.777\,77965.646 445845.423\,77965.69 445845.338\,78007.99 445763.172\,78040.341 445698.199\,78054.929 445667.429\,78081.87 445614.691\,78054.413 445590.557\,78054.106 445589.466\,78054.196 445588.011\,78055.983 445586.374\,78057.992 445585.178\,78077.559 445573.532)));srid:28992"
I added backslashes to escape all the ‘,‘ in the wkt geometry as was described in the user manual.
As long as the XML body remains relatively small it works well. But as soon as the xml body reaches around 8000 characters due to a more complex geometry. I obtain the following error in the request response:
<?xml version="1.0" encoding="UTF-8"?>ows:ExceptionTextcom.ctc.wstx.exc.WstxEOFException: Unexpected EOF in attribute value at [row,col {unknown-source}]: [5,8081]Unexpected EOF in attribute valueat [row,col {unknown-source}]: [5,8081]It looks like the xml body is being cut off somewhere. I think that it is a bug, so could this be resolved? If anyone knows a work around I would also be happy to hear about it.
Sincerely Valentin
