<div dir="ltr">Hi,<br><br>If baseline is straight and can be drawn, I was thinking about linear<br>referencing to identify steps for perpendicular lines, then using<br>translate/rotate operations to move the centerline to each point and<br>

to rotate it to create perpendicular segments.<br>Then an intersection is done with original polygon to cut segments:<br><br>The below query shows the steps in separate CTE's to illustrate. they<br>could be grouped:<br>

On the attached picture, the red points are steps (70 units in my<br>example) computed from the centerline.<br><br><font face="courier new, monospace">with iter as (<br>    -- computes the number of steps required to cut the centerline by a fixed distance (70m here)<br>

<br>    select generate_series(1,ceil(st_length(geom)/70)::int) as idx, ceil(st_length(geom)/70)::int as steps<br>    from centerline<br>), npoints as (<br>   -- computes the point geometries with LR functions<br><br>    select  idx, steps, st_lineInterpolatePoint(p.geom, (idx::double precision/steps::double precision)) as pt, p.geom<br>

    from iter n, centerline p<br>), rot_trans as (<br>   -- translate the centerline to move it to one step point (center of line is taken for the move, then rotate it by pi/2 around<br>   -- the step point to create perpendicular segment</font><div>

<font face="courier new, monospace"><br>    select st_rotate(st_translate(n.geom,<br>        st_x(<a href="http://n.pt">n.pt</a>) - st_X(st_lineInterpolatePoint(n.geom, 0.5)),<br>--xcenter -xtarget,<br>        st_y(<a href="http://n.pt">n.pt</a>)   - st_Y(st_lineInterpolatePoint(n.geom, 0.5))),<br>

--ycenter - ytarget<br>        pi()/2, <a href="http://n.pt">n.pt</a>) as geom<br>    from npoints n<br>) <br>-- finaly, cut each segment by the original polygon</font></div><div><font face="courier new, monospace"><br>select st_intersection(r.geom, t.geom) as geom<br>

from rot_trans r, testpg t;</font><br><br>Nicolas<br><br>On 3 December 2013 19:04, Karl Zinglersen <<a href="mailto:karl.zinglersen@gmail.com">karl.zinglersen@gmail.com</a>> wrote:<br>> Hi, I believe I was unclear - the centerlines have to straight. But I'll<br>

> keep in mind your reference to delauney triangles and skeletonization for<br>> future purposes.<br>> To create the centerline a manual sketch is probably OK. Could I then just<br>> move on with linear referencing? Which function should I use - most seems to<br>

> be percentages of a linestring.<br>><br>> Karl<br>><br>> Den lørdag den 30. november 2013 13.21.46 UTC-3 skrev Nicolas Ribot:<br>>><br>>> Hi,<br>>><br>>> You should look at this french article for skeletonization of<br>

>> irregular polygons. The st_delaunayTriangles method can also help.<br>>> Note that the middle line of a polygon is not always a straight line.<br>>> Then, using linear referencing, it should be easy to walk the middle<br>

>> line to create perpendicular segments.<br>>><br>>> Nicolas<br>>><br>>> On 29 November 2013 18:25, Karl Zinglersen <<a href="mailto:karl.zi...@gmail.com">karl.zi...@gmail.com</a>> wrote:<br>

>> > I need to create transect lines across polygons for planning aerial<br>>> > surveys<br>>> > for musk oxen and caribous in Greenland.<br>>> > 1. In QGIS I have made polygons of the polygon zones for each survey.<br>

>> > Each<br>>> > polygon hold an attribute of spacing value, e.g. 5, 10 and 20 km.<br>>> > 2. Lines must be equally spaced and parallel.<br>>> > 3. Lines must be perpendicular to the polygon centerline.<br>

>> > 4. Centerline must run at the longest distance across the polygon - and<br>>> > consequently the transects run as the shorter distances.<br>>> > I've attached a hand made sketch, which display the concept.<br>

>> ><br>>> > I've tried this query<br>>> ><br>>> > SELECT GENERATE_SERIES(FLOOR(ST_YMin(the_polygon))::int ,<br>>> > CEILING(ST_YMax(the_polygon))::int,200) y_value, ST_XMin(the_polygon)<br>

>> > x_min,<br>>> > ST_XMax(the_polygon) x_max from<br>>> >             (SELECT the_geom AS the_polygon FROM lakes) l<br>>> ><br>>> ><br>>> > SELECT ST_Intersection(the_geom, the_polygon)  AS the_geom FROM<br>

>> >     (SELECT the_polygon, ST_Setsrid(ST_MakeLine(ST_MakePoint(x_min,<br>>> > y_value),ST_MakePoint(x_max, y_value) ), ST_Srid(the_polygon)) AS<br>>> > the_geom<br>>> > FROM<br>>> >         (SELECT the_polygon,<br>

>> > GENERATE_SERIES(FLOOR(ST_YMin(the_polygon))::int ,<br>>> > CEILING(ST_YMax(the_polygon))::int,200) y_value, ST_XMin(the_polygon)<br>>> > x_min,<br>>> > ST_XMax(the_polygon) x_max from<br>

>> >             (SELECT the_geom AS the_polygon FROM lakes) l<br>>> >         )c<br>>> ><br>>> > ) lines<br>>> ><br>>> > from gis stackechange<br>>> ><br>>> > <a href="http://gis.stackexchange.com/questions/24064/filling-a-polygon-with-lines-using-postgis">http://gis.stackexchange.com/questions/24064/filling-a-polygon-with-lines-using-postgis</a><br>

>> ><br>>> > however these transects runs horisontally and don't seem to take into<br>>> > account the shape and rotation of the polygon centerline.<br>>> ><br>>> > Should I be able to change the query or should take a different<br>

>> > approach?<br>>> ><br>>> > Karl Zinglersen<br>>> ><br>>> > _______________________________________________<br>>> > postgis-users mailing list<br>>> > <a href="mailto:postgi...@lists.osgeo.org">postgi...@lists.osgeo.org</a><br>

>> > <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>>> _______________________________________________<br>>> postgis-users mailing list<br>

>> <a href="mailto:postgi...@lists.osgeo.org">postgi...@lists.osgeo.org</a><br>>> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></div>

</div>