2014-04-14 23 views
3

我有PostgreSQL 9.2.4。下面是我使用找出一些幾何交集結果表:錯誤:GEOSIntersects:TopologyException:端位置衝突

   Column    |   Type   | Modifiers 
---------------------------------+--------------------------+----------- 
id        | integer     | 
full_resolution     | character varying(2000) | 
full_resolution_path   | character varying(256) | 
feature_id      | text      | 
full_resolution_initiated_order | character varying(64) | 
true_image_feature_footprint_id | integer     | 
true_image_tile_footprint_id | integer     | 
full_resolution_time_created | timestamp with time zone | 
feature_geom     | geometry     | 
tile_geom      | geometry     | 

現在查詢:

create Temp table temp4_test as 
select id, ST_Intersects(feature_geom,tile_geom),full_resolution 
    , full_resolution_path, feature_id, full_resolution_initiated_order 
    , true_image_feature_footprint_id, true_image_tile_footprint_id 
    , full_resolution_time_created 
from temp3_test; 

是給我這個錯誤:

ERROR: GEOSIntersects: TopologyException: side location conflict at -122.42466 47.085999999999999

任何人都可以點我我在這裏做錯了什麼?

回答

5

我發現「馬丁·戴維斯」 in this thread答案:

This occurs because the geometries are invalid, and the current intersects algorithm used in JTS/GEOS has kittens when invalid geometries are used as input. The core dump thing is unfortunate (and obviously got fixed in later versions).

顯然,同樣的無效數據引起PostGIS的V1.5核心轉儲,但提出了在V2.0異常

+2

使用條件「where st_isvalid(feature_geom)='f'或st_isvalid(tile_geom)='f'」檢查無效幾何 – Patty

4

這也可以嘗試運行

SELECT ST_Intersection(a.geom, b.geom)  
FROM table a, table b 
WHERE ST_Intersects(a.geom, b.geom) ; 

如果有各種幾何類型,尤其是點和線串的組合的結果。通過在所有幾何上運行ST_MakeValid(geom),然後從查詢中排除MultiPolygons和Polygons以外的所有元素,問題就消失了。換句話說,ST_Isvalid(geom)='t'不一定是避免此錯誤的充分條件。