Forum

laravel/mysql - how...
 
Notifications
Clear all

laravel/mysql - how to insert polygon object

1 Posty
1 Users
0 Reactions
688 Widok
0
Topic starter

example

1 Answer
0
Topic starter

Remember: First and last point HAVE TO BE same. if not then expect 

error Invalid parameter value: 3037 Invalid GIS data provided to function st_geomfromtext

example

$mysqlStringPolygon = "POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))";
        
$coords = new MapCoord();
$coords->polygon =  \DB::raw("ST_GeomFromText('$mysqlStringPolygon')");
$coords->save();

or use https://github.com/grimzy/laravel-mysql-spatial

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: