[GIS] Why does thesql ST_WITHIN work for some MultiPolygons but doesn’t for others

geonamesMySQLpolygon

The mysql queries are to return all POI's within a certain country.

This works (for Angola):

SELECT 
    poi.poi_id,
    poi.poi_address_full 
FROM 
    poi
WHERE 
    ST_WITHIN(
        poi.poi_point,
        ST_GeomFromText(
            'MULTIPOLYGON(((11.768 -16.799,11.681 -16.579,11.715 -16.518,11.726 -16.522,11.768 -16.799)),((13.057 -8.973,13.056 -8.981,13.051 -8.983,13.051 -8.979,13.057 -8.973)),((13.137 -8.937,13.133 -8.936,13.132 -8.93,13.143 -8.931,13.137 -8.937)),((13.107 -8.944,13.101 -8.935,13.127 -8.903,13.122 -8.939,13.107 -8.944)),((13.197 -8.827,13.225 -8.784,13.261 -8.756,13.252 -8.773,13.197 -8.827)),((12.642 -6.054,12.611 -6.043,12.606 -6.038,12.661 -6.027,12.642 -6.054)),((12.797 -6.027,12.796 -6.022,12.808 -6.016,12.808 -6.024,12.797 -6.027)),((12.741 -6.025,12.72 -6.02,12.764 -6.012,12.763 -6.02,12.741 -6.025)),((12.036 -5,12.167 -4.885,12.211 -4.753,12.326 -4.794,12.39 -4.602,12.631 -4.561,12.784 -4.377,12.89 -4.402,13.021 -4.598,13.102 -4.626,12.866 -4.739,12.811 -4.865,12.458 -5.088,12.525 -5.152,12.521 -5.744,12.204 -5.766,12.159 -5.702,12.141 -5.629,12.231 -5.49,12.134 -5.203,12.01 -5.027,12.036 -5)),((22 -15,22 -16.198,22.109 -16.343,22.126 -16.497,22.316 -16.636,22.807 -17.173,23.009 -17.288,23.142 -17.468,23.241 -17.55,23.392 -17.582,23.428 -17.639,21.442 -18.024,21.22 -17.932,20.981 -17.955,20.818 -18.042,20.535 -17.979,20.317 -17.865,20.114 -17.912,19.913 -17.866,19.749 -17.914,19.662 -17.853,18.911 -17.823,18.624 -17.643,18.423 -17.394,14.214 -17.384,14.099 -17.442,13.957 -17.433,13.511 -17.135,13.461 -17.013,13.142 -16.96,12.983 -16.984,12.566 -17.242,12.447 -17.264,12.413 -17.206,12.25 -17.237,12.083 -17.144,11.811 -17.267,11.758 -17.252,11.832 -16.473,11.808 -16.012,11.732 -15.881,11.775 -15.786,11.876 -15.787,11.983 -15.641,12.058 -15.23,12.151 -15.184,12.126 -15.09,12.289 -14.751,12.357 -14.405,12.357 -14.084,12.426 -13.876,12.528 -13.845,12.534 -13.413,12.974 -12.984,12.941 -12.831,13.195 -12.595,13.394 -12.578,13.654 -12.237,13.793 -11.807,13.77 -11.577,13.865 -11.008,13.723 -10.758,13.775 -10.669,13.529 -10.391,13.495 -10.245,13.526 -10.269,13.314 -9.985,13.345 -9.939,13.202 -9.694,13.242 -9.63,13.156 -9.341,12.993 -9.076,13.036 -8.963,13.126 -8.873,13.028 -8.992,13.018 -9.093,13.104 -8.951,13.146 -8.955,13.222 -8.808,13.4 -8.745,13.414 -8.639,13.348 -8.467,13.393 -8.45,13.387 -8.362,12.855 -7.271,12.821 -6.974,12.575 -6.675,12.274 -6.142,12.277 -6.109,12.336 -6.075,12.286 -6.113,12.303 -6.16,12.485 -6.086,12.525 -6.121,12.53 -6.07,12.589 -6.084,12.586 -6.062,12.644 -6.064,12.674 -6.022,12.834 -6.036,12.919 -5.992,12.952 -5.966,12.969 -5.907,13.047 -5.87,13.359 -5.901,13.986 -5.842,14.038 -5.884,14.595 -5.91,14.963 -5.873,16.512 -5.878,16.6 -5.919,16.607 -6.086,16.729 -6.188,16.691 -6.406,16.732 -6.425,16.751 -6.579,16.876 -6.847,16.94 -6.875,16.983 -7.023,16.964 -7.079,16.929 -7.069,16.954 -7.203,17.006 -7.3,17.11 -7.346,17.11 -7.423,17.185 -7.432,17.156 -7.475,17.306 -7.637,17.321 -7.759,17.432 -7.842,17.533 -8.044,17.505 -8.083,17.56 -8.127,17.885 -8.079,18.1 -8.099,18.098 -8.04,18.217 -7.989,18.376 -8.027,18.527 -8,18.532 -7.92,18.78 -7.922,18.8 -8,19.374 -8,19.343 -7.899,19.409 -7.701,19.369 -7.583,19.474 -7.567,19.486 -7.503,19.55 -7.472,19.487 -7.313,19.544 -6.999,20.302 -6.998,20.317 -6.913,20.627 -6.913,20.542 -7.281,21.781 -7.284,21.853 -7.426,21.853 -7.557,21.745 -7.939,21.889 -8.182,21.96 -8.497,21.862 -8.91,21.861 -9.241,21.793 -9.42,21.876 -9.653,22.003 -9.752,22.073 -9.878,22.191 -9.927,22.236 -10.209,22.328 -10.385,22.278 -10.516,22.317 -10.544,22.334 -10.758,22.174 -10.875,22.261 -11.233,22.437 -11.175,22.498 -11.052,22.562 -11.031,22.723 -11.11,22.867 -11.062,23.084 -11.124,23.203 -11.102,23.436 -10.938,23.852 -11.028,23.996 -10.892,24.082 -11.398,23.971 -11.656,24.025 -11.823,23.986 -12.154,24.069 -12.265,24.076 -12.404,23.956 -12.546,23.904 -12.834,24.04 -12.991,22 -13.005,22 -15)),((12.841 -6.018,12.835 -6.011,12.868 -5.997,12.866 -6.004,12.841 -6.018)),((12.907 -5.993,12.906 -5.988,12.92 -5.981,12.918 -5.988,12.907 -5.993)),((12.943 -5.964,12.94 -5.963,12.951 -5.957,12.951 -5.961,12.943 -5.964)),((12.931 -5.929,12.923 -5.972,12.877 -5.984,12.875 -5.964,12.931 -5.929)),((12.782 -6.008,12.783 -6.001,12.79 -5.997,12.79 -6.004,12.782 -6.008)),((12.852 -5.997,12.852 -5.991,12.861 -5.993,12.859 -5.996,12.852 -5.997)),((12.755 -6.007,12.732 -5.999,12.795 -5.985,12.774 -6.002,12.755 -6.007)),((12.798 -5.998,12.794 -5.993,12.804 -5.981,12.807 -5.99,12.798 -5.998)))'
            ,4326)
        )

