I'm attempting to create a FeatureLayer, but I am getting a number of errors, along the lines of:
Accessor#set Invalid property value, value needs to be one of 'esri.geometry.Extent', 'esri.geometry.Multipoint', 'esri.geometry.Point', 'esri.geometry.Polyline', 'esri.geometry.Polygon', or a plain object that can autocast (having .type = 'extent', 'multipoint', 'point', 'polyline', 'polygon')
The FeatureLayer is defined as such:
const template = {
title: "Predicted Wind Bands",
content: "Historical wind band for " + featureSet.features[0].attributes.EVENT
};
let layer = new FeatureLayer({
source: featureSet.features,
objectIdField: "OBJECTID",
geometryType: "polygon",
popupTemplate: template,
fields: featureSet.fields,
title: 'Predicted Wind Bands',
opacity: 0.8,
layerId: 0,
})
where the response object is:
{
"displayFieldName": "STORMID",
"fieldAliases": {
"RADII_MPH": "RADII_MPH",
"OBJECTID": "FID",
"EVENT": "EVENT"
},
"geometryType": "esriGeometryPolygon",
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
},
"fields": [
{
"name": "RADII_MPH",
"type": "esriFieldTypeSmallInteger",
"alias": "RADII_MPH"
},
{
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "FID"
},
{
"name": "EVENT",
"type": "esriFieldTypeString",
"alias": "EVENT",
"length": 50
}
],
"features": [
{
"attributes": {
"RADII_MPH": 74,
"OBJECTID": 1025,
"EVENT": "DELTA"
},
"geometry": {
"rings": [
[
[
-79.798922025999957,
16.61326374500004
],
...
called as:
function getTrack(id) {
esriRequest(
url,
{
query: {
f: "json",
where: "STORMID='" + id + "'",
outFields: "RADII_MPH,OBJECTID,EVENT",
returnGeometry: "true",
returnDistinctValues: "false",
outSR: 4326,
}
}
).then((response) => {
renderBuffers(response.data)
}
It is a syntax that I have used before and is very similar to response objects that have successfully created FeatureLayers before. I am quite unsure what is going wrong. Any help would be much appreciated!