[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Traverse set distance along a multiline?
From:       pcreso () pcreso ! com
Date:       2010-12-28 19:40:49
Message-ID: 418319.33276.qm () web33201 ! mail ! mud ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Aren,

for start & end points you can use ST_StartPoint & ST_EndPoint, should be faster than \
0 & 100% values.

It may also be useful to optimise your working data, by pre ordering the points so \
that the startpoint is always the southern or western one, so your algorithm does not \
need to check this for every linestring, eg:

update table set geom_nad = ST_Reverse(geom_nad)
where ST_StartPoint(geom_nad) |>> ST_EndPoint(geom_nad);
     
see: http://www.postgis.org/documentation/manual-1.5/reference.html#Operators



--- On Wed, 12/29/10, Aren Cambre <aren@arencambre.com> wrote:

From: Aren Cambre <aren@arencambre.com>
Subject: Re: [postgis-users] Traverse set distance along a multiline?
To: postgis-users@postgis.refractions.net
Date: Wednesday, December 29, 2010, 5:00 AM

Just want to again say thanks for all the help on this.

After projecting from 4269 to 3081, I reanalyzed everything and checked my points \
sample again. All my points at major intersections and state borders were <= 1 mile \
off! That's good enough for me.


Now my next two problems (which I need to research) are:Forcing my algorithm to start \
mile 0 from a route's the southern or western extreme. I am guessing I would get the \
points at 0% and 100% of a route and the compare them. Whichever "wins" then becomes \
the starting point for my traversal. At least for most mainline IH and US routes, the \
algorithm to determine the "winner" may takes the route number as input since even = \
W-E and odd = N-S.

Connecting some routes that are inconsistent or noncontiguous. Examples I've found in \
the Interstate system:Where I-35W and I-35E split south of Dallas/Ft. Worth, I-35W \
starts over at mile marker 0, but I-35E maintains mileposts as if it is the \
contiguous I-35 route. So I need to connect I-35 south of Dallas, I-35E, and I-35 \
north Dallas as one route. I think the PostGIS functions exist to combine these three \
routes into one.

I-10 for some reason doesn't follow I-35 near downtown San Antonio, so I have two \
I-10s separated by that short I-35 multiplex gap. Mile markers on a contiguous route \
would count up to well over 800 by the Sabine River (eastern Texas border).

Aren
On Sun, Dec 26, 2010 at 6:35 PM, Aren Cambre <aren@arencambre.com> wrote:


I am trying to determine mile markers along Texas highways. My starting point is the \
ShapeFile TxDOT Roadways 2010 at \
http://www.tnris.state.tx.us/datadownload/download.jsp. I've used shp2pgsql to get it \
into a PostGIS 1.52-enabled Postgres 9.01 database.



I naively thought I could just figure out the number of miles per unit of latitude \
and then traverse each roadway, one mile at a time, using ST_Line_Interpolate_Point. \
However, predictably, the more "longitudinal" a route, the more error it shows when I \
compare my calculated mile markers to what Google Maps shows.



Again, this is because I was using a consistent ratio of degrees to miles, so any \
route E-W component introduces errors.



So here's the question--does PostGIS allow any way to traverse a route a set distance \
at a time? Specifically, is there a way I can traverse a route a mile at a time and \
then record the points at the end of each mile?



I reviewed the functions available at \
http://postgis.refractions.net/documentation/manual-1.5/reference.html and am not \
seeing anything clear.



In case it matters, the SHP's PRJ file says NAD83.

Aren Cambre



-----Inline Attachment Follows-----

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[Attachment #5 (text/html)]

<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: \
inherit;">Hi Aren,<br><br>for start &amp; end points you can use ST_StartPoint &amp; \
ST_EndPoint, should be faster than 0 &amp; 100% values.<br><br>It may also be useful \
to optimise your working data, by pre ordering the points so that the startpoint is \
always the southern or western one, so your algorithm does not need to check this for \
every linestring, eg:<br><br>update table set geom_nad = \
ST_Reverse(geom_nad)<br>where ST_StartPoint(geom_nad) |&gt;&gt; \
ST_EndPoint(geom_nad);<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>see: \
http://www.postgis.org/documentation/manual-1.5/reference.html#Operators<br><br><br><br>--- \
On <b>Wed, 12/29/10, Aren Cambre <i>&lt;aren@arencambre.com&gt;</i></b> \
wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: \
5px; padding-left: 5px;"><br>From: Aren Cambre \
&lt;aren@arencambre.com&gt;<br>Subject: Re: [postgis-users] Traverse  set distance \
along a multiline?<br>To: postgis-users@postgis.refractions.net<br>Date: Wednesday, \
December 29, 2010, 5:00 AM<br><br><div id="yiv1101955722">Just want to again say \
thanks for all the help on this.<br><div><br></div><div>After projecting \
from&nbsp;<span class="yiv1101955722Apple-style-span" style="font-family: \
arial,sans-serif; font-size: 13px; border-collapse: collapse;">4269&nbsp;</span>to \
3081, I reanalyzed everything and checked my points sample again. All my points at \
major intersections and state borders were &lt;= 1 mile off! That's good enough for \
me.</div>

<div><br></div><div>Now my next two problems (which I need to research) \
are:</div><div><ol><li>Forcing my algorithm to start mile 0 from a route's the \
southern or western extreme. I am guessing I would get the points at 0% and 100% of a \
route and the compare them. Whichever "wins" then becomes the starting point for my \
traversal. At least for most mainline IH and US routes, the algorithm to determine \
the "winner" may takes the route number as input since even = W-E and odd = N-S.</li>

<li>Connecting some routes that are inconsistent or noncontiguous. Examples I've \
found in the Interstate system:</li><ul><li>Where I-35W and I-35E split south of \
Dallas/Ft. Worth, I-35W starts over at mile marker 0, but I-35E maintains mileposts \
as if it is the contiguous I-35 route. So I need to connect I-35 south of Dallas, \
I-35E, and I-35 north Dallas as one route. I think the PostGIS functions exist to \
combine these three routes into one.</li>

<li>I-10 for some reason doesn't follow I-35 near downtown San Antonio, so I have two \
I-10s separated by that short I-35 multiplex gap. Mile markers on a contiguous route \
would count up to well over 800 by the Sabine River (eastern Texas border).</li>

</ul></ol><div>Aren</div></div><div><div><br><div class="yiv1101955722gmail_quote">On \
Sun, Dec 26, 2010 at 6:35 PM, Aren Cambre <span dir="ltr">&lt;<a rel="nofollow" \
ymailto="mailto:aren@arencambre.com" target="_blank" \
href="/mc/compose?to=aren@arencambre.com">aren@arencambre.com</a>&gt;</span> \
wrote:<br><blockquote class="yiv1101955722gmail_quote" style="margin: 0pt 0pt 0pt \
0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I am trying to determine mile markers along Texas highways. My starting point is the \
ShapeFile&nbsp;<span style="font-family: Tahoma,Geneva,Arial,sans-serif; font-size: \
13px; border-collapse: collapse; line-height: 17px;">TxDOT Roadways 2010 at&nbsp;<a \
rel="nofollow" target="_blank" \
href="http://www.tnris.state.tx.us/datadownload/download.jsp">http://www.tnris.state.tx.us/datadownload/download.jsp</a>.&nbsp;I've \
used shp2pgsql to get it into a PostGIS 1.52-enabled Postgres 9.01 \
database.</span><div>


<span style="font-family: Tahoma,Geneva,Arial,sans-serif; font-size: 13px; \
border-collapse: collapse; line-height: 17px;"><br></span></div><div><font \
face="Tahoma, Geneva, Arial, sans-serif"><span style="border-collapse: collapse; \
line-height: 17px;">I naively thought I could just figure out the number of miles per \
unit of latitude and then traverse each roadway, one mile at a time, \
using&nbsp;<b>ST_Line_Interpolate_Point</b>. However, predictably, the more \
"longitudinal" a route, the more error it shows when I compare my calculated mile \
markers to what Google Maps shows.</span></font></div>


<div><font face="Tahoma, Geneva, Arial, sans-serif"><span style="border-collapse: \
collapse; line-height: 17px;"><br></span></font></div><div><font face="Tahoma, \
Geneva, Arial, sans-serif"><span style="border-collapse: collapse; line-height: \
17px;">Again, this is because I was using a consistent ratio of degrees to miles, so \
any route E-W component introduces errors.</span></font></div>


<div><font face="Tahoma, Geneva, Arial, sans-serif"><span style="border-collapse: \
collapse; line-height: 17px;"><br></span></font></div><div><font face="Tahoma, \
Geneva, Arial, sans-serif"><span style="border-collapse: collapse; line-height: \
17px;">So here's the question--does PostGIS allow any way to traverse a route a set \
distance at a time? Specifically, is there a way I can traverse a route a mile at a \
time and then record the points at the end of each mile?</span></font></div>


<div><font face="Tahoma, Geneva, Arial, sans-serif"><span style="border-collapse: \
collapse; line-height: 17px;"><br></span></font></div><div><font face="Tahoma, \
Geneva, Arial, sans-serif"><span style="border-collapse: collapse; line-height: \
17px;">I reviewed the functions available at&nbsp;</span></font><a rel="nofollow" \
target="_blank" href="http://postgis.refractions.net/documentation/manual-1.5/referenc \
e.html">http://postgis.refractions.net/documentation/manual-1.5/reference.html</a>&nbsp;and \
am not seeing anything clear.</div>


<div><br></div><div>In case it matters, the SHP's PRJ file says \
NAD83.</div><div><font face="Tahoma, Geneva, Arial, sans-serif"><span \
style="border-collapse: collapse; line-height: 17px;"><br> \
</span></font></div><div><font face="Tahoma, Geneva, Arial, sans-serif"><span \
style="border-collapse: collapse; line-height: 17px;">Aren Cambre</span></font></div> \
</blockquote></div><br></div></div> </div><br>-----Inline Attachment \
Follows-----<br><br><div \
class="plainMail">_______________________________________________<br>postgis-users \
mailing list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" \
href="/mc/compose?to=postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></div></blockquote></td></tr></table>




_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic