Ich versuche, ein GeoJson FeatureCollection-Objekt zu erstellen, indem NUR lat und long an eine Funktion übergeben wird, in der es Unten PoCo instanziiert.Erstellen eines geoJson-Objekts in C#
namespace PoCo
{
public class LocalGeometry
{
public string type { get; set; }
public List<double> coordinates { get; set; }
}
public class Properties
{
public string name { get; set; }
public string address { get; set; }
public string id { get; set; }
}
public class LocalFeature
{
public string type { get; set; }
public LocalGeometry geometry { get; set; }
public Properties properties { get; set; }
}
public class geoJson
{
public string type { get; set; }
public List<LocalFeature> features { get; set; }
}
}
Dies ist, wie Objekt
var CorOrd = new LocalGeometry();
CorOrd.coordinates.Add(Lat);
CorOrd.coordinates.Add(Lang);
CorOrd.type = "Point";
var geoJson = new geoJson
{
type = "FeatureCollection",
features = new LocalFeature
{
type = "Feature",
geometry = CorOrd
}
};
Schaffung ist aber sind immer Fehler
CS0029 Cannot implicitly convert type 'PoCo' to 'System.Collections.Generic.List<PoCo.Local>'.
Irgendwelche Vorschläge, wie ich ein GeoJSON Objekt hier schaffen kann.
@Win Vielen Dank, es ist ein großer Gewinn! –