mjaschen / phpgeo

Simple Yet Powerful Geo Library for PHP
https://phpgeo.marcusjaschen.de
MIT License
1.55k stars 195 forks source link

Explanation of warning for non-geo wiz #87

Open UVLabs opened 2 years ago

UVLabs commented 2 years ago

Can you please explain the line:

Warning: The calculation gives wrong results if the polygons has points on both sides of the 180/-180 degrees meridian.

Maybe you can give a visual example of when these results would be wrong? I'm looking to use this library for shipping calculations where "shipping zones" will be created and the shipping cost will be determined by which polygon the customer's current location falls within. So needless to say wrong results can result in incontinences for the store trying to explain that it was a mistake to customers.

Currently I'm making use of the Google Maps API Geometry library for this: https://developers.google.com/maps/documentation/javascript/examples/poly-containsLocation but I'd like to use PHP instead if i can find a library which is suitable