Skip to content

Commit 2a701a9

Browse files
committed
Additional documentation fixes 📖
1 parent b94e861 commit 2a701a9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Please check the documentation for your MySQL version. MySQL's Extension for Spa
1717

1818
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.
1919

20-
[TOC]
21-
2220
## Installation
2321

2422
Add the package using composer:
@@ -154,6 +152,7 @@ $place1->area = new Polygon([new LineString([
154152
new Point(40.74837050671544, -73.98482501506805),
155153
new Point(40.74894149554006, -73.98615270853043)
156154
])]);
155+
$place1->save();
157156

158157
$place1->area = new Polygon();
159158

@@ -290,6 +289,7 @@ for($polygon as $i => $linestring) {
290289
##### From/To Well Known Text ([WKT](https://dev.mysql.com/doc/refman/5.7/en/gis-data-formats.html#gis-wkt-format))
291290

292291
```php
292+
// fromWKT($wkt)
293293
$polygon = Polygon::fromWKT('POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))');
294294

295295
$polygon->toWKT(); // POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))
@@ -306,7 +306,7 @@ $polygon = Polygon::fromString('(0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)')
306306

307307
##### From/To JSON ([GeoJSON](http://geojson.org/))
308308

309-
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:
310310

311311
```php
312312
$point = new Point(10, 20);
@@ -324,7 +324,11 @@ json_encode($point); // or $point->toJson();
324324
// ]
325325
// }
326326
// }
327+
```
327328

329+
To deserialize a GeoJSON string into a Geometry class, you can use `Geometry::fromJson($json_string)` :
330+
331+
```php
328332
$locaction = Geometry::fromJson('{"type":"Point","coordinates":[3.4,1.2]}');
329333
$location instanceof Point::class; // true
330334
$location->getLat(); // 1.2

0 commit comments

Comments
 (0)