documentation for ST_GeomFromGML機能は、「SQL/MM曲線ジオメトリをサポートしない」と言います。 GMLは現代的なソフトウェアに有効な表現を持っているので、エラーメッセージがこの欠点を明確にしていないことは残念です。そこにはis an enhancement ticket to enable this supportがありますが、数年後にこれに何の動きもありませんでした。回避策として
、あなたはGMLを読み、PostGISのにWKBをエクスポートするPythonの(例えば)からGDAL/OGRを使用することができます(別の方法を使用して)
from osgeo import ogr
with open('geometry.xml', 'r') as fp:
g = ogr.CreateGeometryFromGML(fp.read())
g.GetArea() # 4519550457.106098
# There is more than one way to insert this to PostGIS, here is one way
import psycopg2
conn = psycopg2.connect('dbname=postgis host=localhost user=postgres port=5432')
curs = conn.cursor()
curs.execute('CREATE TABLE surf(geom geometry);')
curs.execute('INSERT INTO surf(geom) VALUES (%s)', (g.ExportToWkb().encode('hex'),))
conn.commit()
curs.execute('SELECT ST_Area(geom) FROM surf')
curs.fetchone()[0] # 4519550457.07643
2つの面積計算は、基本的に同じです安心しています。