line datatype

line datatype

Post by Bruce Momji » Wed, 17 Jul 2002 12:34:05



OK, I have added comments to \dT and SGML docs to mention that 'line' is
not implemented.  This should help future folks.

It would be nice to get the line type working 100%.  Thomas says the
problem is input/output format.  I don't completely understand.

---------------------------------------------------------------------------


> Probably the most succinct explanation would be to copy & paste from the
> terminal...

> tjhart=> create table a_line( foo line );
> CREATE
> tjhart=> insert into a_line ( foo ) values( '(0,0), (1,1)' );
> ERROR:  line not yet implemented
> tjhart=> select version();
>                                 version
> ---------------------------------------------------------------------
>   PostgreSQL 7.2.1 on powerpc-apple-darwin5.3, compiled by GCC 2.95.2
> (1 row)

> The documentation (datatype-geometric.html) indicates both a 'line' type
> and an 'lseg' type in the summary table at the top of the page. The same
> code above using the type 'lseg' in place of 'line' works just fine.

> Why can I create a table with a column of type 'line' if I can't insert
> into it?

> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command


--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

 
 
 

line datatype

Post by Thomas Lockha » Wed, 17 Jul 2002 19:59:58


Quote:> It would be nice to get the line type working 100%.  Thomas says the
> problem is input/output format.  I don't completely understand.

The issue is in choosing an external format for LINE which does not lose
precision during dump/reload. Internally, LINE is described by a formula
which is likely subject to problems with limited precision for some line
orientations.

Does anyone have a suggestion (perhaps drawn from another GIS package)
for representing lines? We already have this implemented internally, and
the algorithms are used to support other data types; the only unresolved
issue is in how to input the values.

                   - Thomas

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

 
 
 

line datatype

Post by Tom La » Wed, 17 Jul 2002 22:44:58



> The issue is in choosing an external format for LINE which does not lose
> precision during dump/reload.

Why is this any worse for LINE than for any of the other geometric
types (or for plain floats, for that matter)?

We do need a solution for exact dump/reload of floating-point data,
but I don't see why the lack of it should be reason to disable access
to the LINE type.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command

 
 
 

line datatype

Post by Bruce Momji » Thu, 18 Jul 2002 00:21:39




> > The issue is in choosing an external format for LINE which does not lose
> > precision during dump/reload.

> Why is this any worse for LINE than for any of the other geometric
> types (or for plain floats, for that matter)?

> We do need a solution for exact dump/reload of floating-point data,
> but I don't see why the lack of it should be reason to disable access
> to the LINE type.

I don't understand why dumping the two point values isn't sufficient.

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------

 
 
 

line datatype

Post by Thomas Lockha » Thu, 18 Jul 2002 00:29:48


...

Quote:> > We do need a solution for exact dump/reload of floating-point data,
> > but I don't see why the lack of it should be reason to disable access
> > to the LINE type.
> I don't understand why dumping the two point values isn't sufficient.

Which two point values? LINE is handled as an equation, not as points,
unlike the LSEG type which has two points.

One possibility is to have the external representation *be* the same as
LSEG, then convert internally. Then we need to decide how to scale those
points; maybe always using a unit vector is the right thing to do...

                     - Thomas

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

 
 
 

line datatype

Post by Bruce Momji » Thu, 18 Jul 2002 00:38:41



> ...
> > > We do need a solution for exact dump/reload of floating-point data,
> > > but I don't see why the lack of it should be reason to disable access
> > > to the LINE type.
> > I don't understand why dumping the two point values isn't sufficient.

> Which two point values? LINE is handled as an equation, not as points,
> unlike the LSEG type which has two points.

Well, the \dT documentation used to show line as two points, so I
assumed that was how it was specified.

Quote:> One possibility is to have the external representation *be* the same as
> LSEG, then convert internally. Then we need to decide how to scale those
> points; maybe always using a unit vector is the right thing to do...

No one likes entering an equation.  Two points seems the simplest.

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command

 
 
 

line datatype

Post by Tim Ha » Thu, 18 Jul 2002 01:01:02


Actually... as one with the vested interest...

I'm not opposed to entering an equation in one of the basic algebraic forms. Given that line types and line segment types both exist, I'm happy to weigh the cost/benefit between choosing an lseg and entering 2 points, or choosing a line and entering the equation.

Are there database functions to translate between a line and a line seg? If so, that would address my only reservation for restricting the line type to an equation. And - to address Tom's continuing concern over casting ;), I have no need for implicit casts in this case.

If there are concerns about precision being lost in the translation - As long as what precision can be guaranteed is documented, I have no qualms. If I needed absolute precision I'd create my own line table with numerics, and write my own functions as necessary. The line type to me is there for speed and ease of use, not unlimited precision.


>No one likes entering an equation.  Two points seems the simplest.

>--
>  Bruce Momjian                        |  http://candle.pha.pa.us

>  +  If your life is a hard drive,     |  830 Blythe Avenue
>  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

 
 
 

line datatype

Post by Thomas Lockha » Thu, 18 Jul 2002 01:07:09


...

Quote:> Well, the \dT documentation used to show line as two points, so I
> assumed that was how it was specified.

Hmm. And it seems I entered it a few years ago ;)

Cut and paste error. At that time the line type was defined but has
never had the i/o routines enabled.

Quote:> No one likes entering an equation.  Two points seems the simplest.

That it does.

                     - Thomas

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

 
 
 

line datatype

Post by Lamar Ow » Thu, 18 Jul 2002 01:13:32



Quote:> > > We do need a solution for exact dump/reload of floating-point data,
> > > but I don't see why the lack of it should be reason to disable access
> > > to the LINE type.
> > I don't understand why dumping the two point values isn't sufficient.
> Which two point values? LINE is handled as an equation, not as points,
> unlike the LSEG type which has two points.
> One possibility is to have the external representation *be* the same as
> LSEG, then convert internally. Then we need to decide how to scale those
> points; maybe always using a unit vector is the right thing to do...

Lines are entered now by specifying two points, anywhere on the line, right?  
The internal representation is then slope-intercept?  Why not allow either
the 'two-point' entry, or direct entry as slope-intercept?  How do we
represent lines now in output?  Do we pick two arbitrary points on the line?  
If so, I can see Thomas' point here, where the original data entry might have
specified two relatively distant points -- but then there's a precision error
anyway converting to slope-intercept, if indeed that is the internal
representation.  So why not dump in slope-intercept form, if that is the
internal representation?

But, you're telling me floats aren't dumpable/restoreable to exactly the same
value?  (????)  This can't be good.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

 
 
 

line datatype

Post by Bruce Momji » Thu, 18 Jul 2002 01:27:09




> > > > We do need a solution for exact dump/reload of floating-point data,
> > > > but I don't see why the lack of it should be reason to disable access
> > > > to the LINE type.

> > > I don't understand why dumping the two point values isn't sufficient.

> > Which two point values? LINE is handled as an equation, not as points,
> > unlike the LSEG type which has two points.

> > One possibility is to have the external representation *be* the same as
> > LSEG, then convert internally. Then we need to decide how to scale those
> > points; maybe always using a unit vector is the right thing to do...

> Lines are entered now by specifying two points, anywhere on the line, right?  
> The internal representation is then slope-intercept?  Why not allow either
> the 'two-point' entry, or direct entry as slope-intercept?  How do we
> represent lines now in output?  Do we pick two arbitrary points on the line?  
> If so, I can see Thomas' point here, where the original data entry might have
> specified two relatively distant points -- but then there's a precision error
> anyway converting to slope-intercept, if indeed that is the internal
> representation.  So why not dump in slope-intercept form, if that is the
> internal representation?

Yow, I can see the pain of having slope/intercept and trying to output
two points.  What if we store line internally as two points, and convert
to slope/intercept when needed.  That way, it would dump out just as it
was entered.

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

 
 
 

line datatype

Post by Bruce Momji » Thu, 18 Jul 2002 01:31:57




> >> No one likes entering an equation.  Two points seems the simplest.

> > That it does.

> On the other hand, if you want to enter two points why don't you just
> use lseg to begin with?  There's not much justification for having a
> separate line type unless it behaves differently ...

I assume the line type keeps going after the two end points, while lseg
doesn't.

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

 
 
 

line datatype

Post by Tom La » Thu, 18 Jul 2002 01:31:27



>> No one likes entering an equation.  Two points seems the simplest.
> That it does.

On the other hand, if you want to enter two points why don't you just
use lseg to begin with?  There's not much justification for having a
separate line type unless it behaves differently ...

                        regards, tom lane

---------------------------(end of broadcast)---------------------------

 
 
 

line datatype

Post by Thomas Lockha » Thu, 18 Jul 2002 05:42:21


Quote:> >> No one likes entering an equation.  Two points seems the simplest.
> > That it does.
> On the other hand, if you want to enter two points why don't you just
> use lseg to begin with?  There's not much justification for having a
> separate line type unless it behaves differently ...

They are different. One is infinite in length, the other is finite.
Distances, etc are calculated differently between the two types.

                  - Thomas

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command

 
 
 

line datatype

Post by Lamar Ow » Thu, 18 Jul 2002 05:50:16



Quote:> > On the other hand, if you want to enter two points why don't you just
> > use lseg to begin with?  There's not much justification for having a
> > separate line type unless it behaves differently ...
> They are different. One is infinite in length, the other is finite.
> Distances, etc are calculated differently between the two types.

For some of my work a type of 'ray' would be nice... :-) But LSEG's usually
work OK as long as you specify an endpoint that is far enough away.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

 
 
 

1. Removing Carriage Returns and Line Feeds from Text Datatype

Group

I had a post on here yesterday to find out if there is an easy way that
I would remove the carriage returns for a text datatype. If anyone can
help me here is what I am doing:

SELECT IM_ISS_NO,
       IM_ISS_DESC  <--- TEXT DATATYPE

FROM ISS

This will be run as a query and exported to a comma delimited text
file. With this text file another person will import this into their
database and this is why I need to eliminate the CR + LF

Thank you in advance
Bob

Sent via Deja.com http://www.deja.com/
Before you buy.

2. DSN LESS Connection pooling

3. informix universal server java api

4. How to format output from db2 command line processor for CLOB datatype

5. Stored proc problem - what the?

6. Converting datatype varchar to datatype datetime in SQL trigger

7. pivot and sql-server

8. Boolean DataType to a Bit DataType

9. convert image datatype to text datatype

10. Mapping ADO datatype to SQL Server datatype?