I can add a feature to my ServiceFeatureTable and I can see on ArcGisOnline the new feature is there. But I cant see it on the map. Is the point invisible? Do I need to add some style? Or isn't the feature georeferenced yet?
ServiceFeatureTable tblWorkers = new ServiceFeatureTable(featureTableUri);
// load the feature table
await tblWorkers.LoadAsync();var attributes = new Dictionary<string, object>
{
{ "worker_id", 3 },
{ "x_lat", -66.88 },
{ "y_long", 10.55 },
{ "time", "2017-12-24 18:00:00" }
};MapPoint structureLocation = new MapPoint(-66.88, 10.55);
// create a new feature in the damage table, pass in the attributes and geometry
Feature newFeature = tblWorkers.CreateFeature(attributes, structureLocation);// add the new feature (this updates the local copy of the table)
await tblWorkers.AddFeatureAsync(newFeature);// push this update (apply edits) to the feature service
IReadOnlyList<EditResult> editResults = await tblWorkers.ApplyEditsAsync();
At first I load my layer from a shape and I can select the red point and see it selected on the map. The green one I add it from .net but doesn't show in the map.
Solved! Go to Solution.
Maybe an issue with the SpatialReference? Your coordinates looks like WGS84, but WebMaps usally use WebMercator.
Have you tried to add the coordinate with an explicit SpatialReference?
new MapPoint(x, y, SpatialReferences.Wgs84)
Looks like you're missing the call to table.AddFeature(newFeature); This should make it show locally. All pending edits can then be pushed back up to the server for others to see by calling ApplyEditsAsync.
Sorry I forgot add the that line, I already add the feature as you can see on the last picture the new feature is there in the online layer (the green one) but doesn't show on the map.
Btw, shouldnt be a direct way so I link my database to my FeatureLayer so this process be automatic?
Can you share a sample that reproduces the issue. It's hard to guess where things are going wrong.
Maybe an issue with the SpatialReference? Your coordinates looks like WGS84, but WebMaps usally use WebMercator.
Have you tried to add the coordinate with an explicit SpatialReference?
new MapPoint(x, y, SpatialReferences.Wgs84)