如何在c#中将复杂的geo-json转换为wkt?

前端之家收集整理的这篇文章主要介绍了如何在c#中将复杂的geo-json转换为wkt?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
geo-json格式有复杂的GeometryCollection.它包含点和多边形.是否有任何众所周知的.net库可以帮助将其转换为Wkt格式?

{ “几何结构”:[{ “坐标”:[ – 76.92864,38.84465],“类型”: “点”},{ “坐标”:[ – 76.93066,38.84352],{”坐标 “:[ – 76.93685,38.85339],” 类型 “:” 点 “},{” 坐标 “:[ – 76.93865,38.8546],{” 坐标“:[ – 76.94017,38.85542 ],{ “坐标”:[ – 77.0517,38.85779],{ “坐标”:[ – 77.05555,38.87055],“类型”:“点“},{” 坐标 “:[ – 77.05556,38.87064],{” 坐标 “:[ – 77.05558,38.8705],{” 坐标“: [-77.05558,{ “坐标”:[ – 77.05559,{ “坐标”:[[[ – 77.06071,38.89092],[ – 77.06408,38.8897]]],“类型”: “多边形”},{ “坐标”:[[[ – 77.06658,38.89959],[ – 77.05996,38.89806],[ – 77.06162,38.89953],[ – 77.06242,38.89955],[ – 77.063,38.89994],[ – 77.06486,38.89961],[ – 77.06583,38.89991],[ – 77.06658,38.89959]]],{ “坐标”:[ – 77.08622,38.9858],{ “坐标”:[ – 77.11485,38.84505],{ “坐标”:[[[ – 77.1194,38.9349 1],[ – 77.11622,38.93155],[ – 77.11581,38.92891],[ – 77.11411,38.92713],[ – 77.11308,38.9266],[ – 77.11259,38.94019],[ – 77.11673,38.93688],[ – 77.1194,38.93491 ]]],{ “坐标”:[ – 77.13694,39.02613],{ “坐标”:[ – 77.23124,38.87993],{ “坐标”:[[[ – 77.46487,38.91975],[ – 77.42261,38.96258],[ – 77.42482,38.96293],[ – 77.42615,38.96359],[ – 77.42764,38.96264],[ – 77.42788,38.96403],[ – 77.43069,38.96369],[ – 77.43093,38.96106],[ – 77.43192,38.96],[ – 77.432,38.95341],[ – 77.46487,38.91975]]],“类型”: “多边形”}],“类型”: “GeometryCollection的”}

谢谢

解决方法

根据您正在使用的上下文,您可以将这些 JSON对象转换为C#对象,可以是自定义的,也可以是描述为 here的对象.框架(.NET)具有来自JSON的内置序列化程序(在MVC中),或者您可以使用 third party libraries.
原文链接:https://www.f2er.com/csharp/98767.html

猜你在找的C#相关文章