this is my entity :
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; }
}
and i select data from database :
TLandPointDto same entity in my class
var TLandPt = DBcontext.TLandPointSelect(p => new TLandPointDto
{
gid = p.gid,
CLevelId = p.CLevelId,
geom = (p.geom),
LandId = p.LandId,
SumSpace = p.SumSpace,
}).ToList();
and this rows show
List of data
now
i want create geojson from result of linq same this list
{
"type": "FeatureCollection",
"features": [
{
"id": 6,
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
5721495.610660064,
4222076.000807296
]
},
"properties": {
"LandId": 5698,
"SumSpace": 17335,
"CLevelId": 12303020001
}
}
]
}
How to convert Linq result to geojson in c# .net core 5
question from:
https://stackoverflow.com/questions/65925607/convert-geodata-to-geojson-in-c-sharp-with-linq 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…