这是我的实体:
public class TLandPoint
{
[Key]
public int gid { get; set; }
public Point geom { get; set; }
public long LandId { get; set; }
[MaxLength(150)]
public long SumSpace { get; set; }
public long CLevelId { get; set; }
}
我从数据库中选择数据:TLandPointDto 我班级中的同一实体
var TLandPt = DBcontext.TLandPointSelect(p => new TLandPointDto
{
gid = p.gid,
CLevelId = p.CLevelId,
geom = (p.geom),
LandId = p.LandId,
SumSpace = p.SumSpace,
}).ToList();
这行显示 数据列表
现在
我想从 linq 的结果中创建 geojson 与此列表相同
{
"type": "FeatureCollection",
"features": [
{
"id": 6,
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
5721495.610660064,
4222076.000807296
]
},
"properties": {
"LandId": 5698,
"SumSpace": 17335,
"CLevelId": 12303020001
}
}
]
}
如何在 c# .net core 5 中将 Linq 结果转换为 geojson