[postgis-users] Problem with raster/polygon intersection

Paragon Corporation lr at pcorp.us
Sat Feb 4 18:05:03 PST 2012


Your polygon is untyped so could cast to raster or geometry thus ambiguous
which function to use.
 
Try casting it first by changing your code to:
 
 SELECT
ST_SummaryStats(r.rast) as stats
FROM
new_york_r as r 
WHERE
ST_Intersects(r.rast, 'SRID=900913;POLYGON((-8239995.68240392
4974479.31918724,-8230242.31759608 4974479.31918724,-8230242.31759608
4979684.68081276,-8239995.68240392 4979684.68081276,-8239995.68240392
4974479.31918724))'::geometry)

Hope that helps,
Regina
h <http://www.postgis.us> ttp://www.postgis.us

 

  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of David
Quinn
Sent: Saturday, February 04, 2012 7:51 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Problem with raster/polygon intersection


Hello List,

I'm trying to intersect a raster with a polygon and running into an error
message that I don't understand. 

    SELECT
          ST_SummaryStats(r.rast) as stats
     FROM
          new_york_r as r     
     WHERE
          ST_Intersects(r.rast, 'SRID=900913;POLYGON((-8239995.68240392
4974479.31918724,-8230242.31759608 4974479.31918724,-8230242.31759608
4979684.68081276,-8239995.68240392 4979684.68081276,-8239995.68240392
4974479.31918724))')

The error message is:

"ERROR:  function st_intersects(raster, unknown) is not unique
LINE 6:   ST_Intersects(r.rast, 'SRID=900913;POLYGON((-8239995.68240...
          ^
HINT:  Could not choose a best candidate function. You might need to add
explicit type casts."

I am able to run a very similar query with ST_Intersects(r.rast, geom),
where geom is from another table, and it runs fine. ST_Intersects(geom,
'SRID=900913;POLYGON((-823999.....)') also runs without a problem when geom
is a vector.

Is there a step that I am missing here to run this intersection on a raster?

I'm using PostGIS 2.0.0 SVN / Postgresql 9.1 on Windows 7. 

Thanks,
David





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120204/fd8f4a06/attachment.html>


More information about the postgis-users mailing list