Skip to content

Commit

Permalink
Reflect geometry updates in README
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r0x committed Jul 14, 2017
1 parent 6b0bce6 commit 525efc6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ other methods:
All models which are to be PostGis enabled **must** use the *PostgisTrait*.

You must also define an array called `$postgisFields` which defines
what attributes/columns on your model are to be considered geometry objects.
what attributes/columns on your model are to be considered geometry objects. By default, all attributes are of type `geography`. If you want to use `geometry` with a custom SRID, you have to define an array called `$postgisTypes`. The keys of this assoc array must match the entries in `$postgisFields` (all missing keys default to `geography`), the values are assoc arrays, too. They must have two keys: `geomtype` which is either `geography` or `geometry` and `srid` which is the desired SRID. **Note**: Custom SRID is only supported for `geometry`, not `geography`.

```PHP
use Illuminate\Database\Eloquent\Model;
Expand All @@ -129,6 +129,14 @@ class Location extends Model
];

protected $postgisFields = [
'location',
'location2',
'location3',
'polygon',
'polygon2'
];

protected $postgisTypes = [
'location' => [
'geomtype' => 'geography',
'srid' => 4326
Expand All @@ -149,8 +157,7 @@ class Location extends Model
'geomtype' => 'geometry',
'srid' => 27700
]
];

]
}

$linestring = new LineString(
Expand Down

0 comments on commit 525efc6

Please sign in to comment.