I created a small web app based on PostGIS / Geoserver / Leaflet. I can draw polylines from my interface thanks to the Leaflet Draw plugin and send them to PostGIS with a Php and Ajax script. When my polyline is inserted into PostGIS, a trigger is fired which updates the geometry in my PostGIS table from the received coordinates.
My current problem is that I would like that when I draw a polyline from my interface, my trigger would convert that polyline to a curve as well. So I looked towards ST_LineToCurve and ST_ForceCurve.
Here is the script in my trigger:
update schema.table SET geom = ST_Transform (ST_GeomFromText ('MULTILINESTRING ((' || coords || '))', 4326), 2154) WHERE geom isnull;
I tried in PostGIS:
SELECT ST_ForceCurve (ST_Transform (ST_GeomFromText ('MULTILINESTRING ((' || coords || '))', 4326), 2154)) FROM schema.table
Which returns geometries in my table, but which displays "unsupported geometries not rendered" in the geometry viewer.
When I do :
SELECT ST_AsText (ST_ForceCurve (ST_Transform (ST_GeomFromText ('MULTILINESTRING ((' || coords || '))', 4326), 2154))) FROM schema.table
the geometries returned in my table are indeed in the form "multicurve".
Now if I add St_ForceCurve in my trigger, nothing is sent to my table.