<div dir="ltr"><div>Hi,</div><div><br></div><div>I have spent over a week trying to work this out. I have an existing road network and have used pgr_alphashape to try and get a 400m walking catchment from bus stops. </div>
<div><br></div><div>But pgr_alphashape snapes to the nearest network node which means catchments returned are significantly smaller than 400m. I have therefore tried to create a new network with nodes every 50m using ST_Segmentize but I can't seem to get it to work.</div>
<div><br></div><div>The function below is my attempt to loop through the existing network and run ST_Segmentize on each entry to return updated network with additional nodes but it only returns one record each time rather than a number of segmented entries.</div>
<div><br></div><div>Any advice on how to make this work or alternative approach would be greately appreciated (especially given that following over a week and research it seems no one else has had this problem).</div><div>
<br></div><div>Regards</div><div>Adam</div><div><br></div><div><br></div><br><div><br></div><div><div>DROP FUNCTION hutt_pax.my_test_function();</div><div>CREATE OR REPLACE FUNCTION hutt_pax.my_test_function()</div><div> RETURNS TABLE (</div>
<div><span class="" style="white-space:pre"> </span>xid integer, </div><div><span class="" style="white-space:pre"> </span>xgeog geometry) AS</div><div>$BODY$</div><div>DECLARE</div><div> r hutt_pax.roads_wainuiomata%ROWTYPE;</div>
<div>BEGIN</div><div>FOR r IN</div><div><span class="" style="white-space:pre"> </span>SELECT *</div><div><span class="" style="white-space:pre"> </span>FROM hutt_pax.roads_wainuiomata</div><div>LOOP</div><div><br></div><div>
<span class="" style="white-space:pre"> </span>xid := <a href="http://r.id">r.id</a>;</div><div><span class="" style="white-space:pre"> </span>xgeog := ST_Segmentize(</div><div><span class="" style="white-space:pre"> </span>r.geom,</div>
<div><span class="" style="white-space:pre"> </span>0.050</div><div><span class="" style="white-space:pre"> </span>);</div><div><br></div><div><span class="" style="white-space:pre"> </span>RETURN NEXT;</div><div><span class="" style="white-space:pre"> </span></div>
<div>END LOOP;</div><div><br></div><div>RETURN NEXT; -- return final result</div><div><br></div><div>END;</div><div>$BODY$ LANGUAGE plpgsql STABLE;</div><div><br></div><div>SELECT * </div><div>FROM hutt_pax.my_test_function();</div>
</div><div><br></div></div>