Re: [postgis-users] PostGIS documentation license

2011-07-26 Thread Paolo Cavallini
Il 26/07/2011 22:06, Paragon Corporation ha scritto:

> Regarding GPL.   Mostly I just find the whole licensing confusing.  I don't
> think I'm the only one who would be happier if PostGIS was under a BSD/MIT
> or some other licensing.  Mostly just for the headache of arguing about what
> you can and can't do with it for commercial purposes.

For what is worth: I'm against it, as this would make it easy to use the code we
developed in proprietary projects, returning nothing to the project.
All the best.
-- 
Paolo Cavallini: http://www.faunalia.it/pc
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Mr. Puneet Kishor
On Jul 26, 2011, at 7:53 PM, Ben Madin wrote:Maybe you could share the polygon - does it pass tests like st_isvalid()?it does pass the ST_IsValid() test with flying colors, but the truth is... the entire poly never got imported. So, from ArcMap, I exported poly id 280 to a shapefile. Then I opened that shapefile in QGIS, and overlaid the same poly from the Pg table. See the attached image. The orange line is the poly 280 from Pg, and the green solid is the same poly 280 from the shapefile. Most of the poly is missing in the Pg version.The shapefile can be downloaded from http://dl.dropbox.com/u/3526821/280.zipcheersBenOn 27/07/2011, at 4:16 AM, Mr. Puneet Kishor wrote:On Jul 26, 2011, at 9:56 AM, Sandro Santilli wrote:On Tue, Jul 26, 2011 at 09:47:23AM -0500, Mr. Puneet Kishor wrote:On Jul 26, 2011, at 9:34 AM, Sandro Santilli wrote:On Tue, Jul 26, 2011 at 09:31:50AM -0500, Mr. Puneet Kishor wrote:	ERROR:  function st_interiorringn(geometry) does not existCheck your parens, the call above is missing a parameter (ring number).That is a bit embarrassing. Yes, I had missed out on giving the ring number. However, still no luck --SELECT objectid, 	ST_NRings(the_geom) num_of_rings, 	ST_NumInteriorRings(the_geom) num_of_int_rings, 	ST_NumPoints(ST_ExteriorRing(ST_GeometryN(the_geom,1))) num_of_points_ext_ring,	ST_AsText(the_geom) wkt_feature, 	ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 1 wkt_ext_ring,	ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2), 2))) wkt_int_ring_a,	ST_AsText(ST_MakePolygon(ST_GeometryN(the_geom, 2))) wkt_int_ring_bFROM table WHERE objectid = 280;objectid: 280;num_of_rings: 4;num_of_int_rings: 3;num_of_points_ext_ring: 496;wkt_feature: "MULTIPOLYGON(((<1>),(<2>),(<3>),(<4>))";wkt_ext_ring: "POLYGON((<1>))";wkt_int_ring_a: "";wkt_int_ring_b: ""As you see, I tried to get the interior ring "n" two different ways. Not getting anywhere.Write down a matrix of all combinations you tried.Use real paper, and pencil.Publish a scanned version.So, as advised, I got a real pencil and paper, drew out all my options, scanned them in, and discovered that I had a poor understanding on the relationship of MULTIPOLYGONs and GEOMETRIES. Turns out, my MULTIPOLYGON has 1 GEOMETRY, 4 rings, one being exterior and three interior rings. Hence, an _expression_ like the following works well	ST_NumPoints(ST_InteriorRingN(ST_GeometryN(the_geom, 1), 2))	Now, here is where it gets interesting. My test feature in reality is a lot more complicated, as can be seen in the attached image (see the blue bordered multipoly). I took the shapefile and shp2pgsql-ed it, and now I get only 4 rings in my query. My guess is that these four rings are the ones on the top of the image. So, I thought maybe I have another GEOMETRY that I am missing out on. But, no... ST_NumGeometries(the_geom) = 1.Can anyone theorize what happened to the rest of the feature? How did it get lost in translation? Was it simply ignored, or was it made into a different feature? Or, is it there, but I still haven't understood the MULTIPOLYGON/GEOMETRY/POLYGON/LINERSTRING nexus really well.___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Ben Madin
Maybe you could share the polygon - does it pass tests like st_isvalid()?

cheers

Ben


On 27/07/2011, at 4:16 AM, Mr. Puneet Kishor wrote:

> 
> On Jul 26, 2011, at 9:56 AM, Sandro Santilli wrote:
> 
>> On Tue, Jul 26, 2011 at 09:47:23AM -0500, Mr. Puneet Kishor wrote:
>>> 
>>> On Jul 26, 2011, at 9:34 AM, Sandro Santilli wrote:
>>> 
 On Tue, Jul 26, 2011 at 09:31:50AM -0500, Mr. Puneet Kishor wrote:
 
>   ERROR:  function st_interiorringn(geometry) does not exist
 
 Check your parens, the call above is missing a parameter (ring number).
 
