Re: [postgis-users] Cursor names in a self-nested function

2011-08-18 Thread Kidd, David M
Appologies, I posted this to the wrong list.


David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470




From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Kidd, David 
M
Sent: 18 August 2011 13:44
To: PostGIS Users Discussion
Subject: [postgis-users] Cursor names in a self-nested function

Hi,

I am trying to write a function that contains a cursor and iteratively calls 
itself.

It is along the lines of,

CREATE FUNCTON test(id integer) RETURNS TEXT AS
$BODY$
DECLARE
  mycursor CURSOR FOR SELECT * FROM myfunction(id);
  newid INTEGER;
  out = TEXT;
BEGIN
  out := '';
  OPEN mycursor;
  LOOP
FETCH my_cursor INTO newid;
out := out || test (newid);
  END LOOP;
  RETURN out;
END;
 $BODY$
LANGUAGE 'plpgsql' VOLATILE

This returns an ERROR stating that "mycursor" is already in use.

I understand this occurs because cursor names must be unique across, as well as 
within, functions.

So, my question is whether there is a way I can dynamically declare a cursor 
name, for example by appending a incremental number or guid to make the name 
unique?
Just trying to concatenate two passed arguments in the DECLARE statement 
unsurprisingly fails.

Any other solutions are of cause welcome.

Many thanks,

 - David


David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Cursor names in a self-nested function

2011-08-18 Thread Kidd, David M
Hi,

I am trying to write a function that contains a cursor and iteratively calls 
itself.

It is along the lines of,

CREATE FUNCTON test(id integer) RETURNS TEXT AS
$BODY$
DECLARE
  mycursor CURSOR FOR SELECT * FROM myfunction(id);
  newid INTEGER;
  out = TEXT;
BEGIN
  out := '';
  OPEN mycursor;
  LOOP
FETCH my_cursor INTO newid;
out := out || test (newid);
  END LOOP;
  RETURN out;
END;
 $BODY$
LANGUAGE 'plpgsql' VOLATILE

This returns an ERROR stating that "mycursor" is already in use.

I understand this occurs because cursor names must be unique across, as well as 
within, functions.

So, my question is whether there is a way I can dynamically declare a cursor 
name, for example by appending a incremental number or guid to make the name 
unique?
Just trying to concatenate two passed arguments in the DECLARE statement 
unsurprisingly fails.

Any other solutions are of cause welcome.

Many thanks,

 - David


David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] are there any network data modul in PostGIS like oracle spatial 11g/10g ?

2011-07-19 Thread Kidd, David M
Hi Peng,

I amusing the PhyloDB schma add-on for BioSQL to store trees, however the data 
model will also support reticulate networks.

The project is at an early stage with few uses so ample oppotunities to help 
develop.

http://www.biosql.org/wiki/Extensions

- Dave

David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470




From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of sunpeng
Sent: 19 July 2011 08:25
To: postgis-users@postgis.refractions.net
Subject: [postgis-users] are there any network data modul in PostGIS like 
oracle spatial 11g/10g ?

hi, friends,
   I've noticed in oracle 11g/10g, they support network data model, which you 
could find here:Spatial Topology and Network Data Models Developer's 
Guide:http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11831/toc.htm.
   I wondered are there any related part in PostGIS or 3rh part open source 
project?
   Thanks!
peng
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] ST_Intersects on geography

2011-04-19 Thread Kidd, David M
Thanks for the response, especially as it was truncated by an accidental 
premature send.

I have solved my immediate problem by casting to geometry.

It is, however, worrrying that such fundamental errors exist in in the 
geography functions,as for example,

SELECT ST_Intersects('POINT(-160 -43)'::geography, 'POLYGON((-170 -80, -170 0, 
170 0, 170 -80, -170 -80))'::geography)
also returns FALSE, which is not a query on the outer fringe.

Incidently, the same query using && also gives an incorrect result.

SELECT 'POINT(-160 -43)'::geography && 'POLYGON((-170 -80, -170 0, 170 0, 170 
-80, -170 -80))'::geography

BTW I'm using PostGIS1.5.

I - Dave


David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470




From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Paragon 
Corporation
Sent: 18 April 2011 17:17
To: 'PostGIS Users Discussion'
Subject: Re: [postgis-users] ST_Intersects on geography

Hmm I didn't realize we use BOOM! in our errors, but I guess we do since I get 
the same message in 2.0 and 1.5. :)

I know there are issues with the outer fringes when you get into the -180 ... 
area which we have bug tickets in place for and patches not yet applied.  That 
could be one of them
try moving in a bit like 179.5 89 etc.

Unfortunately the guy who deals with these things is incognito at the moment

From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Kidd, David 
M
Sent: Monday, April 18, 2011 10:25 AM
To: postgis-users@postgis.refractions.net
Subject: [postgis-users] ST_Intersects on geography

Hi,

Applogies if the is a stupid newbie question.

I have am writing some some simple point in polygon searches on geographic data 
using ST_Intersects, but have been getting some unexpected results;

Searching for a point in the southern hemisphere:

SELECT ST_Intersects('POINT(-160 -43)'::geography, 'POLYGON((-180 -90, -180 0, 
180 0, 180 -90, -180 -90))'::geography)

Returns f

Searching for a point in the northern hemisphere:

SELECT ST_Intersects('POINT(160 43)'::geography, 'POLYGON((0 0, 0 90, 180 90, 
180 0, 0 0))'::geography)

ERROR:  BOOM! Could not generate outside point!
CONTEXT:  SQL function "st_intersects" statement 1

** Error **

ERROR: BOOM! Could not generate outside point!
SQL state: XX000
Context: SQL function "st_intersects" statement 1
This works though






David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] ST_Intersects on geography

2011-04-18 Thread Kidd, David M
Hi,

Applogies if the is a stupid newbie question.

I have am writing some some simple point in polygon searches on geographic data 
using ST_Intersects, but have been getting some unexpected results;

Searching for a point in the southern hemisphere:

SELECT ST_Intersects('POINT(-160 -43)'::geography, 'POLYGON((-180 -90, -180 0, 
180 0, 180 -90, -180 -90))'::geography)

Returns f

Searching for a point in the northern hemisphere:

SELECT ST_Intersects('POINT(160 43)'::geography, 'POLYGON((0 0, 0 90, 180 90, 
180 0, 0 0))'::geography)

ERROR:  BOOM! Could not generate outside point!
CONTEXT:  SQL function "st_intersects" statement 1

** Error **

ERROR: BOOM! Could not generate outside point!
SQL state: XX000
Context: SQL function "st_intersects" statement 1
This works though






David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users