Skip to content

Commit

Permalink
Reverted geodata changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Severino committed Oct 14, 2024
1 parent aeda2f5 commit 379cad8
Show file tree
Hide file tree
Showing 4 changed files with 1,929 additions and 2,604 deletions.
19 changes: 12 additions & 7 deletions app/Geodata.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace App;

use Clickbar\Magellan\Data\Geometries\Geometry;
use Clickbar\Magellan\Database\Eloquent\HasPostgisColumns;
use Clickbar\Magellan\IO\Parser\WKT\WKTParser;
use Illuminate\Support\Facades\DB;
use MStaack\LaravelPostgis\Geometries\Geometry;
use MStaack\LaravelPostgis\Eloquent\PostgisTrait;
use MStaack\LaravelPostgis\Exceptions\UnknownWKTTypeException;

class Geodata
{
use HasPostgisColumns;
use PostgisTrait;

protected static $availableGeometryTypes = [
'Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon'
Expand All @@ -27,9 +27,14 @@ public static function getAvailableGeometryTypes() {
* @return Geometry
* @throws \Clickbar\Magellan\Exceptions\InvalidWKTException
*/
public static function parseWkt(string $wkt) :Geometry {
$parser = app(WKTParser::class);
return $parser->parse($wkt);
public static function parseWkt($wkt) {
try {
$geom = Geometry::getWKTClass($wkt);
$parsed = $geom::fromWKT($wkt);
return $parsed;
} catch(UnknownWKTTypeException $e) {
return null;
}
}

public static function arrayToWkt($arr) {
Expand Down
Loading

0 comments on commit 379cad8

Please sign in to comment.