Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何定义';地理';使用Npgsql和OrmLite(使用postgresql、postgis、c#)键入_Orm_Postgis_Npgsql_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">ormlite Servicestack_Geography - Fatal编程技术网 ormlite-servicestack,geography,Orm,Postgis,Npgsql,ormlite Servicestack,Geography" /> ormlite-servicestack,geography,Orm,Postgis,Npgsql,ormlite Servicestack,Geography" />

如何定义';地理';使用Npgsql和OrmLite(使用postgresql、postgis、c#)键入

如何定义';地理';使用Npgsql和OrmLite(使用postgresql、postgis、c#)键入,orm,postgis,npgsql,ormlite-servicestack,geography,Orm,Postgis,Npgsql,ormlite Servicestack,Geography,如何在我的C#类模型中定义postgis“geography”类型,以便OrmLite可以轻松地将其传递给Postgresql,这样除了将空间数据保存到“geography”列之外,我还可以运行空间查询?最好的库适用于这种情况 你可以这样使用 protected GisSharpBlog.NetTopologySuite.Geometries.Geometry _geom; public GisSharpBlog.NetTopologySuite.Geometries.Geometry Geom

如何在我的C#类模型中定义postgis“geography”类型,以便OrmLite可以轻松地将其传递给Postgresql,这样除了将空间数据保存到“geography”列之外,我还可以运行空间查询?

最好的库适用于这种情况

你可以这样使用

protected GisSharpBlog.NetTopologySuite.Geometries.Geometry _geom;
public GisSharpBlog.NetTopologySuite.Geometries.Geometry Geom
   {
      get { return _geom; }
      set { _geom = value; }
   }

protected string _geomwkt;
public virtual string GeomWKT
   {
     get
       {
         if (this.Geom != null)
             return this.Geom.ToText();
         else
             return "";
       }
     set
       {
         string wktString = value;
         if (string.IsNullOrEmpty(wktString))
             _geom = null;
         else
           {
             var fact = new GeometryFactory();
              var wktreader = new WKTReader(fact);
              _geom = (Geometry)wktreader.Read(wktString);
           }
        }
   }