We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have an array of coordinates, which I am passing to the controller and then parse it into an "array of Points" as follows:
Log::info($request->polygon); $arrayOfPoints = []; foreach( $request->polygon as $point ){ $arrayOfPoints[] = new Point($point[0], $point[1]); } Log::info(new Polygon($arrayOfPoints)); // Line 28
And immediately I get the following error:
[2017-08-22 20:44:51] local.INFO: array ( 0 => array ( 0 => '-99.16897058486938', 1 => '19.424870411471588', ), 1 => array ( 0 => '-99.16744709014893', 1 => '19.424769230105948', ), 2 => array ( 0 => '-99.16781187057495', 1 => '19.423433630174305', ), 3 => array ( 0 => '-99.16882038116455', 1 => '19.4236764673421', ), ) [2017-08-22 20:44:51] local.ERROR: exception 'InvalidArgumentException' with message '$linestrings must be an array of Points' in /Library/WebServer/Documents/private/private/vendor/grimzy/laravel-mysql-spatial/src/Types/MultiLineString.php:29 Stack trace: #0 /Library/WebServer/Documents/private/private/app/Http/Controllers/LocationController.php(28): Grimzy\LaravelMysqlSpatial\Types\MultiLineString->__construct(Array) #1 [internal function]: App\Http\Controllers\LocationController->create(Object(Illuminate\Http\Request))
The text was updated successfully, but these errors were encountered:
Polygon extends MultiLineString, so you need to pass an array of LineString to instantiate it.
Polygon extends MultiLineString
LineString
$arrayOfPoints = []; foreach($request->polygon as $point) { $arrayOfPoints[] = new Point($point[0], $point[1]); } $lineString = new LineString($arrayOfPoints); $polygon = new Polygon([$lineString]);
MySQL POLYGON supports both the exterior and interior boundaries.
POLYGON
Sorry, something went wrong.
Thank you
No branches or pull requests
I have an array of coordinates, which I am passing to the controller and then parse it into an "array of Points" as follows:
And immediately I get the following error:
[2017-08-22 20:44:51] local.INFO: array (
0 =>
array (
0 => '-99.16897058486938',
1 => '19.424870411471588',
),
1 =>
array (
0 => '-99.16744709014893',
1 => '19.424769230105948',
),
2 =>
array (
0 => '-99.16781187057495',
1 => '19.423433630174305',
),
3 =>
array (
0 => '-99.16882038116455',
1 => '19.4236764673421',
),
)
[2017-08-22 20:44:51] local.ERROR: exception 'InvalidArgumentException' with message '$linestrings must be an array of Points' in /Library/WebServer/Documents/private/private/vendor/grimzy/laravel-mysql-spatial/src/Types/MultiLineString.php:29
Stack trace:
#0 /Library/WebServer/Documents/private/private/app/Http/Controllers/LocationController.php(28): Grimzy\LaravelMysqlSpatial\Types\MultiLineString->__construct(Array)
#1 [internal function]: App\Http\Controllers\LocationController->create(Object(Illuminate\Http\Request))
The text was updated successfully, but these errors were encountered: