[postgis-users] st_buffer (radius_of_buffer)

ibrahim saricicek ibrahimsaricicek at gmail.com
Tue Jan 19 00:22:52 PST 2010


Hi,

Sorry for projection problem.

I mean;

select
st_intersects(st_buffer(route.the_geom,0.0),
st_transform(st_geomFromText('POINT(30 20)',4326),900913))
as result
from route

Now there shouldn't be *SRID problem*.. But still the result is *FALSE*. But
when i don't use buffer;

select
st_intersects((route.the_geom), st_transform(st_geomFromText('POINT(30
20)',4326),900913))
as result
from route

The result is *TRUE* !!!

So the problem is not a rounding error. If so, second query result would be
FALSE.
I think the result of these two queries should be the same (if
transformation rounding errors r concerned). Am i wrong ???

Thanks, all...

On Mon, Jan 18, 2010 at 10:56 PM, Kevin Neufeld <kneufeld at refractions.net>wrote:

> ? Sorry, I'm confused.  I would think you would get a ERROR:  Operation on
> two geometries with different SRIDs when running your query.
>
> You are taking a lat/long coordinate, transforming it to a [deprecated]
> mercator projection and storing the results in a table called route.
>
> Then you are asking if the mercator point, when buffered by 0, intersects a
> point in lat/long.
>
> If you meant to include a transform back to 4326 in the intersect query
> (ie. st_intersects(st_buffer(st_transform(route.the_geom,4326),0.0), ... ),
> you should be aware that transforming a geometry back and forth between
> projections will likely lead to rounding errors.
>
> ie.
> SELECT
>  astext(g1) g1,
>  astext(g2) g2,
>  g1,
>  g2,
>  g1 ~= g2,
>  st_intersects(g1, 'SRID=4326;POINT(30 20)'),
>  st_intersects(g2, 'SRID=4326;POINT(30 20)')
> FROM (
>  SELECT geom g1, st_transform(st_transform(geom,900913),4326) g2
>  FROM (
>    SELECT 'SRID=4326;multilinestring((30 20,31 21,32 22))'::geometry AS
> geom
>  ) a
> ) b;
> -[ RECORD 1
> ]-+---------------------------------------------------------------------------------------------------------------------------------------------
> g1            | MULTILINESTRING((30 20,31 21,32 22))
> g2            | MULTILINESTRING((30 20,31 21,32 22))
> g1            |
> 0105000020E6100000010000000102000000030000000000000000003E4000000000000034400000000000003F40000000000000354000000000000040400000000000003640
> g2            |
> 0105000020E610000001000000010200000003000000FEFFFFFFFFFF3D40FDFFFFFFFFFF33400200000000003F400100000000003540FEFFFFFFFFFF3F40FEFFFFFFFFFF3540
> equals        | f
> st_intersects | t
> st_intersects | f
>
>
> Notice how your geometry, when transform to 900913 and back to 4326 looks
> the same in text, but are in fact different in binary?  The transformed
> geometry, does not intersect (30,20).  It might if you buffer it by 0.1.
>
> Cheers,
> Kevin
>
> ibrahim saricicek wrote:
>
>> hi all;
>>
>> I think 0.0 of radius means the object itself? Am i wrong?
>>
>> I'm inserting a row to my route table
>>
>> insert into route (the_geom) select
>> st_transform(ST_GeomFromText('SRID=4326;multilinestring((30 20,31 21,32
>> 22))'),900913)
>>
>> why the result of this is false? that is a point on my route. what is
>> defined with '0.0 of radius'?
>> the result is true for 0.1 to 0.000000001? Why for 0.0000000001 radius,
>> result is false?
>>
>> select
>> st_intersects(st_buffer(route.the_geom,0.0), st_geomFromText('POINT(30
>> 20)',4326)) as result
>> from route
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> 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/20100119/38c4a728/attachment.html>


More information about the postgis-users mailing list