I am not able to st_split a line with a point on it.
I have a linestring and a point in epsg:3857 coordinate system. Their distance is 0:
select st_distance( st_geomfromtext('LineString (2121053.78109818324446678 6023680.98843276314437389, 2121127.97553879721090198 6023651.31408391986042261)',3857), st_geomfromtext('Point (2121091.12965324986726046 6023666.05073604825884104)',3857) ); st_distance ------------- 0 (1 row) The split returns the original line:
select st_astext(st_split( st_geomfromtext('LineString (2121053.78109818324446678 6023680.98843276314437389, 2121127.97553879721090198 6023651.31408391986042261)',3857), st_geomfromtext('Point (2121091.12965324986726046 6023666.05073604825884104)',3857) )); st_astext ---------------------------------------------------------------------------------------------------- GEOMETRYCOLLECTION(LINESTRING(2121053.78109818 6023680.98843276,2121127.9755388 6023651.31408392)) (1 row) The same result if I try to snap the point on the line with st_closestpoint:
select st_Astext(st_split( st_geomfromtext('LineString (2121053.78109818324446678 6023680.98843276314437389, 2121127.97553879721090198 6023651.31408391986042261)',3857), st_closestpoint( st_geomfromtext('LineString (2121053.78109818324446678 6023680.98843276314437389, 2121127.97553879721090198 6023651.31408391986042261)',3857), st_geomfromtext('Point (2121091.12965324986726046 6023666.05073604825884104)',3857) ))); st_astext ---------------------------------------------------------------------------------------------------- GEOMETRYCOLLECTION(LINESTRING(2121053.78109818 6023680.98843276,2121127.9755388 6023651.31408392)) (1 row) Postgis version:
postgis_full_version --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- POSTGIS="2.3.2 r15302" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.3, released 2015/09/16" LIBXML="2.9.3" LIBJSON="0.11.99" RASTER (1 row) I'm on Debian 16.04 xenial and postgresql-9.6-postgis-2.3 from pgdg repository.
This might be related (this is why I upgraded from postgis 2.2.1):