【发布时间】:2014-04-14 14:58:41
【问题描述】:
我有一个包含地理空间数据的 sql server 表。行的一个例子是(带有列名):
type: streetline
code: 231001
geog: 0xE6100000011 ........
Centroid 0xE61000000C.......
geom: 0xE6100000011 ........
我正在使用 C# 和 MVC3 在传单地图上绘制上述形状。我正在将上述 sql 数据提取到数据表中。在“geom”列上使用 sql 函数“ToString()”,我得到以下信息:
"LINESTRING (-1.131510412 52.65531, -1.13286 52.65559)",
"POLYGON ((-1.1116360 52.6409953, -1.1116683 52.6413, -1.11146723 52.641317, -1.11133263 52.6413572, -1.1113059))",
问题是如何将上述内容转换为 GeoJSON 以便能够在传单地图上进行绘图。这是我想要的预期输出(GeoJSON)的示例:
var geojsonFeature = {
"type": "Feature",
"properties": {
"name": "Coors Field",
"amenity": "Baseball Stadium",
"popupContent": "This is where the Rockies play!"
},
"geometry": {
"type": "Point",
"coordinates": [-104.99404, 39.75621]
}
};
【问题讨论】:
标签: c# jquery sql asp.net-mvc-3 geojson