[postgis-users] polygon of sphere

pcreso at pcreso.com pcreso at pcreso.com
Thu May 26 13:25:01 PDT 2011


Hi Mike,

Look at "case" in your SQL, might meet your needs & if the ST_contains()/ST_covers() function reuslt is cached in a select statement, which I think it is now, will be reasonably effective.

http://www.postgresql.org/docs/9.0/interactive/plpgsql-control-structures.html

select case when ST_contains(poly, point) then point_name
          else 'sorry, nothing matches' end as my_name,
          case when ST_contains(poly, point) then point_desc

          else 'there is no description' end as my_desc,
          ...

HTH,

  Brent Wood

--- On Fri, 5/27/11, Michael Welter <mike at introspect.com> wrote:

From: Michael Welter <mike at introspect.com>
Subject: Re: [postgis-users] polygon of sphere
To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
Date: Friday, May 27, 2011, 7:16 AM

Thanks, Paul,

I have a database of country borders.  If the point lies within a particular border then the query will return country-specific information.  If the point doesn't lie within a border then I would like to return some default information.

Mike

On May 26, 2011, at 12:42 PM, Paul Ramsey wrote:

> Nope, there isn't. In fact, such a thing will give us the shakes as
> our code for determining in/out status  of an object depends on first
> being able to generate one point that is definitively outside the
> containing area.  Maybe there is some other way to skin your cat, what
> is the higher level problem you are trying to solve?
> 
> P.
> 
> On Thu, May 26, 2011 at 11:05 AM, Michael Welter <mike at introspect.com> wrote:
>> Hello,
>> 
>> Using type GEOGRAPHY, is there a polygon such that ST_COVERS(Polygon,Point) returns true for every point?  Something like -180˚ to +180˚ longitude and -90˚ to +90˚ latitude?
>> 
>> Thanks,
>> 
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110526/a200c7b0/attachment.html>


More information about the postgis-users mailing list