-
Notifications
You must be signed in to change notification settings - Fork 268
Open
Description
Hello and thank you for this library.
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))) {
throw new Exception("Cannot construct Point. x and y should be numeric");
}
// Check to see if this is a 3D point
if ($z !== NULL) {
if (!is_numeric(trim($z))) {
throw new Exception("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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels