Re: Need a little help with geometric query

From: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
To: lxnf98mm(at)comcast(dot)net
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Need a little help with geometric query
Date: 2011-08-26 00:08:11
Message-ID: CAEV0TzDf=tCjZxYx59h7af8UwqvoiAzeAMS4yZACODMU7pJCpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Aug 25, 2011 at 3:56 PM, <lxnf98mm(at)comcast(dot)net> wrote:

> This is my first shot at using postgresql's geometric functions
> I have a passel of lines defined by x1 y1 x2 y2
> I created a table with type lseg and loaded it
> I start by finding the line that has an end closest to 0,0
> Now I want to find the next line that has an end closest to the first
> line's other end and so on
> I want to find the shortest path
> I see there are a lot of geometric operators but I am a bit baffled
> Can someone offer suggestions or reading references
>

Forget about the built-in geometry types and operators in postgres. You
really want to take a look at postGIS for doing geometric calculations. It
has a much more diverse set of operators and functions and adheres to
various GIS standards which will allow your db to interact with other GIS
tools as well. It is quite easy to learn and there is an excellent book
which, I believe, also has an electronic edition available so you can start
reading immediately. Finding a geometry that is 'closest' to a particular
point or to another 2D geometry (or even 3D in the upcoming version) is
relatively trivial. I'm sure there is a function, or at least a common
technique, for finding a shortest path between 2 points, since GIS is often
used for mapping applications. It's not my specialty, so I'll leave the
details to your research.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Craig Ringer 2011-08-26 03:51:36 Re: (pgsql8.4) DATA Corruption
Previous Message Brent Dombrowski 2011-08-25 23:35:53 Re: st_offsetcurve