Re: [postgis-users] ST_Clip

2012-07-26 Thread Pierre Racine
So the big square, in your image, is a whole 64x64 tile?

I gave a try to the same kind of query here and everything is fine. Are you 
sure the circle is the same geometry used to clip?

What about SELECT ST_PostGIS_Full_Version()

Pierre

 -Original Message-
 From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-
 boun...@postgis.refractions.net] On Behalf Of Paolo Cavallini
 Sent: Thursday, July 26, 2012 1:33 AM
 To: postgis-users@postgis.refractions.net
 Subject: Re: [postgis-users] ST_Clip
 
 Il 26/07/2012 01:54, Pierre Racine ha scritto:
  Is this table tiled?
 yes, -t 64x64
  Why does your WHERE is about the rid and not ST_Intersects(rast, geom)?
 To make the clip on a tile only, and test how it works, I started
 following the example in http://www.postgis.org/docs/RT_ST_Clip.html ,
 but got stuck early.
 
 Thanks.
 
 --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
 
 ___
 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] ST_Clip

2012-07-26 Thread Paolo Cavallini
Il 26/07/2012 16:33, Pierre Racine ha scritto:
 So the big square, in your image, is a whole 64x64 tile?
not; I tried with a smaller buffer, I obtained a smaller square.
 I gave a try to the same kind of query here and everything is fine. Are you 
 sure the circle is the same geometry used to clip?
it should be: I relaunched the same command, just removing the ST_Clip
 What about SELECT ST_PostGIS_Full_Version()
SELECT ST_PostGIS_Full_Version();
ERROR:  function st_postgis_full_version() does not exist

SELECT PostGIS_Full_Version();
 POSTGIS=2.0.1 r9979 GEOS=3.3.3-CAPI-1.7.4 PROJ=Rel. 4.7.1, 23
September 2009 GDAL=GDAL 1.9.0, released 2011/12/29 LIBXML=2.8.0 RASTER

Thanks a lot.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

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


Re: [postgis-users] ST_Clip

2012-07-26 Thread Stefano Iacovella
Paolo

I am not sure if this is related to your issue but you may want to
upgrade to GEOS 3.3.5 as there was an issue in 3.3.3 and 3.3.4
http://trac.osgeo.org/geos/ticket/558

Regards

Stefano

---
41.95581N 12.52854E


http://www.linkedin.com/in/stefanoiacovella

http://twitter.com/#!/Iacovellas


2012/7/26 Paolo Cavallini cavall...@faunalia.it:
 Il 26/07/2012 16:33, Pierre Racine ha scritto:
 So the big square, in your image, is a whole 64x64 tile?
 not; I tried with a smaller buffer, I obtained a smaller square.
 I gave a try to the same kind of query here and everything is fine. Are you 
 sure the circle is the same geometry used to clip?
 it should be: I relaunched the same command, just removing the ST_Clip
 What about SELECT ST_PostGIS_Full_Version()
 SELECT ST_PostGIS_Full_Version();
 ERROR:  function st_postgis_full_version() does not exist

 SELECT PostGIS_Full_Version();
  POSTGIS=2.0.1 r9979 GEOS=3.3.3-CAPI-1.7.4 PROJ=Rel. 4.7.1, 23
 September 2009 GDAL=GDAL 1.9.0, released 2011/12/29 LIBXML=2.8.0 RASTER

 Thanks a lot.

 --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

 ___
 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] ST_Clip

2012-07-26 Thread Paolo Cavallini
Il 26/07/2012 17:23, Stefano Iacovella ha scritto:
 Paolo

 I am not sure if this is related to your issue but you may want to
 upgrade to GEOS 3.3.5 as there was an issue in 3.3.3 and 3.3.4
 http://trac.osgeo.org/geos/ticket/558

Thanks Stefano. I do not understand how this bug could affect my issue,
however.
Anyone confirms?
I prefer to stick to geos 3.3.3, as this is the version in current
Debian (soon to become stable), thus the one most used around, I guess.
All the best.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

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


Re: [postgis-users] ST_Clip

2012-07-26 Thread Pierre Racine
What happen if do a query like this:

SELECT (gv).geom, (gv).val
FROM (SELECT 
ST_PixelAsPolygons(ST_AsRaster(ST_Buffer(ST_Centroid(ST_Envelope(rast)), 
0.5000), rast, ST_BandPixelType(rast, 1), 1, -1)) gv
  FROM hdr
  WHERE rid = 4
) foo

and display the resulting geometries labelled with the values?

This is the first step of the clipping: creating a rasterized version of the 
buffer geometry aligned on the raster.

Pierre

 -Original Message-
 From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-
 boun...@postgis.refractions.net] On Behalf Of Paolo Cavallini
 Sent: Thursday, July 26, 2012 10:53 AM
 To: postgis-users@postgis.refractions.net
 Subject: Re: [postgis-users] ST_Clip
 
 Il 26/07/2012 16:33, Pierre Racine ha scritto:
  So the big square, in your image, is a whole 64x64 tile?
 not; I tried with a smaller buffer, I obtained a smaller square.
  I gave a try to the same kind of query here and everything is fine. Are you 
  sure
 the circle is the same geometry used to clip?
 it should be: I relaunched the same command, just removing the ST_Clip
  What about SELECT ST_PostGIS_Full_Version()
 SELECT ST_PostGIS_Full_Version();
 ERROR:  function st_postgis_full_version() does not exist
 
 SELECT PostGIS_Full_Version();
  POSTGIS=2.0.1 r9979 GEOS=3.3.3-CAPI-1.7.4 PROJ=Rel. 4.7.1, 23
 September 2009 GDAL=GDAL 1.9.0, released 2011/12/29 LIBXML=2.8.0
 RASTER
 
 Thanks a lot.
 
 --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
 
 ___
 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] ST_Clip