>>> 
>>> That is a bit embarrassing. Yes, I had missed out on giving the ring 
>>> number. However, still no luck --
>>> 
>>> SELECT objectid, 
>>> ST_NRings(the_geom) num_of_rings, 
>>> ST_NumInteriorRings(the_geom) num_of_int_rings, 
>>> ST_NumPoints(ST_ExteriorRing(ST_GeometryN(the_geom,1))) 
>>> num_of_points_ext_ring,
>>> ST_AsText(the_geom) wkt_feature, 
>>> ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 1 
>>> wkt_ext_ring,
>>> ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2), 
>>> 2))) wkt_int_ring_a,
>>> ST_AsText(ST_MakePolygon(ST_GeometryN(the_geom, 2))) wkt_int_ring_b
>>> FROM table 
>>> WHERE objectid = 280;
>>> 
>>> objectid: 280;
>>> num_of_rings: 4;
>>> num_of_int_rings: 3;
>>> num_of_points_ext_ring: 496;
>>> wkt_feature: "MULTIPOLYGON(((<1>),(<2>),(<3>),(<4>))";
>>> wkt_ext_ring: "POLYGON((<1>))";
>>> wkt_int_ring_a: "";
>>> wkt_int_ring_b: ""
>>> 
>>> As you see, I tried to get the interior ring "n" two different ways. Not 
>>> getting anywhere.
>> 
>> Write down a matrix of all combinations you tried.
>> Use real paper, and pencil.
>> Publish a scanned version.
>> 
> 
> So, as advised, I got a real pencil and paper, drew out all my options, 
> scanned them in, and discovered that I had a poor understanding on the 
> relationship of MULTIPOLYGONs and GEOMETRIES. Turns out, my MULTIPOLYGON has 
> 1 GEOMETRY, 4 rings, one being exterior and three interior rings. Hence, an 
> expression like the following works well
> 
>   ST_NumPoints(ST_InteriorRingN(ST_GeometryN(the_geom, 1), 2))
>   
> Now, here is where it gets interesting. My test feature in reality is a lot 
> more complicated, as can be seen in the attached image (see the blue bordered 
> multipoly). I took the shapefile and shp2pgsql-ed it, and now I get only 4 
> rings in my query. My guess is that these four rings are the ones on the top 
> of the image. So, I thought maybe I have another GEOMETRY that I am missing 
> out on. But, no... ST_NumGeometries(the_geom) = 1.
> 
> Can anyone theorize what happened to the rest of the feature? How did it get 
> lost in translation? Was it simply ignored, or was it made into a different 
> feature? Or, is it there, but I still haven't understood the 
> MULTIPOLYGON/GEOMETRY/POLYGON/LINERSTRING nexus really well.
> <280.png>___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

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


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Mr. Puneet Kishor

On Jul 26, 2011, at 4:15 PM, Sandro Santilli wrote:

> On Tue, Jul 26, 2011 at 03:16:09PM -0500, Mr. Puneet Kishor wrote:
> 
>> So, as advised, I got a real pencil and paper, drew out all my options, 
>> scanned them in, and discovered that I had a poor understanding on the 
>> relationship of MULTIPOLYGONs and GEOMETRIES. Turns out, my MULTIPOLYGON has 
>> 1 GEOMETRY, 4 rings, one being exterior and three interior rings. Hence, an 
>> expression like the following works well
>> 
>>  ST_NumPoints(ST_InteriorRingN(ST_GeometryN(the_geom, 1), 2))
> 
> Good job !
> 
>> Now, here is where it gets interesting. My test feature in reality is a lot 
>> more complicated, as can be seen in the attached image (see the blue 
>> bordered multipoly). I took the shapefile and shp2pgsql-ed it, and now I get 
>> only 4 rings in my query. My guess is that these four rings are the ones on 
>> the top of the image. So, I thought maybe I have another GEOMETRY that I am 
>> missing out on. But, no... ST_NumGeometries(the_geom) = 1.
>> 
>> Can anyone theorize what happened to the rest of the feature? How did it get 
>> lost in translation? Was it simply ignored, or was it made into a different 
>> feature? Or, is it there, but I still haven't understood the 
>> MULTIPOLYGON/GEOMETRY/POLYGON/LINERSTRING nexus really well.
> 
> Could be a bug in shp2pgsql ... did it tell you anything interesting
> at load time ?


Nope, not a single error. Went through like (as an ex-boss used to say) shit 
through goose.

I did try shp2pgsql with the -S (force simple geometries) switch, but it 
croaked saying it can't proceed because there are multipolygons, so I went with 
default.

The number of rows in the table are exactly the same as in the shapefile are 
exactly the same as in the Arc mxd (from where all this started). So, seems 
like everything came through at the feature level.


> Do you have the shapefile published somewhere to look at ?
> 

hmmm... not really. It is 200 MB, so I can't really post the file anywhere. 
Hey, perhaps I can export only this poly (although, I believe there are many 
more like this), and maybe I can post that. Let me see.

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


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Sandro Santilli
On Tue, Jul 26, 2011 at 03:16:09PM -0500, Mr. Puneet Kishor wrote:

