From 04a085d2f9de98d519d3727e133e551eeaba316c Mon Sep 17 00:00:00 2001 From: werrolf Date: Tue, 14 Jun 2022 09:20:53 +0200 Subject: [PATCH 1/3] [NFC] document FeatureType srid parameter --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cad90fb..6eeb536 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ DataStore configuration supports the following values: | fields | list of strings | names of columns to load into DataItem / Feature objects | null (=auto-detect columns) | | filter | string | valid SQL where clause to build into all `search` invocations | null | | geomField (FeatureType only) | string | name of the geometry column | "geom" | +| srid (FeatureType only) | integer or null | Source srid of `geomField`; used only if detection fails (certain views) | null | NOTE: you should _not_ attempt placing spatial data into the "default" database containing your Doctrine entities. You _will_ encounter errors running Doctrine schema updates. From c69fb5605a413055fea6120520f5fca0b9b24bd0 Mon Sep 17 00:00:00 2001 From: werrolf Date: Tue, 14 Jun 2022 09:30:51 +0200 Subject: [PATCH 2/3] Improve exception message usability if srid detection fails --- Component/FeatureType.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Component/FeatureType.php b/Component/FeatureType.php index dfffccd..87e88df 100644 --- a/Component/FeatureType.php +++ b/Component/FeatureType.php @@ -294,6 +294,11 @@ public function itemFromArray(array $values) public function getSrid() { $this->srid = $this->srid ?: $this->getTableMetaData()->getColumn($this->geomField)->getSrid() ?: $this->configuredSrid; + if (!$this->srid) { + # Throw a decently helpful exception now instead of throwing a + # hard to parse one ("Invalid sridTo 0") later. + throw new \RuntimeException("SRID detection failure on {$this->tableName}.{$this->geomField}; must supply an 'srid' value in your featuretype configuration"); + } return $this->srid; } From ec1145d5d4fe6b60a03bc0d88375f218cd9c689d Mon Sep 17 00:00:00 2001 From: werrolf Date: Tue, 14 Jun 2022 09:31:14 +0200 Subject: [PATCH 3/3] [NFC] collect changes, mark as 0.1.29 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 302928b..0bf3075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.29 +* Re-add support for explicitly preconfiguring source table srid on FeatureType; only used if detection fails (e.g. views using geometry expressions) + ## 0.1.28 * Fix missing detection for native double precision columns when picking default for non-nullable numeric column (see [Mapbender #1396](https://github.com/mapbender/mapbender/issues/1396)) * Fix explicitly entered "0" not saving to nullable numeric columns