2012-07-26 Thread Paolo Cavallini
Il 26/07/2012 19:39, Pierre Racine ha scritto:
 What happen if do a query like this:

 SELECT (gv).geom, (gv).val
 FROM (SELECT 
 ST_PixelAsPolygons(ST_AsRaster(ST_Buffer(ST_Centroid(ST_Envelope(rast)), 
 0.5000), rast, ST_BandPixelType(rast, 1), 1, -1)) gv
   FROM hdr
   WHERE rid = 4
 ) foo

 and display the resulting geometries labelled with the values?

 This is the first step of the clipping: creating a rasterized version of the 
 buffer geometry aligned on the raster.
Here it is (qgis complains that it is not a valid layer, as it misses an
id):
   
   geom
 | val 
+-
 
010320BB0B010005009D13253B5710384114AE47315EC652419D13253BBB10384114AE47315EC652419D13253BBB10384114AE473145C652419D13253B5710384114AE473145C652419D13253B5710384114AE47315EC65241
|   
 
010320BB0B010005009D13253B5710384114AE473145C652419D13253BBB10384114AE473145C652419D13253BBB10384114AE47312CC652419D13253B5710384114AE47312CC652419D13253B5710384114AE473145C65241
|   
 
010320BB0B010005009D13253BBB10384114AE47315EC652419D13253B1F11384114AE47315EC652419D13253B1F11384114AE473145C652419D13253BBB10384114AE473145C652419D13253BBB10384114AE47315EC65241
|   
 
010320BB0B010005009D13253BBB10384114AE473145C652419D13253B1F11384114AE473145C652419D13253B1F11384114AE47312CC652419D13253BBB10384114AE47312CC652419D13253BBB10384114AE473145C65241
|   
(4 righe)

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

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


Re: [postgis-users] ST_Clip

2012-07-26 Thread Paolo Cavallini
Il 26/07/2012 19:54, Paolo Cavallini ha scritto:
 Il 26/07/2012 19:39, Pierre Racine ha scritto:
 What happen if do a query like this:

 SELECT (gv).geom, (gv).val
 FROM (SELECT 
 ST_PixelAsPolygons(ST_AsRaster(ST_Buffer(ST_Centroid(ST_Envelope(rast)), 
 0.5000), rast, ST_BandPixelType(rast, 1), 1, -1)) gv
   FROM hdr
   WHERE rid = 4
 ) foo

 and display the resulting geometries labelled with the values?

 This is the first step of the clipping: creating a rasterized version of the 
 buffer geometry aligned on the raster.
If I redo the query with the same buffer size as my previous one, I
obtain a grid that encloses exactly the buffer; the raster is smaller.
See attached.
Thanks.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

attachment: Schermata del 2012-07-26 20:03:43.png___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] ST_Clip

2012-07-26 Thread Pierre Racine
Now what if you symbolize the value of the raster properly (1 = white and -1 = 
black) to display the shape of the buffer?

 -Original Message-
 From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-
 boun...@postgis.refractions.net] On Behalf Of Paolo Cavallini
 Sent: Thursday, July 26, 2012 2:04 PM
 To: postgis-users@postgis.refractions.net
 Subject: Re: [postgis-users] ST_Clip
 
 Il 26/07/2012 19:54, Paolo Cavallini ha scritto:
  Il 26/07/2012 19:39, Pierre Racine ha scritto:
  What happen if do a query like this:
 
  SELECT (gv).geom, (gv).val
  FROM (SELECT
 ST_PixelAsPolygons(ST_AsRaster(ST_Buffer(ST_Centroid(ST_Envelope(rast)),
 0.5000), rast, ST_BandPixelType(rast, 1), 1, -1)) gv
FROM hdr
WHERE rid = 4
  ) foo
 
  and display the resulting geometries labelled with the values?
 
  This is the first step of the clipping: creating a rasterized version of 
  the buffer
 geometry aligned on the raster.
 If I redo the query with the same buffer size as my previous one, I
 obtain a grid that encloses exactly the buffer; the raster is smaller.
 See attached.
 Thanks.
 
 --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

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


Re: [postgis-users] ST_Clip

2012-07-25 Thread Pierre Racine
Is this table tiled? Why does your WHERE is about the rid and not 
ST_Intersects(rast, geom)?

Pierre

From: postgis-users-boun...@postgis.refractions.net 
[postgis-users-boun...@postgis.refractions.net] On Behalf Of Paolo Cavallini 
[cavall...@faunalia.it]
Sent: Wednesday, July 25, 2012 6:42 PM
To: PostGIS Users Discussion
Subject: [postgis-users] ST_Clip

Hi all.
I may well be tired, but I cannot understand why:

CREATE TABLE clip2
  AS SELECT rid, ST_Clip(rast, 1,ST_Buffer(ST_Centroid(ST_Envelope
(rast)),5000))
  AS rast from hdr
 WHERE rid = 4;

does not result in a circle, but in a square, contained in the buffer
but smaller.
See attached pictures, with the buffer in green, and the clipped raster
inside.

Any hint?
Thanks.

--
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

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


Re: [postgis-users] ST_Clip

2012-07-25 Thread Paolo Cavallini
Il 26/07/2012 01:54, Pierre Racine ha scritto:
 Is this table tiled? 
yes, -t 64x64
 Why does your WHERE is about the rid and not ST_Intersects(rast, geom)?
To make the clip on a tile only, and test how it works, I started
following the example in http://www.postgis.org/docs/RT_ST_Clip.html ,
but got stuck early.

Thanks.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

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