> So, as advised, I got a real pencil and paper, drew out all my options, 
> scanned them in, and discovered that I had a poor understanding on the 
> relationship of MULTIPOLYGONs and GEOMETRIES. Turns out, my MULTIPOLYGON has 
> 1 GEOMETRY, 4 rings, one being exterior and three interior rings. Hence, an 
> expression like the following works well
> 
>   ST_NumPoints(ST_InteriorRingN(ST_GeometryN(the_geom, 1), 2))

Good job !

> Now, here is where it gets interesting. My test feature in reality is a lot 
> more complicated, as can be seen in the attached image (see the blue bordered 
> multipoly). I took the shapefile and shp2pgsql-ed it, and now I get only 4 
> rings in my query. My guess is that these four rings are the ones on the top 
> of the image. So, I thought maybe I have another GEOMETRY that I am missing 
> out on. But, no... ST_NumGeometries(the_geom) = 1.
> 
> Can anyone theorize what happened to the rest of the feature? How did it get 
> lost in translation? Was it simply ignored, or was it made into a different 
> feature? Or, is it there, but I still haven't understood the 
> MULTIPOLYGON/GEOMETRY/POLYGON/LINERSTRING nexus really well.

Could be a bug in shp2pgsql ... did it tell you anything interesting
at load time ? Do you have the shapefile published somewhere to look at ?

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] PostGIS documentation license

2011-07-26 Thread Sandro Santilli
On Tue, Jul 26, 2011 at 04:06:45PM -0400, Paragon Corporation wrote:

> Thanks.  I think I like the FreeBSD one better now that I'm thinking about
> it. My only care is the crediting of PostGIS project if other
> projects/software (whether open source or private)
> benefit from our documentation.

You can obtain crediting by making, for example, chapter 1 of the manual
an "invariant section" under the GNU Free Documentation License.

See http://www.gnu.org/copyleft/fdl.html

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] [postgis-devel] PostGIS documentation license

2011-07-26 Thread Sandro Santilli
On Tue, Jul 26, 2011 at 03:03:45PM -0400, Paragon Corporation wrote:
> As several have pointed out the PostGIS documentation does not have a
> clearly defined license assigned to it.  This is one of the items on our
> todo to finish off our  OSGeo incubation process. 
> 
> Having it full under GPL like the rest of PostGIS is very unappealing to me.
> 
> I would prefer it be under a fairly unrestricted license such as:
> 
> Creative Common Attribution ShareAlike - something like this:
> http://creativecommons.org/licenses/by-sa/3.0/us/
> 
> And if people happen to make money off of adaptations, printed copies of it
> etc, more power to them.
> 
> Do others have any issues, concerns, comments, preferences about this?

I'm fine with it.
Btw, I don't think it's much different than GPL.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] PostGIS documentation license

2011-07-26 Thread Paragon Corporation
Mathieu,

Thanks.  I think I like the FreeBSD one better now that I'm thinking about
it. My only care is the crediting of PostGIS project if other
projects/software (whether open source or private)
benefit from our documentation.

Greg,

Regarding GPL.   Mostly I just find the whole licensing confusing.  I don't
think I'm the only one who would be happier if PostGIS was under a BSD/MIT
or some other licensing.  Mostly just for the headache of arguing about what
you can and can't do with it for commercial purposes.

So only difference with the documentation is that the licensing was never
really defined so easier to change and also I think slightly fewer hands on
it so sign-off is a little easier.

Thanks,
Regina

-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Mathieu
Basille
Sent: Tuesday, July 26, 2011 3:27 PM
To: postgis-users@postgis.refractions.net
Subject: Re: [postgis-users] PostGIS documentation license

Dear Regina,

Did you consider the GNU Free Documentation License or the FreeBSD 
Documentation License? They might be more appropriate for a 
documentation compared to a CC licence (aimed for more general purposes).

In particular, they both allow for derivative and/or commercial use. The 
GNU FDL would be more restrictive (with a 'share-alike' clause), and 
allows for 'invariant sections' which are sometimes useful in a software 
documentation if you want to be sure that specific parts remain 
unchanged. The FreeBSD DL is far more permissive and basically 
corresponds to an 'attribution' clause only.

You can find more details on the web, e.g. on Wikipedia [1, 2].
All the best,
Mathieu


[1] 
http://en.wikipedia.org/wiki/GNU_Free_Documentation_License#Compatibility_wi
th_Creative_Commons_licensing_terms

[2] http://en.wikipedia.org/wiki/FreeBSD_Documentation_License



Le 26/07/2011 15:03, Paragon Corporation a écrit :
> As several have pointed out the PostGIS documentation does not have a
> clearly defined license assigned to it. This is one of the items on our
> todo to finish off our OSGeo incubation process.
>
> Having it full under GPL like the rest of PostGIS is very unappealing to
me.
>
> I would prefer it be under a fairly unrestricted license such as:
>
> Creative Common Attribution ShareAlike – something like this:
> http://creativecommons.org/licenses/by-sa/3.0/us/
>
> And if people happen to make money off of adaptations, printed copies of
> it etc, more power to them.
>
> Do others have any issues, concerns, comments, preferences about this?
>
> I guess people who actually worked on the documentation should be the
> primary ones to decide.
>
> Thanks,
>
> Regina
>
> http://www.postgis.us 
>
>
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-- 

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


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


[postgis-users] calling postgis functions from jdbc

2011-07-26 Thread Smith Roman
Hello guys,

I want to execute the postgis function ST_Within from a java application using 
jdbc. My function executes successfully but I am not getting the result I am 
expecting. My function returns false when it should be true. Since I am able to 
view the point and polygon features in udig. (The point is actually within the 
polygon).  I want to do a point in polygon test i.e. test if a point feature is 
within a polygon feature. The two layers use epsg 4326.

Here is the code I am using. I will like to know if my code is okay:


public ArrayList searchTown(String town, String state)
{

ArrayList searchResults = new 
ArrayList();
SearchResultDTO searchResultDTO = null;


   query = "select a.gid, a.the_geom from places a where name like ?";
 

try {

logger.info(query);

  PreparedStatement prepstmt = pgCon.prepareStatement(query);
prepstmt.setString(1, town + "%");
//prepstmt.setString(2, state);

   ResultSet rset = prepstmt.executeQuery();

while (rset.next()) {

  PGgeometry geom = (PGgeometry)rset.getObject(2);
   containedInState(geom, state);

searchResultDTO = new SearchResultDTO();
//result = true;
   searchResultDTO = getTown(rset.getInt(1));
   searchResults.add(searchResultDTO);
}

rset.close();
prepstmt.close();
} catch (SQLException e) {
logger.info(e.getMessage());
e.printStackTrace();
} 

return searchResults;
}



public boolean containedInState(PGgeometry pgGeometry, String state)
{
Boolean result = null;

CallableStatement upperProc = null;


   query2 = "{ ? = call ST_Within(?, ?) }";

   
  query = "select b.the_geom from nglga b where b.statename = ? limit 
1";
  logger.info(query);

try {

PreparedStatement prepstmt = pgCon.prepareStatement(query);
prepstmt.setString(1, state);
//prepstmt.setString(2, state);

   ResultSet rset = prepstmt.executeQuery();

   if ( rset.next() )
   {
  
 PGgeometry geom = (PGgeometry)rset.getObject(1);
 
 logger.info(query2);

upperProc = pgCon.prepareCall(query2);
upperProc.registerOutParameter(1, Types.BOOLEAN);
upperProc.setObject(2, pgGeometry);
upperProc.setObject(3, geom);
   //  upperProc.setObject(2, geom);
   // upperProc.setObject(3, pgGeometry);
upperProc.execute();

result = upperProc.getBoolean(1);

if (result)
 logger.info("outcome: true " );
else
  logger.info("outcome: false " );

}
 
   upperProc.close();
rset.close();

} 
catch (SQLException e)
{
logger.info(e.getMessage());
e.printStackTrace();
}

return result;
}




 public Connection getPostGISConnection() throws Exception
 {
Connection con = null;
   
 String url = "jdbc:postgresql://192.168.56.130:5432/postgis";


logger.info(" Get postgis database connection . ");

  //  DriverManager.registerDriver(new 
oracle.jdbc.driver.OracleDriver());

//url = "jdbc:oracle:thin:@" + hostName + ":" + portNo + ":" + sid;

  Class.forName("org.postgresql.Driver");
  con = DriverManager.getConnection(url, "postgres", "test");

  
((org.postgresql.PGConnection)con).addDataType("geometry","org.postgis.PGgeometry");
  
((org.postgresql.PGConnection)con).addDataType("box3d","org.postgis.PGbox3d");


   
logger.info("postgis database connection successful ! ");

return con;
}

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


[postgis-users] Measuring distances between two 3D points using SRID 4326

2011-07-26 Thread Felix Filozov
When measuring distances, using ST_3DDistance for example, between two 3D
points (set with SRID of 4326), is it necessary to project these points onto
a flat surface before measuring the distance? After which, I assume,
ST_3DDistance
computes the Euclidean distance between the projected X and Y coordinates
and the unprojected Z coordinates.

The manual seems to support my assumption, but I'd like somebody to confirm
that.

Thanks.

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


Re: [postgis-users] PostGIS documentation license

2011-07-26 Thread Mathieu Basille

Dear Regina,

Did you consider the GNU Free Documentation License or the FreeBSD 
Documentation License? They might be more appropriate for a 
documentation compared to a CC licence (aimed for more general purposes).


In particular, they both allow for derivative and/or commercial use. The 
GNU FDL would be more restrictive (with a 'share-alike' clause), and 
allows for 'invariant sections' which are sometimes useful in a software 
documentation if you want to be sure that specific parts remain 
unchanged. The FreeBSD DL is far more permissive and basically 
corresponds to an 'attribution' clause only.


