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

时间:2012-12-08 03:28:24

标签: c# json gis wkt

geo-json格式中存在复杂的GeometryCollection。它包含点和多边形。是否有任何众所周知的.net库可以帮助将其转换为Wkt格式?

{"geometries":[{"coordinates":[-76.92864,38.84465],"type":"Point"},{"coordinates":[-76.93066,38.84352],"type":"Point"},{"coordinates":[-76.93685,38.85339],"type":"Point"},{"coordinates":[-76.93865,38.8546],"type":"Point"},{"coordinates":[-76.94017,38.85542],"type":"Point"},{"coordinates":[-77.0517,38.85779],"type":"Point"},{"coordinates":[-77.05555,38.87055],"type":"Point"},{"coordinates":[-77.05556,38.87064],"type":"Point"},{"coordinates":[-77.05558,38.8705],"type":"Point"},{"coordinates":[-77.05558,38.8705],"type":"Point"},{"coordinates":[-77.05559,38.8705],"type":"Point"},{"coordinates":[[[-77.06071,38.89092],[-77.06408,38.8897]]],"type":"Polygon"},{"coordinates":[[[-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]]],"type":"Polygon"},{"coordinates":[-77.08622,38.9858],"type":"Point"},{"coordinates":[-77.11485,38.84505],"type":"Point"},{"coordinates":[[[-77.1194,38.93491],[-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]]],"type":"Polygon"},{"coordinates":[-77.13694,39.02613],"type":"Point"},{"coordinates":[-77.23124,38.87993],"type":"Point"},{"coordinates":[[[-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]]],"type":"Polygon"}],"type":"GeometryCollection"}

由于

1 个答案:

答案 0 :(得分:-2)

根据您使用的上下文,您可以将这些JSON对象转换为C#对象,可以是自定义的,也可以是描述为here的对象。框架(.NET)具有来自JSON(在MVC中)的内置序列化程序,或者您可以使用third party libraries