[postgis-users] some wrong with geometry_overright()!

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Mon Mar 8 08:35:51 PST 2004


> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of David Fan
> Sent: 08 March 2004 12:44
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] some wrong with geometry_overright()!
> 
> 
> 
> 
> 
> PG_FUNCTION_INFO_V1(geometry_overright);
> Datum geometry_overright(PG_FUNCTION_ARGS)
> {
>  GEOMETRY     *geom1 = (GEOMETRY *)  
> PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
>  GEOMETRY     *geom2 = (GEOMETRY *)  
> PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
>  
>  bool result;
> //printf("in geometry_overright\n");
>  
>  if (geom1->SRID != geom2->SRID)
>  {
>   elog(ERROR,"Operation on two GEOMETRIES with different SRIDs\n");
>   PG_RETURN_NULL();
>  }
>  
>   /*
>    *I think there is some wrong with the following
>    *It should be:
>    *result = FPge(geom1->bvol.LLB.x, geom2->bvol.URT.x);
>    */
>  result = FPge(geom1->bvol.LLB.x, geom2->bvol.LLB.x);
> 
> 
>  PG_RETURN_BOOL(result);
> }


Hi David,

The test in the code looks fine since it is checking to see whether the
geom1 overlaps or lies to the right of geom2. This is the test used for
the &> operator. It looks as if you need to check whether geom1 lies to
the right of geom2 which is the test used by the >> operator. Please
look at the >> operator and the geometry_right() function which should
have the behaviour you require.


Cheers,

Mark.

---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.





More information about the postgis-users mailing list