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
Copy file name to clipboardExpand all lines: README.md
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,6 @@ Please check the documentation for your MySQL version. MySQL's Extension for Spa
17
17
18
18
This package also works with MariaDB. Please refer to the [MySQL/MariaDB Spatial Support Matrix](https://mariadb.com/kb/en/library/mysqlmariadb-spatial-support-matrix/) for compatibility.
19
19
20
-
[TOC]
21
-
22
20
## Installation
23
21
24
22
Add the package using composer:
@@ -154,6 +152,7 @@ $place1->area = new Polygon([new LineString([
154
152
new Point(40.74837050671544, -73.98482501506805),
155
153
new Point(40.74894149554006, -73.98615270853043)
156
154
])]);
155
+
$place1->save();
157
156
158
157
$place1->area = new Polygon();
159
158
@@ -290,6 +289,7 @@ for($polygon as $i => $linestring) {
290
289
##### From/To Well Known Text ([WKT](https://dev.mysql.com/doc/refman/5.7/en/gis-data-formats.html#gis-wkt-format))
The Geometry classes implement [`JsonSerializable`](http://php.net/manual/en/class.jsonserializable.php) and `Illuminate\Contracts\Support\Jsonable`and with the help of [jmikola/geojson](https://github.com/jmikola/geojson), we can easily serialize/deserialize GeoJSON:
309
+
The Geometry classes implement [`JsonSerializable`](http://php.net/manual/en/class.jsonserializable.php) and `Illuminate\Contracts\Support\Jsonable`to help serialize into GeoJSON:
310
310
311
311
```php
312
312
$point = new Point(10, 20);
@@ -324,7 +324,11 @@ json_encode($point); // or $point->toJson();
324
324
// ]
325
325
// }
326
326
// }
327
+
```
327
328
329
+
To deserialize a GeoJSON string into a Geometry class, you can use `Geometry::fromJson($json_string)` :
0 commit comments