You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue on loading WKT with extra spaces, for instance:
$geo = \geoPHP::load('POINT ( 1 1 )', 'wkt');
As I can see at Point.class.php the basic validation is failing due to the trailing space on the first coordinate. I know I can clean my data by removing these spaces, but the point is that POINT ( 1 1 ) is valid WKT, and I guess geoPHP should parse it correctly.
I guess that trimming the input could solve this issue:
Point.class.php:
if (!is_numeric(trim($x)) || !is_numeric(trim($y))) {
thrownewException("Cannot construct Point. x and y should be numeric");
}
// Check to see if this is a 3D pointif ($z !== NULL) {
if (!is_numeric(trim($z))) {
thrownewException("Cannot construct Point. z should be numeric");
}
$this->dimension = 3;
}
The floatval below also trims the values, so there is no need to repeat the trim after the validation.
The text was updated successfully, but these errors were encountered:
Hello and thank you for this library.
I'm having an issue on loading WKT with extra spaces, for instance:
As I can see at Point.class.php the basic validation is failing due to the trailing space on the first coordinate. I know I can clean my data by removing these spaces, but the point is that
POINT ( 1 1 )
is valid WKT, and I guess geoPHP should parse it correctly.I guess that trimming the input could solve this issue:
Point.class.php:
The
floatval
below also trims the values, so there is no need to repeat the trim after the validation.The text was updated successfully, but these errors were encountered: