这个问题 我似乎问了大神好几遍了 我竟然还没记住 羞愧
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.aaa2 ???????????????????????????select new3 ???????????????????????????{4 ???????????????????????????????...5 ???????????????????????????????Geom = SqlSpatialFunctions.MakeValid(a.geom),6 ???????????????????????????????...7 ???????????????????????????};
这样就好了 我真的是服了自己了....
关于Geometry转GeoJson
原文地址:https://www.cnblogs.com/CoffeeEddy/p/9061728.html