Skip to content

Commit

Permalink
Merge pull request #56 from bricehartmann/bugfix/multipolygon-wkt-par…
Browse files Browse the repository at this point in the history
…sing

Multipolygon WKT Parsing Bugfix
  • Loading branch information
grimzy authored Jul 26, 2018
2 parents 99c02b2 + 388d600 commit 34c10e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Types/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function toPair()

public static function fromPair($pair)
{
list($lng, $lat) = explode(' ', trim($pair));
list($lng, $lat) = explode(' ', trim($pair, "\t\n\r \x0B()"));

return new static((float) $lat, (float) $lng);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Unit/Types/MultiPolygonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public function testFromWKT()
$this->assertInstanceOf(MultiPolygon::class, $polygon);

$this->assertEquals(2, $polygon->count());

$polygon = MultiPolygon::fromWKT('MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)))');
$this->assertInstanceOf(MultiPolygon::class, $polygon);

$this->assertEquals(2, $polygon->count());

$this->assertEquals('MULTIPOLYGON(((30 20,45 40,10 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))', $polygon->toWKT());
}

public function testToWKT()
Expand Down

0 comments on commit 34c10e4

Please sign in to comment.