You can find more details on the web, e.g. on Wikipedia [1, 2].
All the best,
Mathieu


[1] 
http://en.wikipedia.org/wiki/GNU_Free_Documentation_License#Compatibility_with_Creative_Commons_licensing_terms


[2] http://en.wikipedia.org/wiki/FreeBSD_Documentation_License



Le 26/07/2011 15:03, Paragon Corporation a écrit :

As several have pointed out the PostGIS documentation does not have a
clearly defined license assigned to it. This is one of the items on our
todo to finish off our OSGeo incubation process.

Having it full under GPL like the rest of PostGIS is very unappealing to me.

I would prefer it be under a fairly unrestricted license such as:

Creative Common Attribution ShareAlike – something like this:
http://creativecommons.org/licenses/by-sa/3.0/us/

And if people happen to make money off of adaptations, printed copies of
it etc, more power to them.

Do others have any issues, concerns, comments, preferences about this?

I guess people who actually worked on the documentation should be the
primary ones to decide.

Thanks,

Regina

http://www.postgis.us 



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


--

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] PostGIS documentation license

2011-07-26 Thread Paragon Corporation
As several have pointed out the PostGIS documentation does not have a
clearly defined license assigned to it.  This is one of the items on our
todo to finish off our  OSGeo incubation process. 

Having it full under GPL like the rest of PostGIS is very unappealing to me.

 

I would prefer it be under a fairly unrestricted license such as:

 

Creative Common Attribution ShareAlike - something like this:
http://creativecommons.org/licenses/by-sa/3.0/us/

And if people happen to make money off of adaptations, printed copies of it
etc, more power to them.

 

Do others have any issues, concerns, comments, preferences about this?

 

I guess people who actually worked on the documentation should be the
primary ones to decide.

 

Thanks,

Regina

 

http://www.postgis.us  

 

 

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


Re: [postgis-users] Array Size Error

2011-07-26 Thread Paragon Corporation
Yes we need an aggregate ConvexHull like upcoming SQL Server 

http://msdn.microsoft.com/en-us/library/ff929295%28v=sql.110%29.aspx

 

 and Oracle has (since could it be 9.2 :-) )  --
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96630/sdo_aggr.htm

 

Regina

http://www.postgis.us  

 

 

 

  _  

From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Tuesday, July 26, 2011 1:44 PM
To: PostGIS Users Discussion
Cc: PostGIS Users
Subject: Re: [postgis-users] Array Size Error

 

The problem is you are collecting the whole table into memory before running
the hull operation. There is just an upper limit to the size of tables you
can use that trick on. The solution, says the software developer, is smarter
software, like a convex hull aggregate that builds the hull progressively,
instead if having to first collect all the inputs.

P.


On 2011-07-26, at 2:44 AM, Paul & Caroline Lewis 
wrote:

Hi All,
The following error has me lost as to finding the solution:


*
ERROR: array size exceeds the maximum allowed (1073741823)
-- Error
ERROR: array size exceeds the maximum allowed (1073741823)
SQL state: 54000

*

It happened when using this SQL:


*
SELECT ST_ConvexHull(ST_Collect(ST_Force_2D(geom))) FROM table001

*
This table has 62 million 3D point geometry records, which is one of the
small tables I want to use this function on. 
While the server we are running is quite powerful (32GB RAM), we have edited
a lot of system/DB memory settings but I cannot trace any changes we made to
the array size mentioned in the error.
It also seems this query is very similar to this thread:

 

http://postgis.refractions.net/pipermail/postgis-users/2010-March/026215.htm
l

However, I cannot ascertain if a solution was found in this thread and was
wondering if anyone has seen this problem.
The error's array size is 1GB I believe (if the number is bytes) but we have
not changed any settings that reference 1GB, does anyone know where this
array limit error is coming from. I have a similar system to that mentioned
in the thread above but for a Postgresql 9 install. The DB is fine other
than this error where more complex bounding box queries on the 3D geoms are
working.

Any help/info would be much appreciated.

Paul 

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

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


Re: [postgis-users] Array Size Error

2011-07-26 Thread Paul Ramsey
The problem is you are collecting the whole table into memory before running 
the hull operation. There is just an upper limit to the size of tables you can 
use that trick on. The solution, says the software developer, is smarter 
software, like a convex hull aggregate that builds the hull progressively, 
instead if having to first collect all the inputs.

P.

On 2011-07-26, at 2:44 AM, Paul & Caroline Lewis  wrote:

