0

我想指定一个框(即 2 个点)并选择在框内或与框相交的所有线串。

SELECT * FROM pub_trail_segment WHERE st_force_2d(pub_trail_segment.geometry) && ST_SetSRID(ST_MakeBox2D(ST_GeomFromEWKT('SRID=4326;POINT(48.25077560316286 -124.46710205078124)'), ST_GeomFromEWKT('SRID=4326;POINT(50.4743709029765 -120.73239135742186)')), 4326);

但是它返回 0 行。我尝试扩大盒子的大小并将几何列强制为 2D,但我看不到我缺少什么。

测试数据如下 - (DBTestCase 格式,但你明白了):

<pub_trail_segment id="1" pub_trail_id="1" geometry="SRID=4326;LINESTRING(-123.258275 7 49.3607281 123.666748, -123.2583172 49.3607195 120.302124)"/>   
<pub_trail_segment id="2" pub_trail_id="3" geometry="SRID=4326;LINESTRING(-123.2582757 49.3607281 123.666748, -123.2583172 49.3607195 120.302124, -123.3583172 49.3607195 120.402124)"/>
<pub_trail_segment id="3" pub_trail_id="1" geometry="SRID=4326;LINESTRING(-123.3582757 49.4607281 123.666748, -123.3583172 49.4607195 120.302124)"/>
<pub_trail_segment id="4" pub_trail_id="4" geometry="SRID=4326;LINESTRING(-123.3582757 50.4607281 123.666748, -123.3583172 50.4607195 120.302124)"/>

谢谢你的帮助!

4

1 回答 1

0

我解决了。我把纬度和经度弄错了。

于 2010-08-03T03:10:23.337 回答