[postgis-users] Looking why st_within not working between point3d with box3d
Bruno Friedmann
bruno at ioda-net.ch
Sun Sep 13 00:05:04 PDT 2009
Thank you Paul for the precision.
Did you think I can find a way (finding the nearest neighboor in 3d) with some of the st_ function ?
Or should I wait as you talk about in
http://www.mail-archive.com/postgis-users@postgis.refractions.net/msg08026.html
Or should I go and use other tools like grass/R ?
Thanks.
Paul Ramsey wrote:
> PostGIS is "2.5D", not 3D, which means that, while Z and M coordinates
> are available to store data, they are not used in calculations (with a
> few exceptions, for things like linear referencing), they are just
> carried along for the ride. Hence what you are observing.
>
> The "box3d" name is confusing and dates back to the 0.X series of
> PostGIS, which stored 3 dimensions at all times, even when only two
> dimensions existed in the data (in which case the 3rd dimension was
> zeroed and hidden in output). The bounding box for such a 3-d
> structure would naturally be named, "box3d". But it was never used for
> 3d calculation, despite the name.
>
> P.
>
> On Sat, Sep 12, 2009 at 9:39 AM, Bruno Friedmann <bruno at ioda-net.ch> wrote:
>> Hi All
>>
>> I'm facing strange results which I can't explain.
>> So any help or idea are welcome.
>>
>> Here the context
>> Table of point in 3d have been setup.
>>
>>
>> SELECT
>> st_asewkt(the_geom),
>> GeometryType(the_geom),
>> NDims(the_geom),
>> ZMFlag(the_geom)
>> from dom limit 2;
>>
>> which seems to return correct 3d point
>>
>> "SRID=21781;POINT(602499.98 233307.35 1026.73)";"POINT";3;2
>> "SRID=21781;POINT(602499.98 233326.89 1046.81)";"POINT";3;2
>>
>>
>> The full extend of data is
>> "BOX3D(598125 233000 631.03,602499.98 235999.98 1316.91)"
>>
>> Now I try to select rows inside a predefined box
>>
>> select id,est,nord,alti_u from dom_1106_42_03
>> WHERE st_within(
>> the_geom,
>> st_setsrid(
>> st_makebox3d (
>> GeomFromEWKT('SRID=21781;POINT( 598995 233995 500)'),
>> GeomFromEWKT('SRID=21781;POINT( 599005 234005 1000)')
>> )
>> ,21781)
>> )
>>
>> In this part alti Z is not above 1200 meters so I should not find anything
>> but I've got results like this :
>>
>> id est nord alti
>> 2774523;598995.1600;234002.1500;1209.8700
>> 2775215;598995.3800;234001.0900;1210.2600
>> 2775297;598995.4000;233999.6300;1207.7600
>>
>> It's ok for x,y but not Z
>> I don't understand where my problem reside.
>>
>> Thanks a lot in advance.
>>
>>
More information about the postgis-users
mailing list