[postgis-users] contains function

Paul Ramsey pramsey at refractions.net
Wed Oct 5 14:49:46 PDT 2005


"polygon" is an internal PostgreSQL type, "geometry" is a PostGIS type. 
Your text form is the PostgreSQL polygon text form, not the 
well-known-text form.  Try this:

Select astext(wkb_geometry), name, state
 From usroads
Where state = ‘Alabama’
And name like ‘%Ross Clark%’
And Contains(GeometryFromText('POLYGON((-85.440253 31.207678, -85.421703 
31.207678, -85.421703 31.226228, -85.440253 31.226228, -85.440253 
31.207678))',-1), wkb_geometry);

Note that you are not using an index in this query, so if your table is 
large, it will be slow.

Frances Collier wrote:
> Are there any examples of using postgis that I can use for research?
> 
> 
> 
> My current problem is the use of the Contains function.  Here’s my 
> statement:
> 
> 
> 
> Select astext(wkb_geometry), name, state
> 
> From usroads
> 
> Where state = ‘Alabama’
> 
> And name like ‘%Ross Clark%’
> 
> And Contains(polygon('(-85.440253,31.207678),(-85.421703,31.207678),
> 
> 
> (-85.421703,31.226228),(-85.440253,31.226228),
> 
> (-85.440253,31.207678)'), wkb_geometry);
> 
> 
> 
> Here is the error I’m getting back:
> 
> 
> 
> ERROR:  function contains(polygon, geometry) does not exist
> 
> HINT:  No function matches the given name and argument types. You may
>  need to add explicit type casts.
> 
> 
> 
> I’ve tried numerous ways to fix this but I haven’t had any luck. I’d
>  really appreciate any help I can get.
> 
> 
> 
> Thank you,
> 
> Frances
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> _______________________________________________ postgis-users mailing
> list postgis-users at postgis.refractions.net 
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list