关于Geometry转GeoJson
时间:2018-05-19 21:48:13
收藏:0
阅读:1255
这个问题 我似乎问了大神好几遍了 我竟然还没记住 羞愧
NuGet添加GeoJSON4EntityFramework,引用using alatas.GeoJSON4EntityFramework;
FeatureCollection features = new FeatureCollection(item.Geom); string Geo = Regex.Replace(features.Serialize(prettyPrint: true), @"\s", "");
当然我是在EF中调取的,有些Geometry可能会不正确,需要进行修正
1 var list = from a in context.aaa 2 select new 3 { 4 ... 5 Geom = SqlSpatialFunctions.MakeValid(a.geom), 6 ... 7 };
这样就好了 我真的是服了自己了....
原文:https://www.cnblogs.com/CoffeeEddy/p/9061728.html
评论(0)