I'm creating a web service that will be passed a list of objects that include the Lat/Long coordinates and some other data such as Speed. When I use the ArcGISRuntime library to add the features to my map service that is running, the Geometry will appear but none of the attributes ever will. Here is my code:
foreach (GPSLocation loc in aLocationsToStore)
{
var theLatLongPoint = new MapPoint(loc.Longitude, loc.Latitude, SpatialReferences.Wgs84);
var theProjectedPoint = GeometryEngine.Project(theLatLongPoint, theSpatialReference);
var theDateTime = Convert.ToDateTime(loc.DateTime);
//Feature gpsFeature = new GeodatabaseFeature(gpsLocFeatureTable.Schema);
var gpsFeature = gpsLocFeatureTable.CreateNew();
gpsFeature.Geometry = theProjectedPoint;
var attributes = gpsFeature.Attributes;
attributes["SPEED"] = loc.Speed;
await gpsLocFeatureTable.AddAsync(gpsFeature);
}
var result = await gpsLocFeatureTable.ApplyEditsAsync(true);
After running this, in the map service I can see the MapPoints in the feature layer, but all of the attribute values of the point are 'null' Any idea what I'm doing wrong or how I can get the attributes to sync?
EDIT:
I tried sniffing the network data using WireShark and this is what I get for the adds value:
"x":883822.86125507951,
"y":491566.5768424049,
"wkid":102649
}
},
"OBJECTID":-10
}
}
]
It seems as though it is overriding all of the attributes that I explicitly define when I call AddAsync. Any ideas on how to get attributes in the attributes object?
Solved! Go to Solution.
Answer can be found here:
c# - ArcGIS AddAsync .NET API Not working - Geographic Information Systems Stack Exchange