You could try using sub-queries:
CREATE TABLE wp_obs AS
SELECT nextval('wp_seq3') as id, geom
FROM (
  SELECT geom
  FROM ( 
    SELECT Pointn(exteriorring(obstacles.geom ), generate_series(1,npoints(obstacles.geom)-1)) AS geom
    FROM obstacles, place
    WHERE obstacles.geom && place.geometry
    AND intersects(place.geometry, obstacles.geom)
  ) AS foo
  ORDER BY distance(foo.geom, GeomFromText('POINT(3.2 -35.9)',-1))
) AS foo2;


or alternatively, add the id to your table the after you populate it with geometries in the right order:
ALTER TABLE wp_obs ADD id serial;

Cheers,
Kevin

--------
Kevin Neufeld
Refractions Research Inc.
[EMAIL PROTECTED]
(250) 383-3022


Manu wrote:
Hi, I am trying to create a table of vertex of a family of polygons, order by the distance to a point (3.2 -35.9). I need also a integer column id.

I made this:
create table wp_obs as select Pointn(exteriorring(obstacles.geom ), generate_series(1,npoints(obstacles.geom)-1)) as geom, nextval('wp_seq3') as id from obstacles, place where obstacles.geom && place.geometry and intersects(place.geometry,obstacles.geom) order by distance (Pointn(exteriorring( obstacles.geom), generate_series(1,npoints(obstacles.geom)-1)),GeomFromText('POINT(3.2 -35.9)',-1));


But id is not from ordered from 1. It seems that it creates table firts to order later... How can I get id ordered?? I tried to do alter table with generate series, but i coudn't make it work...

Thanks

--
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Manuel                                              
                                                          
[EMAIL PROTECTED]                    
http://manuelfgm.blogspot.com        
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to