Re: [postgis-users] Mapserver with postgis, sql query error.

2011-08-01 Thread Maria Arias de Reyna
El Sábado 30 Julio 2011, Nicolas ( cse ) escribió:
 select encode(AsBinary(force_collection(force_2d(the_geom)),'NDR'),'hex')
 as geom,gid from t_parcelas where the_geom 
 GeomFromText('POLYGON((5600615.254754 5725111.70807103,5600615.254754
 5739818.70784397,5620240.983548 5739818.70784397,5620240.983548
 5725111.70807103,5600615.254754
 5725111.70807103))',find_srid('','t_parcelas','the_geom'))
 With thi error:
 ERROR:  geometry requires more points
 
 ** Error **
 
 ERROR: geometry requires more points
 SQL state: XX000


A stupid question, just in case. You say that AsBinary returns a valid 
geometry, but does it have a collection with points? I mean, could it be an 
empty collection?

Also, are you sure the encode function is not corrupted? If AsBinary returns 
something hexadecimal, the encode function should have no problem, no matter 
if the geometry is valid or not. Have you tried to run the encode function 
with the result of the AsBinary? And with something simpler?

-- 
María Arias de Reyna Domínguez
Área de Operaciones

Emergya Consultoría 
Tfno: +34 954 51 75 77 / +34 607 43 74 27
Fax: +34 954 51 64 73 
www.emergya.es 
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Mapserver with postgis, sql query error.

2011-08-01 Thread Sandro Santilli
On Mon, Aug 01, 2011 at 08:43:06AM +0200, Maria Arias de Reyna wrote:
 El Sábado 30 Julio 2011, Nicolas ( cse ) escribió:
..
  ERROR: geometry requires more points
  SQL state: XX000

 If AsBinary returns 
 something hexadecimal, the encode function should have no problem, no matter 
 if the geometry is valid or not. 

Unfortunately starting with a given PostGIS version some output
functions (in addition to input functions) added simple checks
for validity. ST_AsBinary must be one of them.

Canonical input and output functions were fixed in latest 1.4, 1.5
and trunk, to allow for dump/reloads in presence of invalid data,
see http://trac.osgeo.org/postgis/ticket/411

Whether ST_AsBinary should also be fixed is debatable.
I suggest you file a ticket and continue the discussion there.

--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


[postgis-users] Mapserver with postgis, sql query error.

2011-07-30 Thread Nicolas ( cse )
Hi,
I'm a newby with this.

I have a shape file that I upload to postGis Database, with the windows
program postgis and dbf loader.
Then I create a test with MS4W environment.

I setup a LOG in the map file.
And the error y following:

*code*
[Sat Jul 30 01:45:34 2011].75 CGI Request 1 on process 4620
[Sat Jul 30 01:45:34 2011].75 msDrawMap(): WMS/WFS set-up and query,
0.000s
[Sat Jul 30 01:45:34 2011].906000 msPostGISLayerWhichShapes(): Query error.
Error (ERROR:  geometry requires more points
) executing query: select
encode(AsBinary(force_collection(force_2d(the_geom)),'NDR'),'hex') as
geom,gid from t_parcelas where the_geom 
GeomFromText('POLYGON((5600615.254754 5725111.70807103,5600615.254754
5739818.70784397,5620240.983548 5739818.70784397,5620240.983548
5725111.70807103,5600615.254754
5725111.70807103))',find_srid('','t_parcelas','the_geom'))
[Sat Jul 30 01:45:34 2011].906000 msDrawMap(): Image handling error. Failed
to draw layer named 'Parcelas'.
[Sat Jul 30 01:45:34 2011].906000 msFreeMap(): freeing map at 01DBAD80.

*/code*

This is the layer section in the map file
*map*
...
 LAYER # States polygon layer begins here
NAME Parcelas
CONNECTIONTYPE postgis
CONNECTION user=postgres password=postgres dbname=muni_gis
DATA the_geom from t_parcelas
STATUS   DEFAULT
TYPE POLYGON

PROJECTION
  init=epsg:4221
END

  END # States polygon layer ends here

*/map*

The table is populated, everything looks fine, but I can't see any map.


Then I enter the SQl Query in the SQL Window of pgAdmin III, and start to
rewrite this sql query:

select encode(AsBinary(force_collection(force_2d(the_geom)),'NDR'),'hex')
as geom,gid from t_parcelas where the_geom 
GeomFromText('POLYGON((5600615.254754 5725111.70807103,5600615.254754
5739818.70784397,5620240.983548 5739818.70784397,5620240.983548
5725111.70807103,5600615.254754
5725111.70807103))',find_srid('','t_parcelas','the_geom'))
With thi error:
ERROR:  geometry requires more points

** Error **

ERROR: geometry requires more points
SQL state: XX000


If I extract function AsBinary, there is no error:
Total query runtime: 9625 ms.
67354 rows retrieved.


Here is my question:
1) How to check if the data is correct ?
2) do I have lo load data with shp2pgsql command line utility?
3) any idea ?

Best Regards.
Nicolas
-- 

___
.:Nicolás Machado
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Mapserver with postgis, sql query error.

2011-07-30 Thread James David Smith
Hey Nicholas,

I'm a newbie, but just to say that I've used the 'Spit' tool within
QGIS to load shapefiles into PostGIS - mght be worth a look. You can
also then load the table into QGIS once it is in the system to see if
it has stored it correctly?

James

On 30 July 2011 15:17, Nicolas ( cse )
nicolas.mach...@codigosudeste.com.ar wrote:
 Hi,
 I'm a newby with this.
 I have a shape file that I upload to postGis Database, with the windows
 program postgis and dbf loader.
 Then I create a test with MS4W environment.
 I setup a LOG in the map file.
 And the error y following:
 code
 [Sat Jul 30 01:45:34 2011].75 CGI Request 1 on process 4620
 [Sat Jul 30 01:45:34 2011].75 msDrawMap(): WMS/WFS set-up and query,
 0.000s
 [Sat Jul 30 01:45:34 2011].906000 msPostGISLayerWhichShapes(): Query error.
 Error (ERROR:  geometry requires more points
 ) executing query: select
 encode(AsBinary(force_collection(force_2d(the_geom)),'NDR'),'hex') as
 geom,gid from t_parcelas where the_geom 
 GeomFromText('POLYGON((5600615.254754 5725111.70807103,5600615.254754
 5739818.70784397,5620240.983548 5739818.70784397,5620240.983548
 5725111.70807103,5600615.254754
 5725111.70807103))',find_srid('','t_parcelas','the_geom'))
 [Sat Jul 30 01:45:34 2011].906000 msDrawMap(): Image handling error. Failed
 to draw layer named 'Parcelas'.
 [Sat Jul 30 01:45:34 2011].906000 msFreeMap(): freeing map at 01DBAD80.
 /code

 This is the layer section in the map file
 map
 ...
  LAYER # States polygon layer begins here
     NAME         Parcelas
     CONNECTIONTYPE postgis
     CONNECTION user=postgres password=postgres dbname=muni_gis
     DATA the_geom from t_parcelas
     STATUS       DEFAULT
     TYPE         POLYGON
     PROJECTION
       init=epsg:4221
     END
   END # States polygon layer ends here
 /map
 The table is populated, everything looks fine, but I can't see any map.

 Then I enter the SQl Query in the SQL Window of pgAdmin III, and start to
 rewrite this sql query:
 select encode(AsBinary(force_collection(force_2d(the_geom)),'NDR'),'hex')
 as geom,gid from t_parcelas where the_geom 
 GeomFromText('POLYGON((5600615.254754 5725111.70807103,5600615.254754
 5739818.70784397,5620240.983548 5739818.70784397,5620240.983548
 5725111.70807103,5600615.254754
 5725111.70807103))',find_srid('','t_parcelas','the_geom'))
 With thi error:
 ERROR:  geometry requires more points
 ** Error **
 ERROR: geometry requires more points
 SQL state: XX000

 If I extract function AsBinary, there is no error:
 Total query runtime: 9625 ms.
 67354 rows retrieved.

 Here is my question:
 1) How to check if the data is correct ?
 2) do I have lo load data with shp2pgsql command line utility?
 3) any idea ?
 Best Regards.
 Nicolas
 --

 ___
 .:Nicolás Machado

 ___
 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] Mapserver with postgis, sql query error.

2011-07-30 Thread Sandro Santilli
On Sat, Jul 30, 2011 at 11:17:08AM -0300, Nicolas ( cse ) wrote:

 ERROR: geometry requires more points
 
 If I extract function AsBinary, there is no error:
...
 Here is my question:
 1) How to check if the data is correct ?

ST_IsValid, ST_IsValidReason, ST_IsValidDetail

 2) do I have lo load data with shp2pgsql command line utility?

How's that related to your problem ?

 3) any idea ?

Many.

--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] Mapserver with postgis, sql query error.

2011-07-30 Thread Nicolas ( cse )
Hi Sandro, my second question, is because the firs time I load data using
the GUI interface of tha utility.
But I just loaded via command line, and I guet the same error ...
In the table I got 67811 records, the error means that ALL of them have a
problem ? or at leastone of them?
In that case, how can I know wich one is?

How is it posible that if I can see the map using the shape file, but I
can't using the postgis database ?

Thanks  and looking fordward to a solution ...

Best Regards


2011/7/30 Sandro Santilli s...@keybit.net

 On Sat, Jul 30, 2011 at 11:17:08AM -0300, Nicolas ( cse ) wrote:

  ERROR: geometry requires more points
 
  If I extract function AsBinary, there is no error:
 ...
  Here is my question:
  1) How to check if the data is correct ?

 ST_IsValid, ST_IsValidReason, ST_IsValidDetail

  2) do I have lo load data with shp2pgsql command line utility?

 How's that related to your problem ?

  3) any idea ?

 Many.

 --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




-- 
___
.:Nicolás Machado
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Mapserver with postgis, sql query error.

2011-07-30 Thread Sandro Santilli
On Sat, Jul 30, 2011 at 03:07:56PM -0300, Nicolas ( cse ) wrote:

 In the table I got 67811 records, the error means that ALL of them have a
 problem ? or at leastone of them?
 In that case, how can I know wich one is?

Using ST_IsValid or ST_IsValidReason or ST_IsValidDetail.

Did you look at them ?

--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] Mapserver with postgis, sql query error.

2011-07-30 Thread Nicolas ( cse )
Yes, sorry, sometimes I ask before try !
In the table was 134 records wrong ...
In other post I will be asking why is that ?
if the shape file is ok, why not the postgis table 

Best Regards



2011/7/30 Sandro Santilli s...@keybit.net

 On Sat, Jul 30, 2011 at 03:07:56PM -0300, Nicolas ( cse ) wrote:

  In the table I got 67811 records, the error means that ALL of them have a
  problem ? or at leastone of them?
  In that case, how can I know wich one is?

 Using ST_IsValid or ST_IsValidReason or ST_IsValidDetail.

 Did you look at them ?

 --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




-- 
___
.:Nicolás Machado
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Mapserver with postgis, sql query error.

2011-07-30 Thread Sandro Santilli
On Sat, Jul 30, 2011 at 05:13:12PM -0300, Nicolas ( cse ) wrote:
 Yes, sorry, sometimes I ask before try !
 In the table was 134 records wrong ...
 In other post I will be asking why is that ?
 if the shape file is ok, why not the postgis table 

My guess is that the shapefile is not ok either, but anyway,
upload it somewhere so we take a look ?

Another question is whether or not ST_AsBinary should complain
rather than letting an invalid geometry slip out (which may be
what you mean by the shape is ok).

--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