[postgis-users] Creating a linestring from two points

Per-Olof Norén pelle at alma.nu
Sat Nov 9 03:48:18 PST 2002


Juanse wrote:

>Per
>
>have you found out if it Is it point or point+1 in every direction?
>
No, I haven´t....And actually haven´t had the time to double check the 
docs for any explanation to
the bounding box´s size. I´m hoping someone on this list knows :-)

/ Per-Olof

>
>juanse
>
>----- Original Message -----
>From: Per-Olof Norén <pelle at alma.nu>
>To: <postgis-users at postgis.refractions.net>
>Sent: Friday, November 08, 2002 12:17 PM
>Subject: Re: [postgis-users] Creating a linestring from two points
>
>
>  
>
>>Hi Dave,
>>Sorry for the delay. I managed to figure somthing similar out before you
>>could answer it.
>>
>>Anyway, I used the function x(point1) instead of  xmin though. Isn´t a
>>point´s bounding box the point itself?
>>or is a point´s bounding box  point+1 unit in every direction? Need
>>update using your suggestion?
>>
>>My query:
>>update lank set lank_geom =
>>GeometryFromText('LINESTRING(' || x(parent.nod_geom) || ' ' ||
>>y(parent.nod_geom)
>> || ',' || x(child.nod_geom) || ' ' || y(child.nod_geom) || ')', 30800)
>>from    lank l,
>>        nod parent,
>>        nod child
>>where   lank.parent_nod_id = parent.nod_id
>>        and lank.child_nod_id = child.nod_id
>>        and l.parent_nod_id = l.parent_nod_id
>>
>>
>>Thanx in advance,
>>Per-Olof
>>
>>
>>David Blasby wrote:
>>
>>    
>>
>>>Per-Olof,
>>>
>>>Unfortunately OGC didnt define any constructors for geometries.  I should
>>>really add a few functions to do this - perhaps I'll get some time in the
>>>next little while.
>>>
>>>If you want to construct a line from 2 points, I suggest you build up a
>>>      
>>>
>WKT
>  
>
>>>string:
>>>
>>>Lets look at a simple example - a table with 3 geometry columns called
>>>'point1','point2','line'.  The point1 and point2 column have points in
>>>      
>>>
>them.
>  
>
>>>The function xmin(geometry) returns the xmin of the geometry's bounding
>>>box.  For a point, the points X value is the same as the bounding box's X
>>>value.  The '||' operator concatenates 2 strings.
>>>
>>>UPDATE <table>  SET line =
>>>   geometryFromText(
>>>      'LINESTRING('|| xmin(point1)||' ' || ymin(point1) ||','||
>>>xmin(point2) || ' '||  ymin(point2) || ')'
>>>   );
>>>
>>>dave
>>>
>>>
>>>_______________________________________________
>>>postgis-users mailing list
>>>postgis-users at postgis.refractions.net
>>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>>      
>>>
>>
>>
>>_______________________________________________
>>postgis-users mailing list
>>postgis-users at postgis.refractions.net
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>    
>>
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.408 / Virus Database: 230 - Release Date: 24/10/02
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>  
>







More information about the postgis-users mailing list