POLYGON ((9.7341636746652 53.602429343963, 9.7348547759043 53.602581621115, 9.7349703592438 53.602403251875, 9.7342780039437 53.602247803529))
This is not valid WKT. A polygon must have the same point at the beginning and end to close itself.
When I press save, I get an error thrown:
Geometry : Specified location data is invalid"
The validation that happens when clicking “Save” is performed by the Geofield module, which uses GeoPHP to parse the WKT. It shows this message if GeoPHP throws any exceptions during the reading of the WKT.
I press the button “Find using files field” and the area appears correctly on the map
The “Find using files field” button is only for parsing KML files that are uploaded to the Files field. However, it has the secondary effect of re-rendering the map using the geometry in the Data field (which would be populated from the KML file, if there were a KML file. In this case there wasn’t, so it just reads the data that was pasted into it.)
When that happens, OpenLayers is responsible for taking the WKT in the Data field and rendering it on the map. It does not pass through GeoPHP at all.
So it seems that OpenLayers is more permissive of reading polygon WKT. Perhaps they (or one of their dependencies for parsing WKT) have some logic that auto-connects the last point of a polygon if it is missing. That would explain why it then shows up on the map.
Then if I use the map Edit tool and drag a corner of the polygon, the geometry value is updated just slightly! A 5th set of coordinates is added, equal to the first:
When you edit the points using the edit tool in the map, what actually happens is: OpenLayers has its own internal representation of the geometry being edited, and when a change is made to it the farmOS-map library converts it to WKT (using methods provided by OpenLayers) and updates the Data field with the new geometry.
So this indicates that OpenLayers does output correct WKT, even if it allows importing incorrect WKT.
I copied the polygon string from from the area edit dialog from another instance (self installed on a VM), where I manually created the area beforehand.
There I can use the polygon string to recreate another area, yet not in the Farmier instance.
This is interesting… you were able to save the incorrect WKT in your own self-hosted instance of farmOS? It sounds to me like THAT is the bug. You should not have been able to save that WKT. What version of farmOS are you self-hosting?