> Hi All,
> The following error has me lost as to finding the solution:
> 
> *
> ERROR: array size exceeds the maximum allowed (1073741823)
> -- Error
> ERROR: array size exceeds the maximum allowed (1073741823)
> SQL state: 54000
> *
> 
> It happened when using this SQL:
> 
> *
> SELECT ST_ConvexHull(ST_Collect(ST_Force_2D(geom))) FROM table001
> *
> This table has 62 million 3D point geometry records, which is one of the 
> small tables I want to use this function on. 
> While the server we are running is quite powerful (32GB RAM), we have edited 
> a lot of system/DB memory settings but I cannot trace any changes we made to 
> the array size mentioned in the error.
> It also seems this query is very similar to this thread:
> 
> http://postgis.refractions.net/pipermail/postgis-users/2010-March/026215.html
> 
> However, I cannot ascertain if a solution was found in this thread and was 
> wondering if anyone has seen this problem.
> The error's array size is 1GB I believe (if the number is bytes) but we have 
> not changed any settings that reference 1GB, does anyone know where this 
> array limit error is coming from. I have a similar system to that mentioned 
> in the thread above but for a Postgresql 9 install. The DB is fine other than 
> this error where more complex bounding box queries on the 3D geoms are 
> working.
> 
> Any help/info would be much appreciated.
> 
> Paul 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Mr. Puneet Kishor

On Jul 26, 2011, at 9:56 AM, Sandro Santilli wrote:

> On Tue, Jul 26, 2011 at 09:47:23AM -0500, Mr. Puneet Kishor wrote:
>> 
>> On Jul 26, 2011, at 9:34 AM, Sandro Santilli wrote:
>> 
>>> On Tue, Jul 26, 2011 at 09:31:50AM -0500, Mr. Puneet Kishor wrote:
>>> 
ERROR:  function st_interiorringn(geometry) does not exist
>>> 
>>> Check your parens, the call above is missing a parameter (ring number).
>>> 
>> 
>> That is a bit embarrassing. Yes, I had missed out on giving the ring number. 
>> However, still no luck --
>> 
>> SELECT objectid, 
>>  ST_NRings(the_geom) num_of_rings, 
>>  ST_NumInteriorRings(the_geom) num_of_int_rings, 
>>  ST_NumPoints(ST_ExteriorRing(ST_GeometryN(the_geom,1))) 
>> num_of_points_ext_ring,
>>  ST_AsText(the_geom) wkt_feature, 
>>  ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 1 
>> wkt_ext_ring,
>>  ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2), 
>> 2))) wkt_int_ring_a,
>>  ST_AsText(ST_MakePolygon(ST_GeometryN(the_geom, 2))) wkt_int_ring_b
>> FROM table 
>> WHERE objectid = 280;
>> 
>> objectid: 280;
>> num_of_rings: 4;
>> num_of_int_rings: 3;
>> num_of_points_ext_ring: 496;
>> wkt_feature: "MULTIPOLYGON(((<1>),(<2>),(<3>),(<4>))";
>> wkt_ext_ring: "POLYGON((<1>))";
>> wkt_int_ring_a: "";
>> wkt_int_ring_b: ""
>> 
>> As you see, I tried to get the interior ring "n" two different ways. Not 
>> getting anywhere.
> 
> Write down a matrix of all combinations you tried.
> Use real paper, and pencil.
> Publish a scanned version.
> 

That sounds like a great suggestion. Thanks for your help.

Puneet.

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


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Sandro Santilli
On Tue, Jul 26, 2011 at 09:47:23AM -0500, Mr. Puneet Kishor wrote:
> 
> On Jul 26, 2011, at 9:34 AM, Sandro Santilli wrote:
> 
> > On Tue, Jul 26, 2011 at 09:31:50AM -0500, Mr. Puneet Kishor wrote:
> > 
> >>ERROR:  function st_interiorringn(geometry) does not exist
> > 
> > Check your parens, the call above is missing a parameter (ring number).
> > 
> 
> That is a bit embarrassing. Yes, I had missed out on giving the ring number. 
> However, still no luck --
> 
> SELECT objectid, 
>   ST_NRings(the_geom) num_of_rings, 
>   ST_NumInteriorRings(the_geom) num_of_int_rings, 
>   ST_NumPoints(ST_ExteriorRing(ST_GeometryN(the_geom,1))) 
> num_of_points_ext_ring,
>   ST_AsText(the_geom) wkt_feature, 
>   ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 1 
> wkt_ext_ring,
>   ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2), 
> 2))) wkt_int_ring_a,
>   ST_AsText(ST_MakePolygon(ST_GeometryN(the_geom, 2))) wkt_int_ring_b
> FROM table 
> WHERE objectid = 280;
> 
> objectid: 280;
> num_of_rings: 4;
> num_of_int_rings: 3;
> num_of_points_ext_ring: 496;
> wkt_feature: "MULTIPOLYGON(((<1>),(<2>),(<3>),(<4>))";
> wkt_ext_ring: "POLYGON((<1>))";
> wkt_int_ring_a: "";
> wkt_int_ring_b: ""
> 
> As you see, I tried to get the interior ring "n" two different ways. Not 
> getting anywhere.

Write down a matrix of all combinations you tried.
Use real paper, and pencil.
Publish a scanned version.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Mr. Puneet Kishor

On Jul 26, 2011, at 9:34 AM, Sandro Santilli wrote:

> On Tue, Jul 26, 2011 at 09:31:50AM -0500, Mr. Puneet Kishor wrote:
> 
>>  ERROR:  function st_interiorringn(geometry) does not exist
> 
> Check your parens, the call above is missing a parameter (ring number).
> 

That is a bit embarrassing. Yes, I had missed out on giving the ring number. 
However, still no luck --

SELECT objectid, 
ST_NRings(the_geom) num_of_rings, 
ST_NumInteriorRings(the_geom) num_of_int_rings, 
ST_NumPoints(ST_ExteriorRing(ST_GeometryN(the_geom,1))) 
num_of_points_ext_ring,
ST_AsText(the_geom) wkt_feature, 
ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 1 
wkt_ext_ring,
ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2), 
2))) wkt_int_ring_a,
ST_AsText(ST_MakePolygon(ST_GeometryN(the_geom, 2))) wkt_int_ring_b
FROM table 
WHERE objectid = 280;

objectid: 280;
num_of_rings: 4;
num_of_int_rings: 3;
num_of_points_ext_ring: 496;
wkt_feature: "MULTIPOLYGON(((<1>),(<2>),(<3>),(<4>))";
wkt_ext_ring: "POLYGON((<1>))";
wkt_int_ring_a: "";
wkt_int_ring_b: ""

As you see, I tried to get the interior ring "n" two different ways. Not 
getting anywhere.

Puneet.

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


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Sandro Santilli
On Tue, Jul 26, 2011 at 09:31:50AM -0500, Mr. Puneet Kishor wrote:

>   ERROR:  function st_interiorringn(geometry) does not exist

Check your parens, the call above is missing a parameter (ring number).

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Mr. Puneet Kishor

On Jul 26, 2011, at 7:33 AM, Sandro Santilli wrote:

