I am trying to create a FeatureLayer from a JSON object that will be fetched from another service. I am not looking for something complicated, just something that works.
var layer = new FeatureLayer({
fields: [{
name: "ObjectID",
alias: "ObjectID",
type: "oid"
}, {
name: "fltid",
alias: "FltId",
type: "string"
}, {
name: "name",
alias: "Name",
type: "string"
}],
objectIdField: "ObjectID",
geometryType: "polyline",
spatialReference: { wkid: 4326 },
source: [{
geometry: new Polyline({
paths: [
[-100, 38],
[-77, 35]
]
}),
attributes: {
ObjectID: 1,
name: "KATL",
fltid: "UAL1"
}
},
{
geometry: new Polyline({
paths: [
[-77, 35],
[-120, 40]
]
}),
attributes: {
ObjectID: 2,
name: "KZBW",
fltid: "SW999"
}
},
{
geometry: new Polyline({
paths: [
[-120, 40],
[-100, 38]
]
}),
attributes: {
ObjectID: 3,
name: "WKRP",
fltid: "Fever1"
}
}
],
});
I was expecting three lines to be drawn, but nothing is shown and the error console is empty.
I am using the version 4 API and there are very few examples and most of them broken.