If you want the GIS programmers, you should be asking in the Winnipeg GIS Users Group, I think?
-Adam

From: Trevor Cordes <trevor@tecnopolis.ca>
Sent: June 18, 2025 01:57
To: MUUG RndTbl <roundtable@muug.ca>
Subject: [RndTbl] Re: mysql GIS oddity: PointOnSurface not Contained?
 
Further to my GIS PointOnSurface (POS) email, which didn't garner any
replies (no GIS programmers here?), I managed to "solve" it by doing
both POS and Centroid and making sure I use the point returned by the
function that actually gives me a point that is actually ST_Within() the
polygon(s) (according to MariaDB).

ST_Centroid actually turned out to be much better, only failing on one
state... guesses? ... Hawaii.  Ya, guess the centroid of those polygons
is somewhere in the pacific.

This still isn't a real solution because a centroid AND POS could both
not give me a mysql-happy point within the state, but since these
things almost never change, and weird states are already rare, it
should be good enough for now.  And when Mysql/Maria give me some
better functions, like other systems do, I can just switch to using
those.

Here's the states and whether they pass the centroid ("c") and POS
("pos") tests or not.  Note how many fail POS.

+------+------+------+
| abbr | c    | pos  |
+------+------+------+
| AL   |    1 |    1 |
| AK   |    1 |    1 |
| AB   |    1 |    1 |
| AZ   |    1 |    0 |
| AR   |    1 |    1 |
| BC   |    1 |    1 |
| CA   |    1 |    1 |
| CO   |    1 |    1 |
| CT   |    1 |    1 |
| DE   |    1 |    1 |
| DC   |    1 |    1 |
| FL   |    1 |    1 |
| GA   |    1 |    1 |
| HI   |    0 |    1 |
| ID   |    1 |    1 |
| IL   |    1 |    1 |
| IN   |    1 |    1 |
| IA   |    1 |    1 |
| KS   |    1 |    1 |
| KY   |    1 |    0 |
| LA   |    1 |    1 |
| ME   |    1 |    1 |
| MB   |    1 |    1 |
| MD   |    1 |    1 |
| MA   |    1 |    0 |
| MI   |    1 |    1 |
| MN   |    1 |    0 |
| MS   |    1 |    1 |
| MO   |    1 |    1 |
| MT   |    1 |    1 |
| NE   |    1 |    0 |
| NV   |    1 |    0 |
| NB   |    1 |    1 |
| NH   |    1 |    1 |
| NJ   |    1 |    1 |
| NM   |    1 |    1 |
| NY   |    1 |    1 |
| NL   |    1 |    1 |
| NC   |    1 |    1 |
| ND   |    1 |    1 |
| NT   |    1 |    1 |
| NS   |    1 |    1 |
| NU   |    1 |    1 |
| OH   |    1 |    1 |
| OK   |    1 |    1 |
| ON   |    1 |    1 |
| OR   |    1 |    0 |
| PA   |    1 |    1 |
| PE   |    1 |    1 |
| PR   |    1 |    1 |
| QC   |    1 |    1 |
| RI   |    1 |    1 |
| SK   |    1 |    1 |
| SC   |    1 |    1 |
| SD   |    1 |    1 |
| TN   |    1 |    1 |
| TX   |    1 |    0 |
| UT   |    1 |    1 |
| VT   |    1 |    1 |
| VA   |    1 |    1 |
| WA   |    1 |    1 |
| WV   |    1 |    1 |
| WI   |    1 |    0 |
| WY   |    1 |    1 |
| YT   |    1 |    1 |
+------+------+------+
_______________________________________________
Roundtable mailing list -- roundtable@muug.ca
To unsubscribe send an email to roundtable-leave@muug.ca