This does not work (for France):

SELECT 
    poi.poi_id,
    poi.poi_address_full 
FROM 
    poi
WHERE 
    ST_WITHIN(
        poi.poi_point,
        ST_GeomFromText(
            'MULTIPOLYGON(((4.579 43.399,4.595 43.406,4.582 43.431,4.516 43.455,4.148 43.477,4.122 43.547,4.051 43.557,3.635 43.378,3.511 43.273,3.312 43.254,3.149 43.139,3.039 42.942,3.05 42.55,3.139 42.515,3.175 42.435,2.947 42.482,2.674 42.405,2.672 42.341,2.533 42.333,2.257 42.438,2.017 42.349,1.935 42.454,1.73 42.495,1.786 42.574,1.737 42.618,1.494 42.653,1.44 42.604,1.357 42.719,1.17 42.708,1.079 42.788,0.708 42.861,0.645 42.783,0.676 42.691,0.36 42.724,0.293 42.675,0.176 42.736,-0.011 42.684,-0.313 42.849,-0.567 42.781,-0.725 42.891,-0.752 42.967,-0.946 42.954,-1.264 43.045,-1.309 43.07,-1.27 43.119,-1.332 43.108,-1.355 43.028,-1.444 43.049,-1.472 43.088,-1.414 43.129,-1.383 43.253,-1.514 43.294,-1.609 43.252,-1.624 43.306,-1.73 43.296,-1.791 43.373,-1.61 43.427,-1.448 43.642,-1.307 44.172,-1.26 44.543,-1.195 44.657,-1.004 44.648,-1.168 44.776,-1.262 44.632,-1.156 45.476,-1.091 45.562,-0.989 45.583,-1.237 45.706,-1.243 45.782,-1.138 45.8,-1.17 45.856,-1.076 45.907,-1.1 45.944,-1.065 45.956,-1.122 46.004,-1.053 46.004,-1.161 46.155,-1.242 46.157,-1.111 46.261,-1.123 46.302,-1.202 46.316,-1.206 46.266,-1.812 46.493,-1.857 46.61,-2.142 46.819,-2.155 46.89,-2.112 46.897,-1.98 47.029,-2.054 47.094,-2.247 47.132,-2.167 47.166,-2.17 47.268,-2.295 47.234,-2.546 47.291,-2.503 47.329,-2.558 47.376,-2.432 47.416,-2.5 47.493,-2.42 47.495,-2.633 47.506,-2.575 47.522,-2.574 47.559,-2.8 47.487,-2.92 47.548,-2.879 47.564,-2.854 47.537,-2.823 47.557,-2.731 47.542,-2.683 47.605,-2.71 47.649,-2.715 47.589,-2.794 47.645,-2.89 47.574,-2.978 47.661,-2.93 47.555,-3.129 47.597,-3.08 47.468,-3.146 47.484,-3.14 47.58,-3.211 47.642,-3.103 47.718,-3.154 47.72,-3.128 47.751,-3.215 47.696,-3.213 47.645,-3.359 47.686,-3.279 47.688,-3.365 47.71,-3.306 47.748,-3.282 47.777,-3.291 47.791,-3.279 47.794,-3.294 47.794,-3.287 47.772,-3.344 47.742,-3.388 47.814,-3.404 47.809,-3.356 47.732,-3.453 47.695,-3.525 47.809,-3.537 47.763,-3.681 47.777,-3.722 47.804,-3.698 47.818,-3.651 47.82,-3.639 47.829,-3.696 47.827,-3.733 47.803,-3.749 47.849,-3.742 47.797,-3.854 47.792,-3.946 47.904,-3.992 47.896,-3.977 47.854,-4.079 47.878,-4.1 47.863,-4.144 47.913,-4.113 47.935,-4.176 47.907,-4.113 47.862,-4.214 47.868,-4.159 47.832,-4.179 47.804,-4.374 47.798,-4.346 47.84,-4.423 47.963,-4.738 48.039,-4.374 48.11,-4.33 48.081,-4.273 48.154,-4.465 48.239,-4.554 48.168,-4.544 48.25,-4.631 48.279,-4.57 48.282,-4.583 48.319,-4.533 48.342,-4.537 48.284,-4.272 48.296,-4.289 48.274,-4.267 48.259,-4.118 48.218,-4.097 48.256,-4.24 48.254,-4.28 48.279,-4.183 48.296,-4.336 48.315,-4.261 48.36,-4.458 48.327,-4.27 48.445,-4.772 48.329,-4.746 48.366,-4.79 48.362,-4.793 48.416,-4.718 48.475,-4.775 48.519,-4.671 48.576,-4.508 48.551,-4.611 48.578,-4.597 48.608,-4.478 48.572,-4.568 48.609,-4.542 48.637,-4.341 48.677,-4.299 48.633,-4.187 48.686,-4.061 48.677,-4.007 48.727,-3.967 48.723,-3.976 48.699,-3.952 48.671,-3.953 48.619,-3.934 48.599,-3.921 48.675,-3.859 48.615,-3.811 48.629,-3.864 48.671,-3.82 48.719,-3.581 48.67,-3.549 48.746,-3.582 48.788,-3.504 48.839,-3.43 48.797,-3.224 48.868,-3.203 48.835,-3.237 48.79,-3.22 48.784,-3.168 48.853,-3.072 48.884,-3.123 48.76,-3.012 48.821,-3.046 48.785,-2.929 48.754,-2.946 48.721,-2.682 48.492,-2.682 48.531,-2.485 48.644,-2.318 48.689,-2.286 48.664,-2.338 48.62,-2.246 48.646,-2.213 48.573,-2.124 48.604,-2.15 48.633,-2.049 48.637,-1.972 48.537,-2.001 48.492,-1.942 48.52,-2.029 48.648,-1.937 48.703,-1.844 48.709,-1.867 48.635,-1.768 48.602,-1.347 48.631,-1.401 48.658,-1.372 48.694,-1.445 48.655,-1.571 48.744,-1.574 48.822,-1.614 48.834,-1.553 48.934,-1.561 48.914,-1.55 48.894,-1.556 49.025,-1.505 49.02,-1.56 49.038,-1.578 49.001,-1.599 49.037,-1.611 49.214,-1.567 49.221,-1.614 49.232,-1.627 49.211,-1.711 49.325,-1.68 49.33,-1.809 49.373,-1.888 49.535,-1.848 49.627,-1.947 49.675,-1.942 49.726,-1.62 49.643,-1.473 49.697,-1.267 49.695,-1.229 49.608,-1.306 49.539,-1.136 49.354,-0.962 49.397,-0.226 49.282,-0.087 49.298,0.136 49.405,0.341 49.435,0.121 49.463,0.067 49.51,0.19 49.705,0.58 49.852,1.195 49.968,1.448 50.105,1.546 50.214,1.682 50.181,1.538 50.281,1.556 50.361,1.633 50.365,1.558 50.405,1.583 50.535,1.59 50.539,1.599 50.527,1.663 50.506,1.577 50.572,1.562 50.725,1.601 50.724,1.611 50.804,1.581 50.867,1.853 50.971,2.121 50.986,2.149 51.034,2.177 51.007,2.19 51.018,2.166 51.044,2.546 51.089,2.633 50.946,2.59 50.919,2.599 50.85,2.726 50.809,2.796 50.725,2.906 50.692,2.952 50.752,3.151 50.79,3.258 50.701,3.287 50.528,3.613 50.492,3.71 50.303,3.747 50.351,4.023 50.359,4.135 50.257,4.208 50.273,4.127 50.135,4.2 50.131,4.231 50.073,4.136 50.019,4.197 49.955,4.446 49.937,4.694 49.996,4.693 50.085,4.823 50.168,4.897 50.138,4.79 49.969,4.888 49.906,4.855 49.792,4.999 49.799,5.165 49.693,5.269 49.696,5.332 49.654,5.315 49.611,5.428 49.597,5.471 49.497,5.771 49.563,5.972 49.491,5.982 49.451,6.256 49.51,6.548 49.427,6.602 49.367,6.566 49.347,6.739 49.164,6.834 49.151,6.837 49.213,6.935 49.222,7.034 49.19,7.054 49.113,7.101 49.156,7.294 49.115,7.445 49.184,7.635 49.054,7.935 49.058,8.227 48.974,8.092 48.806,7.84 48.641,7.733 48.395,7.744 48.326,7.577 48.12,7.569 48.034,7.622 47.972,7.512 47.697,7.585 47.577,7.388 47.433,7.181 47.441,7.2 47.494,6.983 47.494,6.999 47.452,6.879 47.352,7.016 47.372,7.057 47.334,6.943 47.288,6.955 47.243,6.7 47.039,6.433 46.929,6.465 46.89,6.438 46.762,6.111 46.576,6.157 46.545,6.064 46.416,6.17 46.368,6.102 46.285,6.124 46.251,5.964 46.197,5.995 46.183,5.957 46.128,6.135 46.141,6.31 46.244,6.238 46.277,6.304 46.367,6.39 46.34,6.513 46.405,6.805 46.394,6.774 46.348,6.865 46.28,6.797 46.139,6.897 46.124,6.873 46.052,6.937 46.065,7.045 45.922,6.94 45.847,6.818 45.835,6.812 45.726,7.001 45.64,7 45.505,7.186 45.404,7.111 45.327,7.138 45.256,7.08 45.214,6.969 45.208,6.894 45.137,6.768 45.16,6.627 45.103,6.674 45.02,6.746 45.013,6.751 44.906,7.007 44.839,7.066 44.713,7.077 44.681,6.963 44.678,6.933 44.573,6.854 44.529,6.945 44.432,6.893 44.421,6.887 44.361,7.008 44.236,7.361 44.116,7.685 44.174,7.7 44.041,7.501 43.875,7.53 43.784,7.487 43.749,7.158 43.654,7.139 43.546,6.963 43.542,6.855 43.411,6.747 43.419,6.716 43.347,6.584 43.277,6.697 43.266,6.646 43.167,6.386 43.145,6.364 43.088,6.201 43.116,6.151 43.027,6.096 43.029,6.115 43.083,5.921 43.124,5.881 43.108,5.947 43.068,5.828 43.05,5.809 43.115,5.687 43.18,5.341 43.214,5.374 43.295,5.313 43.36,5.052 43.324,4.969 43.425,4.893 43.404,4.861 43.454,4.877 43.411,4.824 43.424,4.872 43.39,4.829 43.376,4.917 43.379,4.855 43.333,4.613 43.354,4.558 43.377,4.579 43.399),(-2.931 47.605,-2.928 47.609,-2.931 47.606,-2.931 47.605),(-3.142 47.733,-3.142 47.733,-3.142 47.733,-3.142 47.733),(-3.142 47.733,-3.136 47.729,-3.136 47.735,-3.142 47.733),(-3.178 47.736,-3.179 47.737,-3.179 47.736,-3.178 47.736),(-3.179 47.736,-3.192 47.748,-3.199 47.746,-3.192 47.732,-3.179 47.736),(-3.279 47.794,-3.278 47.794,-3.278 47.795,-3.279 47.794),(-3.278 47.795,-3.275 47.795,-3.277 47.798,-3.278 47.795),(-3.388 47.814,-3.387 47.816,-3.388 47.817,-3.388 47.814),(-3.388 47.817,-3.389 47.829,-3.393 47.823,-3.388 47.817),(-3.525 47.809,-3.524 47.81,-3.529 47.811,-3.525 47.809),(-3.529 47.811,-3.54 47.828,-3.534 47.84,-3.54 47.836,-3.543 47.822,-3.529 47.811),(-3.534 47.84,-3.528 47.844,-3.528 47.845,-3.534 47.84),(-3.528 47.845,-3.523 47.849,-3.542 47.865,-3.544 47.858,-3.528 47.845),(-3.696 47.827,-3.695 47.828,-3.698 47.831,-3.696 47.827),(-4.113 47.935,-4.111 47.936,-4.111 47.938,-4.113 47.935),(-4.111 47.938,-4.094 47.962,-4.098 47.972,-4.116 47.976,-4.115 47.984,-4.117 47.975,-4.101 47.971,-4.111 47.938),(-4.105 47.943,-4.098 47.942,-4.1 47.943,-4.105 47.943),(-4.098 47.942,-4.085 47.95,-4.076 47.949,-4.083 47.954,-4.098 47.942),(-4.095 47.941,-4.095 47.941,-4.069 47.933,-4.095 47.941),(-4.183 47.838,-4.186 47.839,-4.189 47.836,-4.183 47.838),(-4.217 47.811,-4.217 47.811,-4.221 47.815,-4.217 47.811),(-4.536 48.017,-4.535 48.017,-4.535 48.017,-4.536 48.017),(-4.535 48.017,-4.53 48.035,-4.488 48.039,-4.541 48.037,-4.535 48.017),(-4.321 48.323,-4.321 48.323,-4.32 48.323,-4.321 48.323),(-4.32 48.323,-4.318 48.323,-4.317 48.325,-4.32 48.323),(-4.061 48.677,-4.057 48.67,-4.058 48.675,-4.061 48.677),(-3.859 48.615,-3.859 48.614,-3.859 48.614,-3.859 48.615),(-3.859 48.614,-3.862 48.608,-3.871 48.604,-3.85 48.604,-3.859 48.614),(1.632 50.361,1.631 50.36,1.642 50.352,1.632 50.361),(5.515 43.204,5.519 43.209,5.514 43.203,5.515 43.204),(5.006 43.47,5.082 43.4,5.23 43.465,5.145 43.459,5.114 43.523,5.021 43.556,5.006 43.47),(1.981 42.448,2.014 42.452,1.979 42.495,1.956 42.458,1.981 42.448)),((9.258 41.339,9.248 41.348,9.261 41.342,9.258 41.339)),((9.271 41.365,9.266 41.362,9.256 41.371,9.268 41.373,9.271 41.365)),((9.287 41.484,9.181 41.366,9.094 41.394,9.122 41.441,9.072 41.444,9.08 41.477,8.923 41.489,8.789 41.558,8.803 41.641,8.916 41.687,8.66 41.739,8.771 41.811,8.751 41.845,8.803 41.894,8.75 41.933,8.608 41.895,8.592 41.964,8.747 42.05,8.7 42.113,8.558 42.146,8.594 42.168,8.54 42.237,8.691 42.276,8.543 42.368,8.655 42.416,8.725 42.584,8.781 42.557,8.803 42.603,9.015 42.641,9.125 42.732,9.301 42.678,9.344 42.738,9.311 42.835,9.36 42.923,9.341 42.994,9.422 43.012,9.464 42.986,9.492 42.805,9.447 42.668,9.533 42.545,9.557 42.142,9.413 41.955,9.401 41.694,9.356 41.617,9.287 41.607,9.369 41.597,9.273 41.53,9.287 41.484)),((-2.305 46.709,-2.283 46.688,-2.399 46.724,-2.372 46.732,-2.305 46.709)),((-2.187 46.961,-2.149 46.893,-2.308 47.025,-2.226 47.017,-2.247 46.994,-2.187 46.961)),((-2.883 47.343,-2.865 47.347,-2.861 47.341,-2.885 47.332,-2.883 47.343)),((-1.177 44.691,-1.189 44.694,-1.192 44.705,-1.171 44.705,-1.177 44.691)),((-1.208 45.85,-1.232 45.802,-1.269 45.881,-1.384 45.951,-1.413 46.047,-1.238 45.984,-1.208 45.85)),((-1.113 45.953,-1.12 45.961,-1.108 45.959,-1.113 45.953)),((-1.176 46.008,-1.173 46.024,-1.154 46.019,-1.171 46.019,-1.176 46.008)),((-1.284 46.145,-1.532 46.202,-1.563 46.245,-1.49 46.254,-1.486 46.202,-1.412 46.23,-1.444 46.214,-1.293 46.187,-1.255 46.164,-1.284 46.145)),((-1.298 46.294,-1.298 46.294,-1.298 46.294,-1.298 46.294)),((-1.288 46.289,-1.272 46.29,-1.288 46.289,-1.288 46.289)),((-1.298 46.294,-1.282 46.292,-1.294 46.289,-1.298 46.294)),((5.779 43.076,5.781 43.087,5.789 43.083,5.779 43.076)),((6.244 43.02,6.205 42.982,6.163 43,6.211 43.002,6.244 43.02)),((6.435 43.016,6.473 43.047,6.511 43.047,6.439 43.004,6.435 43.016)),((6.397 42.993,6.37 43.001,6.421 43.014,6.407 42.997,6.397 42.993)),((6.361 43.01,6.358 43.014,6.364 43.024,6.367 43.023,6.361 43.01)),((5.288 43.268,5.29 43.277,5.306 43.28,5.288 43.268)),((5.312 43.29,5.292 43.285,5.318 43.293,5.312 43.29)),((7.067 43.514,7.043 43.516,7.031 43.522,7.071 43.517,7.067 43.514)),((-4.846 48.032,-4.87 48.041,-4.853 48.04,-4.846 48.032)),((-4.859 48.346,-4.867 48.348,-4.847 48.36,-4.859 48.346)),((-4.959 48.389,-4.965 48.393,-4.961 48.402,-4.953 48.396,-4.959 48.389)),((-5.073 48.483,-5.033 48.463,-5.139 48.45,-5.077 48.474,-5.073 48.483)),((4.577 43.398,4.571 43.399,4.585 43.406,4.579 43.399,4.577 43.398)),((-4.054 47.854,-4.088 47.862,-4.057 47.856,-4.054 47.854)),((-3.121 47.323,-3.056 47.308,-3.219 47.294,-3.262 47.371,-3.121 47.323)),((-2.948 47.373,-2.994 47.4,-2.939 47.395,-2.948 47.373)),((-2.766 47.539,-2.767 47.544,-2.766 47.539,-2.766 47.539)),((-3.422 47.62,-3.462 47.62,-3.515 47.648,-3.429 47.642,-3.422 47.62)),((-2.716 47.583,-2.715 47.582,-2.716 47.583,-2.716 47.583)),((-2.859 47.56,-2.856 47.591,-2.838 47.607,-2.826 47.588,-2.859 47.56)),((-2.716 47.583,-2.718 47.588,-2.711 47.588,-2.716 47.583)),((-2.81 47.578,-2.809 47.592,-2.788 47.6,-2.787 47.595,-2.81 47.578)),((-4.176 47.851,-4.177 47.846,-4.186 47.86,-4.182 47.861,-4.176 47.851)),((-3.931 48.699,-3.926 48.688,-3.929 48.685,-3.934 48.698,-3.931 48.699)),((-3.992 48.736,-4.023 48.739,-4.04 48.747,-4.006 48.752,-3.992 48.736)),((-3.584 48.794,-3.584 48.805,-3.563 48.805,-3.57 48.797,-3.584 48.794)),((-3.01 48.855,-2.998 48.852,-3 48.842,-3.017 48.842,-3.01 48.855)),((-2.991 48.867,-3.003 48.856,-3.017 48.86,-2.991 48.867)),((-3.2 48.879,-3.184 48.877,-3.185 48.87,-3.191 48.869,-3.2 48.879)),((-1.825 48.875,-1.836 48.874,-1.842 48.882,-1.825 48.875)),((-1.63 49.658,-1.629 49.66,-1.615 49.658,-1.63 49.658)))'
            ,4326)
        )        
        

The error it gives is this:

3037 – Invalid GIS data provided to function st_within.

Data comes from the geonames shapes_simplified_low.txt file here: http://download.geonames.org/export/dump/

MySQL version: 5.7.23

It seems like small MultiPolygons work but the larger ones don't. I've tried this on many countries and all single Polygons work, so I haven't included an example of that here.

The poi_point value is stored as a MYSQL POINT value with a set SRID of 4326.

Does anyone have any idea what is happening?

Best Answer

You have an invalid member in the multipolygon. Starting from position 11168:

((-2.766 47.539,-2.767 47.544,-2.766 47.539,-2.766 47.539))

There are only two distinct vertices (A and B) and the ring goes like A-B-A-A. It does not make a valid polygon.