Opened 6 years ago

Closed 6 years ago

#4289 closed defect (fixed)

A multipolygon is inverted in ST_AsMVTGeom in some cases

Reported by: ajolma Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.4.7
Component: postgis Version: master
Keywords: vector tile Cc:

Description

A complex multipolygon is inverted (areas in the tile not in the multipolygon become multipolygon and vice versa) when preparing a tile.

The problematic multipolygon is attached.

I'm using the command

SELECT ST_AsMVTGeom(ST_Transform(problem.geom, 3857), TileBBox(12, 2358, 1093, 3857), 256, 10, TRUE) geom
INTO test
FROM problem
WHERE ST_Intersects(TileBBox(12, 2358, 1093, 3857), problem.geom)

TileBBox is a function

create or replace function TileBBox (z int, x int, y int, srid int = 3857)
    returns geometry
    language plpgsql immutable as
$func$
declare
    max numeric := 20037508.34;
    res numeric := (max*2)/(2^z);
    bbox geometry;
begin
    bbox := ST_MakeEnvelope(
        -max + (x * res),
        max - (y * res),
        -max + (x * res) + res,
        max - (y * res) - res,
        3857
    );
    if srid = 3857 then
        return bbox;
    else
        return ST_Transform(bbox, srid);
    end if;
end;
$func$;

PostGIS is https://postgis.net/stuff/postgis-3.0.0dev.tar.gz downloaded today.

Attachments (2)

problem-table.sql (1.1 MB ) - added by ajolma 6 years ago.
mvt_bug.png (21.4 KB ) - added by Algunenano 6 years ago.
MVT output

Download all attachments as: .zip

Change History (16)

by ajolma, 6 years ago

Attachment: problem-table.sql added

comment:1 by Algunenano, 6 years ago

Can you make sure you are using that dev release and also the latest GEOS?

I'm getting correct results:

crap=# Select postgis_full_version();
NOTICE:  Function postgis_gdal_version() not found.  Is raster support enabled and rtpostgis.sql installed?
NOTICE:  Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?
NOTICE:  Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?
                                                                                                                 postgis_full_version                                                                                                                 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="3.0.0dev r17118" [EXTENSION] PGSQL="110" GEOS="3.8.0dev-CAPI-1.12.0 d037cb23" SFCGAL="1.3.6" PROJ="Rel. 5.2.0, September 15th, 2018" LIBXML="2.9.8" LIBJSON="0.13.1" LIBPROTOBUF="1.3.1" (sfcgal procs from "3.0.0dev r17113" need upgrade)
(1 row)

crap=#           SELECT ST_AsText(ST_AsMVTGeom(ST_Transform(problem.geom, 3857), TileBBox(12, 2358, 1093, 3857), 256, 10, TRUE)) geom
FROM problem
WHERE ST_Intersects(TileBBox(12, 2358, 1093, 3857), problem.geom);
                                                                                                     geom                                                                                                      
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MULTIPOLYGON(((217 220,253 198,249 166,266 163,266 254,256 262,255 257,254 255,253 250,249 246,247 241,243 236,242 235,241 236,239 236,238 233,217 220)),((158 225,177 202,194 216,172 242,166 241,158 225)))
(1 row)

Can you share also the output for this query (the one with ST_AsText), please?

comment:2 by ajolma, 6 years ago

I'm sorry, the SELECT was wrong, it should be

SELECT ST_AsMVTGeom(
  ST_Transform(problem.geom, 3857),
    TileBBox(11, 1180, 547, 3857), 256, 10, TRUE)
INTO test
FROM problem
WHERE ST_Intersects(TileBBox(11, 1180, 547, 3857), problem.geom);

and I just upgraded my GEOS:

POSTGIS="3.0.0dev r17126" [EXTENSION] PGSQL="100" 
GEOS="3.8.0dev-CAPI-1.11.0 83b5ecf" 
PROJ="Rel. 4.9.3, 15 August 2016" 
LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1"

comment:3 by ajolma, 6 years ago

The result:

MULTIPOLYGON(((-10 -10,2 -10,266 -10,266 101,266 102,266 266,-10 266,-10 135,-10 134,-10 124,-10 123,-10 37,-10 35,-10 34,-10 32,-10 -1,-10 -10),(-10 37,-5 38,-4 36,-6 35,-8 36,-9 37,-10 37),(-6 35,-2 36,4 35,2 26,0 28,-1 30,-2 32,-3 35,-3.8 34.6,-5 34,-5.33333333333333 34.3333333333333,-6 35),(262.111111111111 102.555555555556,260.4 102.8,261 103,262.111111111111 102.555555555556),(260.4 102.8,258 102,251 97,245.157894736842 95.0526315789474,246 96,250 97,259 103,260.4 102.8),(245.157894736842 95.0526315789474,238 87,245 95,245.157894736842 95.0526315789474),(238 87,233 87,232 84,232 87,234 88,238 87),(232 84,232 83,231.5 82.5,232 84),(231.5 82.5,231 81,229 79,224.333333333333 76.6666666666667,229 80,231.5 82.5),(224.333333333333 76.6666666666667,222 75,221 75,224.333333333333 76.6666666666667),(75 148,78 149,81 148,83 148,81 147,78 148,75 148),(83 148,87 151,84 148,83 148),(87 151,89 155,90 155,89 154,87 151),(90 155,96 155,99 156,100 158,100 161,110 161,103 160,105 146,92 144,90 155),(217 81,219 80,220 78,219 76,219 78,217 81),(219 76,220 75,219 75,219 76),(217 81,213 80,212 79,208 81,140 92,127 89,104 106,127 88,141 91,207 81,207 79,208 79,207 74,201 66,193 69,174 69,168 73,166 81,144 84,145 80,143 81,143 79,142 76,144 73,142 70,134 63,135 59,125 49,116 60,105 63,100 61,95 66,94 64,91 53,78 67,72 67,70 71,87 78,104 86,103 88,103 86,90 80,89 83,84 85,79 82,83 77,42 60,70 72,66 81,77 85,73 89,67 97,67 106,64 110,66 112,69 126,79 134,86 114,80 134,107 131,127 140,125 153,125 154,129 152,136 152,139 155,142 154,146 150,150 149,152 146,157 144,157 143,154 141,153 137,157 133,158 130,162 130,163 128,165 128,168 128,173 130,174 128,174 124,175 122,178 122,176 125,177 126,180 125,183 126,183 125,182 123,182 121,184 120,185 122,186 123,190 121,195 117,196 115,192 108,193 102,195 99,197 101,200 101,203 102,207 99,207 96,204 89,209 85,211 81,217 81),(42 60,38 60,42 61,42 60),(17 141,15 149,18 149,18 150,22 150,24 149,25 151,25 153,27 155,29 157,30 157,33 153,41 148,34 129,53 137,55 128,22 120,17 141),(30 157,33.8 157,34 156,30 157),(33.8 157,33 161,34 157,33.8 157),(33 161,37 166,39 167,41 164,40 164,39 166,38 166,33 161),(41 164,45 167,45 166,42 164,41 164),(44 181,44 182,50 187,50 189,52 190,51 189,51 187,48 184,45 182,44 181),(52 190,62 191,63.5 191.75,63 191,52 190),(63.5 191.75,64.3333333333333 193,64 192,63.5 191.75),(64.3333333333333 193,65 195,66 194,67 191,66 193,65 194,64.3333333333333 193),(67 191,68 191,69 189,67 191),(67 187,67 185,72 182,75 179,75.82 174.9,67 170,56 176,57 182,75 177,71 182,66 185,66 186,67 187),(75.82 174.9,76 175,76 174,75.82 174.9),(76 174,79 172,78 169,78 172,76 173,76 174),(78 169,74 164,72 162,73 157,71 162,78 169),(1 138,2 141,7 144,3 141,1 138),(7 144,7 146,9 147,8 146,7 144),(116 160,119 159,121 156,119 158,116 160),(39 59,42 59,40 56,42 49,44 50,46 45,43 44,39 59),(-4 135,-3 135,-1 135,-3 134,-4 135),(12 146,12 147,11 148,13 147,12 146),(184 52,182 52,183 54,187 52,186 50,184 52)),((120 81,119 87,105 83,105 79,109 78,119 80,120 81)),((86 114,85 114,85 112,87 112,87 111,88 107,85 104,86 102,89 105,103 88,91 103,88 110,88 112,92 111,104 106,93 111,88 113,86 114)))

by Algunenano, 6 years ago

Attachment: mvt_bug.png added

MVT output

comment:4 by Algunenano, 6 years ago

This comes from the issues that geos has clipping geometries using the fast and dirty lwgeom_clip_by_rect, and although I made an attempt to fix it in https://github.com/postgis/postgis/commit/35db4ea0c0b02b15090f1e916c8fdb8ff6c5cc22 (done for #4183) it doesn't work for this polygon.

Coincidentally, as part of https://github.com/postgis/postgis/pull/356 I decided to switch the function order and clip the geometry after transforming it into mvt coordinates (instead of before). This should make it more robust but it still won't be bulletproof; the underlying problems in GEOS will still be there, but I don't think they will pop as often as there won't be points as close to each other after snapping them to the grid.

You can see the current output and the output with the change in the mvt_bug.png image attached above. I guess that change is interesting for older releases, so I'll try to separate it from the introduction of the alternative library (for clipping and validation) and backport it to 2.4 and 2.5.

comment:5 by Algunenano, 6 years ago

Note: mvt_bug.png shows brown for current (invalid) output and green for new (and valid).

comment:6 by Algunenano, 6 years ago

Another side note: the current output also shows another bug I saw recently (and addressed in that PR), which is the polygon having float values (31 81,229 79,224.333333333333 76.6666666666667,229 80,231.5 82.5)).

This has an even harder solution since the quick way, which is snapping to grid after validation, means that the polygon could be invalid again so you'd have to redo the make_valid call -> grid -> valid -> grid... This doesn't happen with wagyu (which only works with ints), but the default GEOS based solution would require a major effort to solve this.

comment:7 by Algunenano, 6 years ago

Owner: changed from pramsey to Algunenano

comment:8 by Algunenano, 6 years ago

Milestone: PostGIS 2.4.7

comment:9 by ajolma, 6 years ago

Just to note that I've been testing Geoserver for this dataset too and its vector tiler (java-vector-tile, after upgrading to 1.3.4) does not have problem with this multipolygon. java-vector-tile uses JTS. Its result is:

