[pgrouting-users] directions problem
Valeria Muñoz
valemunoz at gmail.com
Wed Apr 15 16:55:53 EDT 2009
some result give me 2,3 or 4 points. how can i define (1,2)(3,4) when i got
2 points?
segment 4390:
"MULTILINESTRING((-71.1958400125164 -30.591211719682,-71.1959567794677
-30.5912308536826,-71.1968582353939 -30.5913171684662))"
segment 7320:
"MULTILINESTRING((-71.2063821613355 -30.5998726725634,-71.2070054367284
-30.5991545647783))"
i try with this query, but does not work:
SELECT
ST_Azimuth(ST_MakePoint(st_x(st_startpoint(the_geom)),st_x(st_pointn(the_geom,
2))), ST_MakePoint(st_x(st_pointn(the_geom,
st_numpoints(the_geom)-1)),st_x(st_endpoint(the_geom))))/(2*pi())*360 as
degAz,ST_Azimuth(ST_MakePoint(st_x(st_pointn(the_geom,
st_numpoints(the_geom)-1)),st_x(st_endpoint(the_geom))),
ST_MakePoint(st_x(st_startpoint(the_geom)),st_x(st_pointn(the_geom,
2))))/(2*pi())*360 As degAzrev from calle where gid=".$id_gid."
results
degAz degAzrev
187.380514396367 :: 7.38051439636702
4.88000936193493 :: 184.880009361935
3.80862917910364 :: 183.808629179104
4.56236891364906 :: 184.562368913649
6.13664883828968 :: 186.13664883829
84.2113342354141 :: 264.211334235414
83.7951033588638 :: 263.795103358864
83.8097651650778 :: 263.80976516507
RG
2009/2/14 Stephen Woodbridge <woodbri at swoodbridge.com>
> Valeria,
>
> C
> ^
> |
> |
> A-------->B
>
> You need to look at the azimuth of the A->B and compare it to the azimuth
> of B->C, if the difference is around 0.0 then you are continuing straight
> ahead, if the difference is around +-90.0 you are turn right or left.
>
> You also have to be careful with segments that have a lot of curvature,
> like exit ramps, because if you take the azimuth of the start and end points
> it might not be what you want, you might want to compute the azimuth points
> 1 and 2 for the start end and points numpoints-1, numpoints for the end of
> the segment.
>
> -Steve
>
>
>
>
> Valeria Muñoz wrote:
>
>> hi daniel
>> i did try with Shooting* and WORKS!!! .. thanks thanks!!... now my
>> next problem :) i am using azimuth() for instructions(turn left right etc..)
>> but i do not how use it, can you help me please?
>> RG
>> Query :
>> SELECT azimuth(startpoint(the_geom),endpoint(the_geom)) as azimuth from
>> calle where gid = ".$id_gid."
>> I read in a foro about azimuth() and this says that the result i have to
>> multiply by 57.29577951. The result is the angle. Now How i know if the user
>> have to turn left or rigth ..etc?, exist some algoritm? or function?
>> RG
>>
>> 2009/2/12 Daniel Kastl <kastl at orkney.co.jp <mailto:kastl at orkney.co.jp>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20090415/4ab62b5b/attachment.html
More information about the Pgrouting-users
mailing list