<div dir="ltr"><div><div><div><div><div><div>Hm what you seem to do is <br>compute a minimal bouding box (not aligned with NS or EW), <br></div>then use the greatest side as a reference, translate it so it passes by the center of this bbox, <br>
then several times offset the shortest side by a small step in the normal direction, until you are out of the bounding box.<br></div>After this, keep only part of the created geom that are inside polygon.<br><br></div><div>
I suspect this is not at all optimal, but your handdrawing is not precise enough (what if the survey zone is a donut?).<br></div><div><br></div>It is not difficult but need some time, now the shopping :<br></div>_minimal bounding box (not axis aligned) :<a href="http://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms">http://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms</a>,<br>
</div><div>if perf is not a factor, you can try rotate your polygon by 10 degree steps (36 steps), taking the rotation that gives the smallest box, then rotate this box of the same amount.<br></div>_translate : <a href="http://postgis.net/docs/ST_Translate.html">http://postgis.net/docs/ST_Translate.html</a><br>
_offset : <a href="http://postgis.net/docs/ST_OffsetCurve.html">http://postgis.net/docs/ST_OffsetCurve.html</a> (by choosing the sign you take care of the normal thing)<br></div><div>_intersection : <a href="http://postgis.net/docs/ST_Intersection.html">http://postgis.net/docs/ST_Intersection.html</a><br>
<br></div><div>And you didn't tell why you would need "linear referencing" ...<br></div><div>Good luck with that,<br><br></div><div>Cheers,<br><br>Rémi-C<br></div><br><div><br><div><div><div><div><br><br></div>
</div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/3 Karl Zinglersen <span dir="ltr"><<a href="mailto:karl.zinglersen@gmail.com" target="_blank">karl.zinglersen@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, I believe I was unclear - the centerlines have to straight. But I'll keep in mind your reference to delauney triangles and skeletonization for future purposes.<div>
To create the centerline a manual sketch is probably OK. Could I then just move on with linear referencing? Which function should I use - most seems to be percentages of a linestring.</div><div><br></div><div>Karl<br><br>
Den lørdag den 30. november 2013 13.21.46 UTC-3 skrev Nicolas Ribot:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">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></div><div><div class="h5">On 29 November 2013 18:25, Karl Zinglersen <<a>karl.zi...@gmail.com</a>> wrote:
<br>> I need to create transect lines across polygons for planning aerial surveys
<br>> for musk oxen and caribous in Greenland.
<br>> 1. In QGIS I have made polygons of the polygon zones for each survey. 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(<u></u>the_polygon))::int ,
<br>> CEILING(ST_YMax(the_polygon)):<u></u>:int,200) y_value, ST_XMin(the_polygon) 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_<u></u>MakePoint(x_min,
<br>> y_value),ST_MakePoint(x_max, y_value) ), ST_Srid(the_polygon)) AS the_geom
<br>> FROM
<br>>         (SELECT the_polygon,
<br>> GENERATE_SERIES(FLOOR(ST_YMin(<u></u>the_polygon))::int ,
<br>> CEILING(ST_YMax(the_polygon)):<u></u>:int,200) y_value, ST_XMin(the_polygon) 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>> <a href="http://gis.stackexchange.com/questions/24064/filling-a-polygon-with-lines-using-postgis" target="_blank">http://gis.stackexchange.com/<u></u>questions/24064/filling-a-<u></u>polygon-with-lines-using-<u></u>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 approach?
<br>>
<br>> Karl Zinglersen
<br>>
<br>> ______________________________<u></u>_________________
<br>> postgis-users mailing list
<br></div></div>> <a>postgi...@lists.osgeo.org</a>
<br><div class="im">> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a>
<br>______________________________<u></u>_________________
<br>postgis-users mailing list
<br></div><a>postgi...@lists.osgeo.org</a>
<br><a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a>
<br></blockquote></div></div><br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>