MULTIPOLYGON (((4096.0 2481.66666666667,4094 2483,4088 2487,4077 2493,4062 2501,4051 2508,4043 2513,4032 2522,4029 2524,4025 2527,4014 2532,4005 2538,4000 2541,3997 2542,3992 2544,3986 2546,3983 2546,3980 2547,3963 2548,3959 2548,3956 2548,3951 2550,3947 2551,3942 2553,3935 2557,3931 2559,3926 2562,3922 2566,3919 2569,3908 2580,3903 2585,3900 2591,3890 2609,3887 2614,3883 2620,3879 2625,3876 2628,3851 2653,3844 2660,3827 2682,3814 2696,3809 2700,3807 2702,3804 2703,3802 2704,3800 2704,3794 2703,3785 2701,3779 2700,3765 2694,3760 2692,3752 2690,3744 2689,3739 2689,3735 2690,3723 2695,3719 2697,3716 2699,3714 2702,3710 2707,3709 2710,3707 2713,3706 2718,3706 2721,3706 2732,3706 2741,3706 2745,3707 2750,3710 2756,3711 2759,3711 2761,3710 2765,3707 2776,3705 2781,3703 2786,3701 2789,3698 2792,3690 2799,3679 2811,3675 2815,3672 2817,3666 2821,3661 2824,3646 2831,3603 2850,3597 2853,3593 2855,3586 2861,3574 2871,3561 2883,3558 2886,3554 2888,3550 2891,3546 2893,3543 2894,3537 2895,3533 2895,3529 2895,3526 2895,3522 2894,3518 2893,3515 2891,3514 2890,3512 2889,3511 2887,3510 2886,3509 2883,3508 2881,3508 2878,3508 2875,3508 2873,3509 2871,3509 2869,3513 2863,3514 2861,3515 2858,3515 2856,3515 2854,3514 2850,3512 2845,3510 2841,3507 2834,3505 2831,3502 2827,3499 2824,3497 2822,3487 2814,3482 2810,3479 2808,3477 2807,3474 2806,3466 2804,3462 2803,3459 2803,3452 2804,3443 2806,3436 2807,3426 2810,3423 2811,3419 2811,3413 2811,3396 2808,3393 2808,3388 2806,3382 2804,3381 2803,3378 2801,3375 2798,3372 2795,3369 2789,3366 2784,3360 2772,3355 2762,3352 2757,3347 2748,3340 2736,3339 2733,3335 2729,3326 2722,3315 2711,3307 2704,3298 2697,3291 2690,3288 2687,3283 2683,3274 2676,3272 2673,3271 2672,3271 2670,3271 2668,3272 2666,3284 2636,3295 2605,3297 2600,3311 2571,3315 2564,3316 2561,3317 2558,3318 2554,3318 2550,3318 2526,3318 2517,3318 2515,3317 2513,3315 2510,3313 2508,3309 2505,3307 2504,3304 2503,3300 2501,3288 2500,3284 2499,3282 2497,3279 2495,3275 2492,3265 2482,3260 2479,3257 2476,3252 2473,3247 2471,3245 2471,3243 2471,3241 2472,3236 2476,3234 2477,3231 2478,3228 2479,3220 2480,3218 2481,3210 2484,3208 2485,3206 2486,3203 2486,3200 2486,3199 2485,3191 2481,3188 2480,3185 2480,3181 2480,3162 2484,3157 2485,3152 2486,3150 2488,3148 2489,3146 2491,3137 2501,3134 2503,3132 2504,3130 2505,3126 2506,3120 2507,3115 2507,3112 2506,3110 2504,3108 2501,3106 2498,3104 2495,3103 2492,3102 2486,3102 2483,3101 2481,3100 2479,3096 2476,3088 2469,3085 2466,3083 2463,3081 2459,3080 2455,3079 2452,3079 2448,3080 2445,3081 2442,3085 2434,3086 2432,3087 2429,3087 2425,3086 2417,3084 2409,3082 2404,3076 2392,3075 2388,3074 2383,3074 2378,3075 2375,3076 2373,3081 2362,3084 2358,3086 2354,3088 2352,3095 2346,3097 2344,3099 2341,3101 2336,3107 2323,3108 2320,3114 2297,3116 2289,3117 2286,3119 2283,3124 2276,3126 2273,3127 2272,3129 2264,3133 2254,3134 2251,3135 2248,3135 2245,3135 2243,3134 2241,3132 2237,3126 2226,3124 2222,3121 2220,3119 2217,3115 2214,3102 2206,3097 2203,3092 2200,3075 2185,3072 2184,3070 2182,3063 2179,3061 2177,3059 2176,3058 2174,3057 2173,3056 2169,3054 2166,3052 2164,3051 2162,3047 2160,3043 2156,3038 2153,3036 2152,3031 2150,3029 2150,3027 2149,3024 2146,3022 2145,3015 2144,3011 2143,3007 2142,3000 2141,2997 2140,2995 2139,2994 2138,2991 2133,2990 2131,2986 2129,2984 2128,2982 2127,2980 2127,2977 2127,2974 2128,2970 2130,2963 2133,2958 2136,2954 2138,2952 2140,2951 2142,2950 2144,2950 2147,2949 2156,2948 2159,2947 2161,2947 2163,2945 2165,2944 2167,2941 2168,2939 2169,2936 2170,2933 2170,2930 2170,2926 2169,2923 2168,2920 2166,2915 2163,2912 2160,2910 2158,2909 2156,2908 2153,2907 2149,2907 2145,2907 2140,2908 2136,2913 2118,2914 2115,2916 2112,2917 2109,2919 2107,2930 2095,2932 2092,2932 2089,2932 2087,2932 2085,2931 2084,2929 2081,2928 2080,2926 2079,2924 2078,2922 2077,2919 2077,2916 2077,2914 2077,2912 2078,2907 2081,2901 2086,2898 2089,2891 2094,2889 2096,2887 2098,2885 2098,2881 2099,2875 2099,2867 2098,2860 2098,2855 2097,2852 2096,2851 2095,2844 2092,2838 2089,2834 2086,2831 2085,2829 2085,2827 2085,2824 2085,2822 2086,2821 2087,2819 2090,2818 2092,2817 2094,2816 2096,2816 2098,2817 2100,2818 2102,2819 2105,2825 2112,2828 2116,2831 2119,2833 2121,2841 2126,2843 2127,2847 2128,2848 2128,2849 2129,2850 2130,2850 2131,2852 2136,2852 2138,2852 2141,2851 2143,2850 2145,2849 2147,2847 2149,2845 2150,2844 2151,2841 2151,2838 2151,2832 2149,2824 2148,2819 2146,2812 2144,2807 2141,2804 2140,2801 2137,2799 2135,2797 2132,2791 2122,2789 2120,2788 2116,2785 2104,2784 2100,2784 2098,2784 2093,2784 2088,2787 2074,2787 2069,2787 2062,2786 2057,2783 2043,2781 2036,2778 2026,2776 2019,2775 2017,2773 2014,2771 2012,2767 2010,2764 2008,2759 2007,2756 2007,2754 2007,2750 2007,2746 2009,2743 2011,2723 2025,2710 2035,2703 2040,2698 2042,2689 2046,2684 2050,2682 2050,2679 2051,2673 2051,2660 2053,2642 2055,2638 2055,2634 2055,2630 2055,2619 2053,2614 2051,2611 2049,2609 2048,2606 2045,2595 2030,2591 2026,2588 2023,2585 2021,2583 2020,2579 2019,2575 2018,2569 2017,2562 2017,2546 2017,2539 2017,2537 2016,2533 2015,2529 2013,2525 2011,2522 2009,2519 2005,2517 2002,2515 1999,2515 1996,2514 1993,2514 1991,2514 1980,2513 1976,2512 1972,2511 1969,2508 1965,2507 1962,2503 1958,2500 1955,2479 1936,2475 1932,2472 1930,2467 1927,2461 1924,2459 1923,2457 1922,2456 1919,2454 1917,2453 1914,2453 1911,2453 1908,2453 1903,2457 1886,2463 1864,2466 1854,2468 1848,2471 1844,2474 1839,2478 1836,2482 1832,2487 1830,2491 1828,2494 1827,2504 1824,2508 1823,2513 1820,2516 1817,2518 1815,2520 1813,2521 1811,2521 1807,2521 1803,2521 1799,2521 1796,2520 1793,2518 1790,2516 1787,2513 1784,2503 1778,2502 1777,2500 1776,2498 1776,2496 1776,2492 1776,2479 1779,2473 1780,2467 1780,2462 1780,2456 1778,2439 1771,2429 1766,2425 1763,2421 1761,2418 1758,2415 1754,2413 1750,2411 1748,2411 1746,2409 1736,2406 1727,2405 1725,2404 1722,2403 1720,2401 1718,2390 1710,2386 1708,2383 1706,2379 1705,2375 1704,2371 1703,2360 1702,2355 1701,2350 1700,2347 1699,2344 1697,2340 1695,2335 1692,2317 1679,2314 1677,2305 1672,2303 1670,2301 1668,2299 1666,2298 1664,2297 1657,2296 1655,2295 1652,2292 1650,2287 1644,2282 1639,2280 1637,2278 1636,2272 1633,2261 1629,2248 1625,2237 1623,2227 1621,2222 1620,2218 1620,2214 1621,2211 1622,2208 1624,2205 1626,2204 1628,2201 1633,2194 1647,2192 1650,2189 1653,2185 1657,2181 1659,2176 1661,2171 1663,2169 1663,2164 1664,2129 1664,2125 1663,2118 1662,2096 1658,2091 1657,2086 1657,2079 1657,2067 1658,2063 1658,2058 1657,2054 1656,2035 1651,2031 1650,2025 1647,2018 1644,2014 1641,2011 1639,2008 1636,2004 1631,2001 1627,1999 1623,1998 1622,1997 1621,1962 1612,1951 1608,1946 1606,1928 1597,1925 1595,1920 1592,1918 1590,1915 1587,1912 1584,1910 1580,1909 1577,1907 1573,1906 1569,1906 1568,1900 1559,1898 1556,1895 1554,1887 1550,1876 1543,1866 1536,1862 1534,1858 1533,1840 1532,1835 1532,1831 1531,1828 1530,1823 1529,1813 1525,1811 1524,1808 1524,1803 1523,1786 1523,1770 1521,1759 1521,1744 1520,1734 1521,1728 1521,1724 1522,1709 1527,1705 1528,1702 1528,1691 1529,1677 1529,1665 1530,1654 1530,1640 1529,1630 1529,1627 1529,1622 1528,1614 1526,1611 1525,1610 1525,1607 1526,1603 1527,1601 1528,1600 1529,1600 1530,1599 1532,1600 1538,1599 1548,1600 1555,1600 1558,1600 1560,1599 1563,1597 1567,1590 1581,1587 1586,1585 1589,1583 1591,1579 1594,1576 1597,1570 1601,1562 1606,1552 1611,1545 1614,1540 1616,1535 1617,1530 1618,1524 1618,1510 1619,1500 1620,1495 1620,1489 1619,1483 1618,1467 1614,1464 1614,1461 1614,1457 1614,1444 1614,1439 1614,1436 1615,1433 1616,1427 1619,1422 1622,1418 1626,1415 1629,1412 1634,1410 1638,1408 1640,1407 1644,1402 1657,1400 1664,1396 1671,1391 1677,1388 1681,1383 1685,1378 1689,1369 1695,1364 1700,1358 1705,1357 1707,1351 1714,1345 1721,1342 1724,1337 1727,1329 1731,1324 1732,1315 1733,1309 1734,1304 1734,1299 1734,1295 1733,1292 1731,1288 1729,1281 1724,1278 1722,1274 1721,1269 1719,1264 1718,1253 1717,1249 1717,1247 1717,1244 1718,1241 1719,1234 1723,1230 1725,1227 1726,1221 1727,1217 1728,1214 1729,1208 1729,1205 1728,1203 1734,1213 1733,1221 1731,1225 1730,1238 1723,1241 1722,1245 1721,1249 1721,1252 1721,1264 1722,1266 1722,1275 1726,1276 1727,1277 1728,1279 1729,1281 1731,1282 1732,1283 1735,1284 1737,1286 1738,1289 1739,1292 1740,1297 1742,1298 1742,1302 1742,1307 1741,1310 1740,1313 1738,1316 1739,1318 1739,1321 1737,1323 1737,1327 1736,1330 1735,1334 1734,1336 1734,1345 1729,1347 1727,1352 1721,1362 1710,1364 1708,1376 1698,1378 1696,1383 1693,1385 1691,1389 1687,1396 1680,1401 1672,1405 1667,1406 1666,1406 1664,1407 1659,1408 1655,1409 1650,1410 1647,1411 1643,1413 1640,1416 1635,1419 1631,1421 1629,1424 1628,1429 1624,1432 1622,1434 1621,1437 1620,1440 1620,1441 1619,1443 1620,1444 1620,1446 1622,1447 1622,1448 1622,1470 1786,1676 1758,1645 1534,1647 1535,1649 1535,1658 1535,1666 1535,1678 1534,1688 1533,1698 1532,1712 1532,1713 1531,1714 1529,1715 1529,1721 1528,1730 1526,1735 1525,1740 1524,1745 1524,1756 1525,1778 1526,1799 1528,1807 1529,1811 1530,1830 1535,1833 1536,1840 1536,1848 1537,1854 1537,1856 1538,1859 1539,1862 1541,1871 1547,1873 1549,1876 1550,1883 1552,1889 1555,1893 1557,1894 1558,1895 1559,1897 1562,1902 1570,1904 1576,1907 1585,1908 1588,1909 1589,1911 1591,1913 1593,1920 1598,1925 1603,1928 1605,1932 1607,1936 1609,1949 1612,1969 1619,1975 1620,1978 1621,1983 1622,1991 1624,1994 1625,1996 1626,1997 1627,1998 1631,2000 1634,2002 1636,2008 1642,2032 1852,1706 1996,1276 1945,1274 1946,1383 2268,1388 2276,1393 2283,1401 2290,1408 2293,1424 2298,1455 2305,1475 2309,1495 2317,1623 2375,1650 2387,1663 2394,1673 2401,1775 2479,1791 2490,1800 2498,1809 2504,1814 2508,1826 2517,1847 2533,1881 2559,1900 2571,1971 2625,2032 2670,2035 2672,2038 2672,2132 2649,2224 2626,2245 2622,2259 2623,2285 2627,2288 2627,2290 2624,2296 2625,2296 2627,2298 2629,2321 2633,2350 2637,2530 2667,2723 2699,2780 2708,2812 2714,3221 2781,3245 2785,3309 2796,3325 2797,3334 2800,3341 2805,3352 2812,3369 2825,3375 2828,3380 2833,3387 2838,3403 2811,3408 2812,3417 2814,3421 2814,3424 2814,3433 2810,3437 2810,3446 2808,3456 2807,3460 2806,3463 2806,3466 2807,3472 2808,3477 2811,3482 2814,3488 2819,3493 2823,3497 2829,3501 2835,3505 2840,3506 2845,3508 2850,3509 2854,3509 2858,3508 2861,3508 2863,3506 2867,3504 2869,3504 2871,3503 2873,3501 2877,3501 2878,3501 2881,3501 2884,3502 2887,3503 2888,3507 2894,3510 2895,3512 2896,3518 2898,3521 2899,3526 2899,3531 2899,3538 2898,3544 2896,3550 2894,3555 2891,3561 2888,3565 2884,3569 2881,3575 2876,3581 2869,3583 2867,3585 2866,3587 2865,3590 2864,3591 2864,3593 2865,3594 2865,3597 2864,3596 2863,3597 2861,3596 2859,3597 2858,3598 2857,3609 2851,3613 2849,3617 2847,3622 2846,3627 2845,3631 2844,3638 2840,3660 2830,3666 2828,3670 2825,3675 2822,3680 2819,3687 2812,3689 2809,3691 2806,3701 2797,3704 2794,3706 2791,3709 2785,3712 2780,3713 2776,3715 2771,3717 2759,3717 2756,3717 2755,3717 2754,3713 2751,3711 2748,3711 2746,3711 2742,3711 2738,3711 2737,3710 2727,3711 2721,3712 2715,3714 2710,3716 2707,3718 2704,3719 2702,3722 2700,3725 2698,3728 2697,3730 2696,3736 2695,3742 2695,3746 2695,3751 2696,3755 2697,3756 2697,3757 2697,3758 2699,3759 2701,3768 2702,3777 2704,3786 2705,3798 2708,3802 2708,3807 2708,3809 2707,3810 2707,3814 2704,3818 2701,3828 2690,3840 2674,3847 2666,3850 2662,3865 2648,3869 2642,3872 2639,3874 2637,3879 2634,3881 2633,3882 2631,3884 2628,3884 2627,3887 2626,3887 2625,3888 2623,3890 2619,3901 2603,3904 2594,3906 2591,3908 2589,3912 2585,3916 2579,3920 2575,3923 2571,3925 2570,3928 2568,3934 2565,3943 2559,3946 2558,3948 2558,3960 2555,3973 2553,3988 2552,3990 2551,3995 2549,4000 2546,4004 2545,4016 2539,4018 2538,4021 2536,4027 2533,4035 2528,4042 2523,4051 2516,4054 2514,4056 2513,4058 2512,4060 2510,4065 2507,4067 2506,4075 2502,4088 2495,4095 2491,4096.0 2490.35714285714,4096.0 2481.66666666667)),((268 1838,354 2179,885 2044,841 1901,549 2027,661 1727,520 1651,482 1588,494 1593,496 1594,499 1594,503 1595,511 1594,524 1596,528 1596,535 1599,538 1599,540 1599,542 1599,544 1598,545 1596,546 1594,547 1591,549 1585,548 1583,548 1581,546 1579,544 1572,541 1567,538 1562,536 1558,535 1554,534 1550,534 1547,533 1536,533 1528,534 1522,536 1515,538 1511,539 1510,540 1507,543 1505,549 1501,552 1498,557 1491,565 1480,568 1475,573 1467,575 1465,580 1460,585 1454,589 1448,594 1441,596 1439,597 1438,600 1437,605 1435,607 1435,612 1436,614 1436,616 1436,619 1434,621 1434,623 1434,624 1435,626 1436,627 1438,628 1439,630 1441,633 1451,635 1460,635 1462,636 1464,638 1465,639 1466,643 1468,645 1469,649 1469,656 1469,662 1468,669 1468,674 1468,676 1467,677 1466,679 1465,684 1459,689 1455,690 1453,692 1448,694 1447,696 1446,701 1445,703 1445,712 1441,714 1440,716 1439,717 1437,718 1436,719 1434,720 1425,720 1423,717 1412,716 1410,714 1409,708 1405,706 1403,699 1395,697 1393,696 1391,696 1388,695 1384,693 1356,693 1351,694 1347,695 1344,697 1339,699 1336,704 1330,708 1324,713 1319,715 1317,720 1308,725 1301,726 1298,727 1295,727 1292,726 1285,725 1283,721 1278,719 1275,714 1257,712 1252,710 1240,709 1238,707 1234,705 1227,702 1221,701 1218,700 1204,700 1202,700 1200,708 1187,709 1185,711 1183,714 1181,721 1178,723 1176,728 1172,734 1170,738 1167,741 1165,747 1159,749 1157,752 1156,759 1154,765 1151,770 1149,773 1147,777 1142,778 1140,779 1137,780 1133,781 1131,787 1126,794 1119,801 1112,806 1108,808 1106,809 1104,809 1102,809 1097,809 1092,809 1086,810 1080,811 1078,812 1077,815 1075,817 1074,818 1074,819 1075,820 1075,821 1074,822 1073,824 1070,828 1066,834 1058,835 1057,838 1058,841 1059,844 1060,845 1060,850 1061,855 1063,859 1063,861 1063,863 1062,866 1061,870 1058,875 1053,877 1051,880 1049,882 1049,884 1048,892 1048,900 1049,904 1049,911 1049,918 1048,922 1048,924 1048,926 1048,928 1048,932 1050,933 1051,935 1051,937 1051,941 1049,942 1049,949 1049,955 1048,963 1049,969 1051,974 1051,984 1052,987 1051,993 1050,1001 1049,1005 1048,1008 1047,1011 1045,1013 1042,1015 1038,1016 1037,1019 1036,1020 1032,1023 1029,1028 1022,1032 1016,1034 1013,1036 1009,1037 1005,1037 1003,1037 993,1038 990,1038 988,1040 985,1041 984,1043 984,1045 984,1048 985,1051 986,1053 987,1055 989,1057 991,1059 994,1062 998,1063 1001,1064 1004,1065 1008,1065 1012,1065 1026,1065 1031,1065 1033,1066 1035,1067 1037,1068 1039,1071 1043,1073 1045,1075 1045,1076 1045,1080 1044,1082 1044,1084 1045,1086 1046,1088 1048,1093 1052,1097 1057,1100 1063,1101 1065,1101 1067,1101 1070,1101 1072,1100 1073,1099 1076,1095 1081,1091 1084,1086 1087,1085 1088,1081 1089,1081 1090,1079 1091,1077 1096,1077 1097,1076 1099,1074 1100,1073 1101,1069 1102,1067 1103,1065 1105,1059 1113,1059 1115,1058 1117,1058 1119,1057 1121,1058 1130,1058 1132,1059 1133,1060 1136,1063 1139,1067 1143,1069 1145,1071 1146,1074 1147,1079 1149,1083 1150,1096 1156,1097 1157,1098 1158,1101 1162,1102 1163,1106 1166,1107 1167,1109 1168,1111 1168,1118 1168,1126 1170,1127 1171,1135 1177,1140 1179,1141 1181,1147 1186,1148 1188,1149 1190,1150 1193,1151 1195,1163 1214,1164 1216,1165 1219,1169 1228,1171 1229,1173 1230,1174 1230,1175 1230,1176 1230,1178 1228,1179 1228,1181 1228,1183 1230,1186 1231,1187 1231,1189 1235,1195 1242,1197 1245,1200 1251,1202 1254,1204 1262,909 1185,897 1280,910 1287,1018 1339,1039 1349,1049 1355,1057 1361,1063 1366,1068 1371,1071 1374,1212 1290,1214 1299,1214 1307,1214 1310,1215 1312,1216 1315,1218 1318,1219 1320,1222 1323,1224 1326,1234 1333,1240 1337,1248 1341,1250 1342,1254 1345,1257 1350,1259 1352,1259 1354,1260 1355,1260 1359,1259 1363,1254 1377,1252 1380,1250 1384,1244 1394,1242 1397,1240 1399,1235 1403,1228 1407,1223 1410,1221 1411,1220 1413,1218 1416,1215 1423,1211 1432,1208 1437,1200 1448,1196 1457,1194 1459,1186 1468,1179 1475,1176 1477,1171 1480,1165 1484,1156 1489,1152 1491,1149 1494,1146 1497,1145 1499,1142 1504,1141 1506,1140 1507,1140 1509,1141 1514,1141 1519,1143 1523,1144 1530,1146 1535,1148 1540,1154 1550,1160 1559,1162 1564,1165 1569,1170 1580,1170 1584,1172 1598,1172 1607,1173 1619,1175 1627,1175 1634,1177 1640,1179 1645,1182 1660,1185 1669,1187 1676,1188 1679,1190 1685,1191 1688,1192 1694,1192 1699,1192 1704,1190 1710,1196 1699,1196 1695,1196 1689,1195 1685,1194 1680,1190 1669,1189 1664,1186 1652,1182 1636,1181 1631,1179 1620,1177 1599,1176 1589,1174 1581,1173 1576,1171 1570,1169 1566,1158 1546,1155 1539,1153 1534,1149 1521,1148 1518,1148 1515,1148 1511,1148 1508,1148 1505,1149 1503,1150 1501,1152 1498,1154 1496,1156 1494,1158 1493,1173 1486,1176 1484,1179 1482,1182 1479,1193 1468,1195 1465,1198 1461,1202 1455,1215 1434,1217 1430,1220 1423,1223 1419,1225 1416,1234 1409,1239 1404,1244 1400,1247 1396,1251 1391,1255 1384,1259 1375,1263 1368,1264 1364,1265 1361,1265 1359,1264 1356,1263 1351,1262 1349,1261 1347,1255 1340,1253 1339,1251 1338,1249 1337,1243 1334,1238 1332,1234 1329,1228 1323,1224 1320,1222 1317,1221 1315,1220 1313,1218 1305,1217 1301,1217 1290,1216 1287,1215 1281,1213 1272,1210 1265,1202 1246,1200 1238,1198 1235,1195 1232,1192 1229,1177 1218,1168 1209,1164 1205,1160 1200,1157 1195,1155 1190,1152 1184,1150 1181,1147 1178,1138 1171,1134 1169,1121 1162,1118 1161,1112 1160,1110 1159,1108 1158,1101 1153,1097 1150,1094 1149,1089 1146,1076 1142,1074 1141,1071 1139,1069 1137,1067 1135,1066 1134,1065 1131,1064 1129,1064 1127,1063 1123,1064 1118,1064 1115,1064 1113,1065 1111,1067 1108,1070 1107,1071 1106,1077 1105,1079 1104,1081 1103,1084 1099,1087 1096,1089 1094,1095 1090,1098 1087,1099 1086,1101 1083,1106 1074,1107 1071,1107 1070,1107 1068,1107 1066,1106 1063,1105 1060,1104 1058,1101 1054,1097 1048,1094 1042,1093 1041,1091 1040,1088 1039,1085 1039,1079 1039,1076 1039,1074 1038,1073 1037,1071 1036,1070 1034,1070 1032,1069 1031,1069 1026,1069 1021,1070 1011,1070 1008,1070 1004,1068 999,1066 994,1063 990,1060 987,1058 985,1054 982,1050 980,1047 979,1044 978,1042 978,1040 979,1038 980,1037 981,1036 983,1034 991,1033 995,1033 1004,1032 1006,1031 1008,1030 1011,1028 1014,1017 1030,1012 1036,1010 1039,1008 1041,1005 1043,1003 1044,1000 1045,986 1047,982 1047,977 1047,971 1046,966 1046,959 1044,956 1043,949 1041,946 1041,944 1041,937 1043,934 1043,919 1044,912 1045,907 1045,895 1043,891 1043,887 1043,883 1043,880 1044,877 1045,874 1046,866 1050,864 1051,862 1052,859 1051,850 1050,847 1049,841 1049,832 1049,827 1049,824 1049,821 1048,814 1044,797 1035,779 1025,762 1017,761 1022,764 1022,766 1023,768 1023,770 1024,771 1024,772 1025,776 1029,781 1031,784 1033,786 1035,790 1037,792 1038,794 1039,809 1048,820 1053,823 1056,825 1058,826 1059,826 1061,825 1063,824 1065,822 1068,821 1069,819 1070,816 1071,813 1073,812 1074,811 1074,808 1074,807 1074,806 1075,805 1079,805 1082,805 1084,807 1090,807 1091,806 1096,806 1101,805 1104,804 1106,803 1108,798 1112,786 1124,780 1128,777 1133,773 1137,772 1138,771 1141,770 1143,768 1145,766 1147,762 1150,759 1152,757 1152,751 1152,750 1152,749 1153,746 1156,742 1159,734 1166,729 1169,722 1174,718 1176,713 1178,711 1180,709 1181,707 1183,706 1185,700 1196,698 1202,697 1208,696 1212,697 1216,698 1222,701 1229,706 1241,707 1246,709 1256,711 1263,712 1267,718 1278,721 1285,723 1290,724 1292,724 1294,723 1297,722 1300,717 1305,713 1310,709 1316,707 1318,706 1321,704 1326,703 1328,701 1330,696 1333,695 1335,693 1337,691 1340,690 1341,690 1346,689 1355,689 1358,690 1362,691 1369,691 1377,692 1381,692 1383,692 1384,690 1386,690 1387,691 1389,693 1394,695 1396,697 1399,706 1409,707 1410,710 1411,711 1412,715 1418,716 1420,716 1423,715 1425,714 1429,714 1433,714 1435,713 1436,712 1437,707 1440,705 1441,701 1441,697 1443,692 1444,690 1445,689 1446,689 1447,688 1451,687 1452,684 1455,681 1458,679 1460,677 1461,674 1462,672 1463,664 1464,660 1465,650 1466,647 1466,644 1465,642 1463,639 1460,638 1458,637 1457,636 1455,636 1451,635 1448,634 1444,632 1440,631 1437,629 1435,627 1433,624 1431,622 1430,621 1430,615 1430,613 1431,606 1434,599 1435,597 1436,595 1437,591 1441,586 1449,581 1454,579 1456,573 1461,569 1465,567 1468,561 1478,552 1491,550 1494,544 1499,540 1503,536 1507,534 1510,533 1512,531 1517,530 1520,529 1525,528 1530,529 1539,531 1549,532 1553,533 1559,536 1564,538 1569,543 1581,544 1584,544 1587,543 1590,542 1592,541 1593,539 1594,538 1595,536 1595,532 1594,526 1592,523 1591,514 1592,506 1591,501 1591,497 1591,495 1591,493 1590,488 1588,483 1586,480 1585,478 1585,474 1585,469 1586,465 1588,462 1590,460 1593,456 1596,452 1603,450 1606,446 1613,445 1616,438 1624,437 1625,435 1626,433 1627,425 1630,424 1631,420 1633,413 1635,409 1637,405 1640,395 1648,392 1651,391 1653,390 1655,389 1656,390 1658,390 1660,392 1664,399 1673,403 1680,404 1682,404 1684,403 1687,402 1690,397 1695,393 1700,386 1708,384 1710,382 1711,381 1712,378 1712,374 1711,373 1710,372 1710,371 1708,369 1701,368 1697,366 1693,365 1691,364 1690,362 1689,360 1688,351 1689,350 1689,346 1692,343 1692,330 1694,324 1694,322 1695,318 1697,316 1697,313 1697,309 1697,305 1696,303 1697,301 1698,299 1698,297 1698,295 1698,294 1698,292 1700,291 1700,290 1700,289 1699,286 1700,284 1700,282 1701,282 1702,281 1704,281 1705,281 1706,283 1709,283 1711,284 1718,284 1720,283 1721,283 1722,282 1723,281 1723,280 1723,279 1722,278 1718,276 1714,275 1713,274 1713,273 1712,271 1712,267 1712,263 1711,261 1712,255 1714,253 1714,251 1714,248 1712,243 1708,242 1707,239 1706,235 1706,269 1838,268 1838)),((1171 2668,1183 2679,1194 2692,1226 2730,1061 2800,1121 2943,1035 2980,878 3046,728 3112,669 3137,666 3127,608 3142,614 3148,671 3141,1038 2985,1040 2984,1045 2981,1079 2966,1133 2944,1214 2909,1250 2894,1328 2860,1267 2776,1345 2738,1418 2774,1438 2813,1539 2769,1559 2755,1647 2717,1652 2713,1650 2705,1645 2695,1633 2680,1603 2643,1602 2641,1592 2629,1580 2615,1577 2613,1524 2551,1512 2537,1486 2507,1439 2450,1433 2440,1425 2421,1384 2459,1353 2425,1377 2401,1412 2383,1399 2338,1398 2332,1395 2324,1398 2314,1401 2301,1388 2292,1383 2285,1376 2272,1351 2197,1344 2177,1341 2165,1318 2098,1306 2062,1296 2035,1268 1951,1103 2076,1091 2124,1070 2214,1055 2271,1052 2286,1050 2293,1048 2302,1047 2304,1046 2306,1043 2310,1041 2313,1036 2323,1035 2325,1033 2330,1031 2335,1030 2337,1030 2340,1030 2343,1031 2346,1033 2349,1036 2352,1042 2357,1045 2360,1049 2365,1053 2371,1056 2374,1063 2381,1067 2385,1070 2388,1070 2390,1071 2392,1071 2394,1070 2396,1066 2408,1063 2416,1062 2422,1062 2428,1062 2432,1064 2442,1067 2450,1068 2457,1074 2483,1074 2486,1074 2489,1073 2497,1073 2512,1073 2517,1072 2519,1071 2522,1066 2531,1064 2534,1063 2536,1063 2539,1063 2541,1064 2545,1065 2546,1066 2547,1074 2555,1079 2559,1171 2668),(1367 2309,1357 2277,1375 2272,1388 2302,1367 2309)),((0.0 3636.66666666667,2 3640,2 3642,3 3645,2 3649,2 3651,3 3653,3 3654,4 3655,7 3657,8 3658,9 3660,11 3661,20 3664,22 3664,25 3663,26 3664,28 3665,29 3667,32 3672,33 3675,34 3676,36 3678,37 3678,39 3679,41 3680,57 3529,24 3526,0.0 3527.2972972973,0.0 3636.66666666667)),((2285 2839,2290 2807,2317 2810,2307 2744,2474 2771,2660 2798,2683 2889,2695 2930,2780 3000,3087 2998,3218 3044,3229 3029,3280 2959,3316 2909,3319 2903,3322 2894,3323 2859,3324 2846,3324 2836,3306 2836,3307 2802,3289 2799,3190 2783,2961 2746,2819 2722,2776 2715,2729 2707,2642 2694,2374 2651,2306 2640,2296 2638,2288 2638,2285 2636,2259 2632,2242 2632,2227 2634,2136 2655,2047 2677,2035 2681,2020 2674,2019 2672,1958 2627,1954 2626,1951 2628,1945 2623,1945 2617,1894 2579,1847 2543,1810 2516,1786 2498,1767 2484,1716 2445,1667 2409,1658 2403,1616 2381,1493 2324,1480 2318,1470 2315,1454 2311,1450 2311,1427 2306,1411 2303,1412 2304,1408 2310,1406 2320,1405 2327,1407 2335,1414 2357,1422 2384,1431 2406,1436 2422,1450 2446,1459 2460,1470 2475,1470 2477,1480 2489,1520 2536,1527 2542,1545 2563,1553 2570,1573 2594,1611 2637,1618 2649,1650 2687,1658 2697,1657 2700,1658 2704,1663 2719,1652 2727,1622 2740,1581 2758,1568 2765,1557 2771,1509 2792,1404 2837,1391 2848,1376 2850,1347 2864,1336 2867,1260 2900,1126 2956,1154 3021,1254 3028,1322 3099,1462 3240,1503 3066,1525 3037,1605 3124,1675 3104,1679 3090,1852 3128,2003 3305,2167 3148,2144 3092,2280 2978,2303 2932,2279 2873,2285 2839),(1916 2804,1901 2817,1760 2852,1737 2854,1682 2839,1677 2770,1904 2712,1916 2804)),((620 3155,681 3393,734 3380,709 3288,665 3307,658 3279,650 3251,643 3222,636 3193,642 3177,646 3170,649 3166,651 3164,654 3161,659 3158,671 3150,673 3149,620 3155)),((2936 3271,2970 3295,2989 3267,2935 3229,2915 3256,2936 3271)),((0 1902,2 1900,8 1896,10 1895,13 1890,17 1886,18 1886,19 1884,19 1882,19 1878,19 1875,20 1872,22 1869,24 1865,33 1852,38 1842,40 1839,43 1836,46 1833,49 1830,51 1829,56 1828,59 1826,61 1824,65 1818,67 1816,69 1815,73 1813,80 1810,82 1809,84 1808,85 1807,85 1806,88 1799,90 1797,93 1796,99 1794,102 1793,104 1791,107 1789,109 1786,111 1783,113 1779,114 1776,114 1774,114 1772,114 1767,114 1765,114 1764,115 1763,118 1759,120 1756,121 1755,123 1755,126 1753,127 1752,129 1752,133 1752,134 1752,135 1751,138 1748,139 1747,141 1747,144 1746,146 1747,148 1748,150 1750,152 1752,153 1755,155 1758,157 1765,157 1767,158 1768,159 1769,161 1770,162 1770,164 1770,166 1770,169 1768,173 1764,174 1763,176 1762,178 1762,179 1762,185 1763,187 1764,189 1764,191 1763,193 1762,198 1758,199 1757,200 1756,201 1749,202 1747,201 1744,199 1740,198 1737,197 1736,195 1734,194 1733,189 1732,186 1731,182 1731,178 1732,176 1732,174 1731,173 1730,173 1729,173 1728,174 1726,177 1723,181 1720,185 1718,190 1715,194 1714,204 1712,218 1712,218 1709,206 1710,201 1710,193 1711,191 1711,188 1712,179 1717,176 1719,174 1721,173 1723,171 1728,170 1730,170 1732,170 1733,171 1733,172 1734,175 1735,177 1734,184 1733,186 1734,192 1735,194 1736,195 1737,197 1740,198 1742,199 1745,199 1747,199 1749,198 1752,195 1755,194 1757,193 1758,190 1759,187 1760,186 1760,185 1760,182 1760,180 1759,177 1760,175 1760,172 1762,169 1765,168 1766,166 1767,165 1767,164 1767,163 1766,161 1764,158 1758,155 1752,153 1749,150 1746,148 1745,147 1744,144 1744,141 1744,137 1746,135 1747,133 1748,127 1748,125 1749,124 1749,122 1750,119 1752,116 1756,113 1758,111 1761,110 1763,110 1764,110 1766,111 1770,111 1771,110 1773,109 1773,110 1774,110 1777,110 1779,109 1780,107 1782,106 1785,105 1786,100 1790,96 1792,93 1793,84 1796,81 1798,79 1800,69 1810,63 1816,58 1821,56 1824,54 1826,49 1829,39 1837,37 1839,35 1840,34 1842,32 1848,28 1854,24 1861,17 1872,16 1873,16 1875,15 1880,14 1882,13 1886,10 1890,7 1893,4 1896,0.0 1898.66666666667,0 1902)))

comment:10 by ajolma, 6 years ago

Using the 4096 resolution with PostGIS instead of 256 seems to be a working solution for my case.

comment:11 by Algunenano, 6 years ago

Using the 4096 resolution with PostGIS instead of 256 seems to be a working solution for my case.

Yes, the bug appears to be related to small parts left behind around the clip borders, so making the polygon 16x bigger solves it in this case. Nevertheless I'll try to have it fixed for the next patch release.

comment:12 by Raul Marin, 6 years ago

In 17171:

Correct issue reference from previous commit

References #4289

comment:13 by Raul Marin, 6 years ago

In 17172:

Correct issue reference from previous commit

References #4289

comment:14 by Raul Marin, 6 years ago

Resolution: fixed
Status: newclosed

In 17173:

ST_AsMVTGeom: Transform coordinates space before clipping

Closes #4289
Closes https://github.com/postgis/postgis/pull/360

Note: See TracTickets for help on using tickets.