如何使用调用 db 扩展函数的自定义字段类型?在这种情况下PostGIS。
从 PostGIS 安装页面略有改变:
CREATE TABLE
mytable (
id SERIAL PRIMARY KEY,
geom GEOMETRY(POINT, 26910)
)
;
INSERT INTO
mytable (geom)
VALUES
(ST_GeomFromText('POINT(0 0)', 26910))
;
SELECT
id
FROM
mytable
WHERE
ST_DWithin(geom, ST_GeomFromText('POINT(0 0)', 26910), 1000)
;
这个表是如何在代码中生成的?以及如何查询?
class mytable
{
[AutoIncrement]
[PrimaryKey]
public int id;
[???]
public ??? geom;
}
相关的 SO 问题:How to define 'geography' type using Npgsql and OrmLite (using postgresql, postgis, c#)