Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error when editing a layer with two geometries #4919

Open
1 task done
MoToLux85 opened this issue Oct 25, 2024 · 1 comment
Open
1 task done

[Bug]: Error when editing a layer with two geometries #4919

MoToLux85 opened this issue Oct 25, 2024 · 1 comment
Labels

Comments

@MoToLux85
Copy link

What is the bug? (in English)

Hi,
we have created a table in a PostgreSQL-PostGIS database, that has a point geometry and a polygon geometry as attributes.

When creating an entry in this database table using Lizmap, no errors occur. However, when I want to edit the point geometry and the corresponding entry in the database table also has a polygon geometry, I get the following error message (see screenshot attached):
invalid request(ERROR: parse error - invalid geometry HINT: '01' <-- parse error at position 2 within geometry(SELECT GeometryType(ST_GeomFromText(‘0106000020787F0000010000000103000000010000000600000000E87F1898A212414C3BC9F509F754411C10BDE8AAA31241011B946E07F754414265313685A31241F6B1B4D319F7544142045515AAA21241DCB24D0B1AF7544142045515AAA21241DCB24D0B1AF7544100E87F1898A212414C3BC9F509F75441’, 32632)) as geomtype))

Screenshot

The error does not occur if I change another attribute of the entry at the same time as the point geometry (e.g. the value for the 'Test Dropdown' attribute in the test example here: https://test.siasportail.lu/, login with user 'test' and password 'test123456789'). The error will also not occur if only point geometry and no polygon geometry exists for the entry.

We assume that the error is due to Lizmap, as the described editing is possible in the corresponding QGIS project without error messages

Additional information: In QGIS - as well as in Lizmap - the PostgreSQL-PostGIS database table (which contains the point & polygon geometries) is displayed as two separate layers. However, both layers access the same table with two geometries in the database.

Why is a database table with two geometries useful for us? One advantage is that a Lizmap user only has to create a point and a database trigger reads the polygon geometry, e.g. of the cadastral parcel / property on which the point is located, from a property layer and stores it in the database table. This saves the user from having to 'redraw' the property, he only has to draw the point and the polygon geometry of the property is automatically stored in the table. Maybe there are other solutions for this advantage?

Steps to reproduce the issue

  1. Edit the geometry of a point of an entry that does not contain a polygon geometry in the test example https://test.siasportail.lu (all points that do not have labels 3 or 1): These can be edited without an error message.
  2. Edit the geometry of a point of an entry that also has a polygon geometry (points with labels 3 or 1): The above mentioned error message appears.
  3. Edit the geometry of a point of an entry that also has a polygon geometry (points with labels 3 or 1) and change the 'Test dropdown' attribute at the same time: Editing is possible.

Versions, safeguards, check summary etc

Versions :

  • Lizmap Web Client : 3.7.10
  • Lizmap plugin : 4.3.24
  • QGIS Desktop : 3.34.4
  • QGIS Server : 3.34.11
  • Py-QGIS-Server : not used
  • QGIS Server plugin atlasprint : 3.4.1
  • QGIS Server plugin lizmap_server : 2.10.0
  • QGIS Server plugin wfsOutputExtension : not found
List of safeguards :
  • Mode : normal
  • Allow parent folder : no
  • Prevent other drive : yes
  • Prevent PG service : no
  • Prevent PG Auth DB : yes
  • Force PG user&pass : yes
  • Prevent ECW : yes

Check Lizmap plugin

  • I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

Operating system

Ubuntu 22.04

Browsers

Firefox, Chrome

Browsers version

Firefox 131.0.3, Chrome 130.0.6723.59

Relevant log output

No response

@MoToLux85 MoToLux85 added the bug label Oct 25, 2024
@nworr
Copy link
Contributor

nworr commented Oct 25, 2024

Quick code analysis :
In QgisForm constructor, a control is created for each table column , in this case, the polygon column is handled as a "simple" type and is raw added as text in a hidden form control.

public function __construct($layer, $form, $featureId, $loginFilteredOverride, App\AppContextInterface $appContext)

When form is submitted, value is checking according to column type and value is not as expected (WKT)

$value = $this->layer->getGeometryAsSql($value);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants