- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个多边形作为 Sys.Geography 类型保存在 SQL Server 2012 数据库上。如何获得多边形的所有点?
我正在考虑使用 AsText() 方法并解析字符串,但也许有更好的选择?
最佳答案
找到了一个方法,这里是一个扩展方法:
public static IEnumerable<MyEntityWithLatAndLng> GetPointsFromPolygon(this System.Data.Entity.Spatial.DbGeography geo)
{
for (int i = 1; i < geo.PointCount; i++)
{
var p = geo.PointAt(i);
yield return new MyEntityWithLatAndLng(){ Latitude = p.Latitude.Value, Longitude = p.Longitude.Value };
}
}
关于entity-framework - DbGeography 多边形获得点数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25374130/
谁能告诉我如何从“POINT”类型的 DbGeography 对象集合中创建“Polygon”类型的 DbGeography 对象 到目前为止,我已经有了创建多边形的这个,但我错过了初始步骤。 1.
我像这样创建一个 DbGeography 点: String selectedLocation = String.Format("POINT ({0} {1})", lon, lat).Replace
我有两点描述一个矩形: 东北纬度/经度和西南纬度/经度。 生成可存储在 DbGeography 字段中的简单矩形实体的正确有效方法是什么? 请注意,稍后我想使用该字段来确定点是否在该矩形内。 我意识到
System.Data.Spatial.DbGeography.Intersects 方法对我来说似乎总是返回 true。我不确定为什么会这样。我在下面创建了一个简单的命令行片段,它产生了下面的控制台
我有一个多边形作为 Sys.Geography 类型保存在 SQL Server 2012 数据库上。如何获得多边形的所有点? 我正在考虑使用 AsText() 方法并解析字符串,但也许有更好的选择?
当我使用 Distance 方法时,它要求 2 个位置,并返回一个 double 值。 一个 double 值,指定 geographyValue 和 otherGeography (MSDN) 中最
我需要使用 Bing Map 服务、EF 5 和 SQL Server 2008 对大量地址进行地理编码。我在 SQL 中使用 geography 数据类型,它由 EF 转换为 DbGeography
我正在使用空间数据开始我的第一个项目。我正在使用 VS 2012 和 SQL 2012 我已经引用了 System.Data.Entity 并且可以在我的代码中使用 DbGeography 但是当我尝
我正在寻找组合多个多边形以减少点数的方法。这是前进的方向吗: var pol1 = DbGeography.PolygonFromText("POLYGON ((-2.91790532309701 5
我在 SQL 中有一个地理字段,我将其标记为空。 然后在我的 EF 实体上添加了一个可为 null 的 DbGeography? 属性,但我收到一条消息说这是不允许的。 那么,如何在数据库中插入一个未
我有一个代表起点的 DbGeography,我知道行进的距离和方向。鉴于这些信息,有没有办法使用 SqlSpatial 库获得代表新位置的新 DbGeography?即无需自己进行大圆计算或使用第 3
我将 DbGeography 多边形存储在数据库中。我的 Controller 从数据库中获取多边形,我需要将它们转换为 JSON。 var polygons = db.Areas .
长期听众,第一次来电(终于在这里注册了一个帐户!)... 我将 Visual Studio 2013 与 .NET 4.5.1 和 Entity Framework 6(最终版本,非 RC 或测试版)
我正在查询 SQL Server 中的表以在 Google map 上显示结果,并且我在服务器应用程序上使用 Entity Framework 和 DbGeography 数据类型。 简单地说,我从
如果我将 WKT 格式的多边形定义为这样(经度/纬度): string wkt = "POLYGON ((15.981800258159638 45.810693408924287, 15.98362
我正在尝试公开一个 API,允许用户发布多边形以保留在服务器上。我正在使用 ASP.NET MVC 5。如何正确格式化 AJAX 参数以发布对 DbGeography 的请求?这就是我正在尝试的: $
我已经从官方来源下载了一张带有瑞典地区的 map 作为 Shape 文件。然后我使用了 QGIS将数据转换为 geojson,然后将 geojson 转换为 DbGeography,如下所示: htt
我正在尝试从数据库中获取 Spartial 数据,然后将其序列化(效果很好)。当我尝试反序列化该数据时,会抛出 JsonSerializationException。 DbGeography geoP
我有两个 GPS 坐标,我想计算它们之间的距离,但 SQL 服务器上的结果与 c# 中的结果完全不同我用谷歌搜索发现这两种方法都以米为单位返回距离,但这种差异让我发疯。 SQL SERVER 查询 s
Google告诉我日本的经/纬度值为(36,138),但.NET抛出错误 24201: Latitude values must be between -90 and 90 degrees. 有什么想
我是一名优秀的程序员,十分优秀!