1
我使用PostGIS地理定義了以下表格。在PostGIS中投射地理類型
CREATE TABLE test_geog (
id SERIAL PRIMARY KEY,
boundary GEOGRAPHY(Polygon)
);
我增加了以下測試多邊形表:
INSERT INTO test_geog VALUES (ST_GeographyFromText('SRID=4326;POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'));
我試圖確定一個點是否位於內的任何此表中的多邊形。我有這個疑問:
SELECT ST_ContainsProperly(ST_GeographyFromText('Point(2 2)'), area)
FROM (SELECT boundary FROM test_geog) AS area;
我們得到以下錯誤:
ERROR: function st_containsproperly(geography, record) does not exist
LINE 1: SELECT ST_ContainsProperly(ST_GeographyFromText('Point(2 2)'...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
如何轉換這個 「紀錄」 爲POLYGON
?我很困惑,因爲它似乎已經聲明只有POLYGON
類型的列,但出於某種原因,我不是從數據庫中提取的。
我試圖記錄轉換爲POLYGON
這樣的:
SELECT ST_ContainsProperly(ST_GeographyFromText('Point(2 2)'), CAST (boundary AS POLYGON))
FROM (SELECT boundary FROM source_imagery) AS nitf_area;
但是,這給了我這個錯誤:
ERROR: cannot cast type record to polygon
LINE 1: ...tainsProperly(ST_GeographyFromText('Point(2 2)'), CAST (boun...
什麼我不理解嗎?