> On Tue, Jul 26, 2011 at 07:16:15AM -0500, Mr. Puneet Kishor wrote:
> 
>> Thanks for confirming the above. However, per my follow-up email (see 
>> http://postgis.refractions.net/pipermail/postgis-users/2011-July/030366.html),
>>  I am not getting the interior rings as polygons. They are coming out as 
>> LINESTRINGs. Shouldn't the indivdual components of the MULTIPOLYGON be 
>> POLYGONs?
> 
> Individual components of MULTIPOLYGONs are POLYGONs.
> You get them with ST_GeometryN.
> Components of POLYGONs are RINGs.
> Ring are represented as closed LINESTRINGS, following OGC spec.
> You can make polygons out of closed LINESTRINGs using ST_MakePolygon.
> 

Ok. I am still foxed. The following 

ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2

returns with

ERROR:  function st_interiorringn(geometry) does not exist
LINE 7:  ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_...
  ^
HINT:  No function matches the given name and argument types. You might 
need to add explicit type casts.

I am using the latest binary release for Snow Leopard available at kyngchaos.com

Looking at the docs, I see that ST_InteriorRingN() "will not work for 
MULTIPOLYGONs. Use in conjunction with ST_Dump for MULTIPOLYGONS." Looking at 
ST_Dump, I am getting a bit lost.

Essentially, I want to unravel a (MULTI)POLYGON. I want all the points of each 
component polygon for each feature. To do that, I have to get to each 
individual "ring" (which, by its name, "ring," I take it to mean a polygon, not 
a linestring, but whatever). So, now it seems I am able to get to the exterior 
ring via `ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 
1` but not the individual interior rings.

Much advance appreciation for any help/guidance.

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


Re: [postgis-users] Shapefiles exported from PostGIS and ESRI ArcView 9 compatibility

2011-07-26 Thread Stephen Woodbridge

On 7/25/2011 10:52 PM, Paragon Corporation wrote:

Steve,

Is your pgsql2shp not exporting .prj files?  It should be if you are
exporting an sql query or table/view with a known srid and all records have
the same srid. It should be doing this from version PostGIS 1.3.6 on.  I
wrote that logic because I had similar issues with users using ArcMap not
being able to overlay the exports with their other data layers.

Thanks,
Regina
http://www.postgis.us


Hmmm, I recently upgraded and just now checked and yes it is writing the 
.prj file.  Sorry for old information and glad to know you are on top of 
these issues.


RCSID: $Id: pgsql2shp.c 5181 2010-02-01 17:35:55Z pramsey $ RELEASE: 1.5 
USE_GEOS=1 USE_PROJ=1 USE_STATS=1



Thanks,
  -Steve


-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Stephen
Woodbridge
Sent: Monday, July 25, 2011 9:17 PM
To: postgis-users@postgis.refractions.net
Subject: Re: [postgis-users] Shapefiles exported from PostGIS and ESRI
ArcView 9 compatibility

On 7/21/2011 3:23 AM, Ben Madin wrote:

G'dat all,

We have a client (potential client) who wants some mapping done and
the maps returned in shapefile format. In the contract they insist on
specifying that the shapefiles are compatible with "ESRI's ArcView
version 9" (their words, not mine).

I don't have "ESRI's ArcView version 9", and don't intend on spending
that sort of money (more than the contract is worth). However, I'm
sure that if what we send back doesn't open in "ESRI's ArcView
version 9" it will become our problem.

Does anyone have any reason to suspect that a shapefile created using
valid OGC geometry in PostGIS and exported using pgsql2shp would not
or might not work on "ESRI's ArcView version 9"?

Are there any issues that someone who is across platforms can help me
with?

(I routinely use shapefiles created using valid OGC geometry in
PostGIS and exported using pgsql2shp in QGIS and MapServer and send
them to other people, so I have no reason to be concerned except that
the client insists on this line remaining the contract!)


Hi Ben,

I use ArcGIS Explorer and it will not open shapefiles that do not have
.prj file. What I do in this case if to just write a script that
generates that appropriate .prj that I need. The other option that might
be work better for you is to use ogr2ogr to export the postgis table
into a shapefile as I believe that will write the .prj file appropriately.

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


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


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


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Sandro Santilli
On Tue, Jul 26, 2011 at 07:16:15AM -0500, Mr. Puneet Kishor wrote:

> Thanks for confirming the above. However, per my follow-up email (see 
> http://postgis.refractions.net/pipermail/postgis-users/2011-July/030366.html),
>  I am not getting the interior rings as polygons. They are coming out as 
> LINESTRINGs. Shouldn't the indivdual components of the MULTIPOLYGON be 
> POLYGONs?

Individual components of MULTIPOLYGONs are POLYGONs.
You get them with ST_GeometryN.
Components of POLYGONs are RINGs.
Ring are represented as closed LINESTRINGS, following OGC spec.
You can make polygons out of closed LINESTRINGs using ST_MakePolygon.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Mr. Puneet Kishor


--
Puneet Kishor http://punkish.org
Researcher http://paleodb.org http://macrostrat.org http://carbonmodel.org
Science Fellow http://creativecommons.org
Charter Member http://osgeo.org

On Jul 26, 2011, at 2:43 AM, Sandro Santilli  wrote:

> On Mon, Jul 25, 2011 at 04:16:02PM -0500, Mr. Puneet Kishor wrote:
> 
>> Thanks. The above works. So, does this mean that given 
>> "MULTIPOLYGON(((1),(2),(3),(4)))", 1 indeed is an exterior ring, and 2-4 are 
>> interior rings, and the "entity" does have 4 rings kinda like below?
>> 
>> +---+
>> |   |
>> |  +-+   +---+  |
>> |  | |   | 3 |  |
>> |  |  2  |   +---+  |
>> |  +-+  |
>> |   ++  |
>> |   ||  |
>> |   1   |   4|  |
>> |   ||  |
>> |   ++  |
>> +---+
> 
> Yes.
> 


Thanks for confirming the above. However, per my follow-up email (see 
http://postgis.refractions.net/pipermail/postgis-users/2011-July/030366.html), 
I am not getting the interior rings as polygons. They are coming out as 
LINESTRINGs. Shouldn't the indivdual components of the MULTIPOLYGON be POLYGONs?
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Array Size Error

2011-07-26 Thread Paul & Caroline Lewis












Hi All,
The following error has me lost as to finding the solution:
 
*
ERROR:  array size exceeds the maximum allowed (1073741823)
-- Error
ERROR: array size exceeds the maximum allowed (1073741823)
SQL state: 54000
*
 
It happened when using this SQL:
 
*
SELECT ST_ConvexHull(ST_Collect(ST_Force_2D(geom))) FROM table001
*
This table has 62 million 3D point geometry records, which is one of the small 
tables I want to use this function on. 
While the server we are running is quite powerful (32GB RAM), we have edited a 
lot of system/DB memory settings but I cannot trace any changes we made to the 
array size mentioned in the error.
It also seems this query is very similar to this thread:
 
http://postgis.refractions.net/pipermail/postgis-users/2010-March/026215.html
 
However, I cannot ascertain if a solution was found in this thread and was 
wondering if anyone has seen this problem.
The error's array size is 1GB I believe (if the number is bytes) but we have 
not changed any settings that reference 1GB, does anyone know where this array 
limit error is coming from. I have a similar system to that mentioned in the 
thread above but for a Postgresql 9 install. The DB is fine other than this 
error where more complex bounding box queries on the 3D geoms are working.
 
Any help/info would be much appreciated.
 
Paul 


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


Re: [postgis-users] exterior rings in multipolygons

2011-07-26 Thread Sandro Santilli
On Mon, Jul 25, 2011 at 04:16:02PM -0500, Mr. Puneet Kishor wrote:

> Thanks. The above works. So, does this mean that given 
> "MULTIPOLYGON(((1),(2),(3),(4)))", 1 indeed is an exterior ring, and 2-4 are 
> interior rings, and the "entity" does have 4 rings kinda like below?
> 
> +---+
> |   |
> |  +-+   +---+  |
> |  | |   | 3 |  |
> |  |  2  |   +---+  |
> |  +-+  |
> |   ++  |
> |   ||  |
> |   1   |   4|  |
> |   ||  |
> |   ++  |
> +---+

Yes.

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users