[postgis-users] ST_Intersection does not preserve M value

Marcin Mionskowski mionskowskimarcin at gmail.com
Mon May 6 04:13:20 PDT 2019


1. What values do you want to assign to intersections of lines and
polygons (if not on vertices)?
2. You can try with ST_DumpPoints, but this will "recreate" only those
segments that are completely within intersecting polygon:

with 
l as ( -- linestringm
	select st_makeline(st_makepointm(1,1,30),st_makepointm(3,3,60))
geom
	)
, a as ( -- intersecting polygon
	select
st_makepolygon(st_makeline(array[st_makepoint(2,2),st_makepoint(2,4),st
_makepoint(4,4),st_makepoint(4,2),st_makepoint(2,2)])) geom
	)
, p as ( -- points dump
	select (st_dumppoints(geom)).geom from l
	)
select st_astext(st_makeline(array_agg(p.geom)))
from a,p
where st_intersects(p.geom,a.geom)


W dniu śro, 01.05.2019 o godzinie 19∶19 -0700, użytkownik Bo Guo
napisał:
> Hi there,
> 
> I was trying to cut a portion of the LRS route with an area using 
> ST_Intersection.  However the resulting route no longer carries
> measure 
> value.  The behavior is the same for version 9.6 or the latest
> version 
> 11.  Anyone has any suggestions?
> 
> Thanks!
> 
> Bo
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users



More information about the postgis-users mailing list