Select to view content in your preferred language

How to add a point to feature layer that is published as a feature service?

609
1
10-05-2010 06:51 AM
SelcanGuner
Emerging Contributor
I have published a feature service,(SDE database.featuredataset.featureclass) .

I am using this layer in a silverlight project with arcgis api for Silverlight and want to add a point to featureclass in sde with c# code (in silverlightapplication.xaml.cs file. )

How can I add a point to feature class interactively?
0 Kudos
1 Reply
AliMirzabeigi
Emerging Contributor
Selcan,

One approach would be using editing tools such as TemplatePicker and EditorWidget controls. Please see the following URLs:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitTemplatePicker
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitEditorWidget

Another approach would be adding points in your map MouseLeftButtonUp event handler. You can do so by getting the MapPoint where the mouse was clicked:
MapPoint mapPoint = MapView.ScreenToMap(e.GetPosition(yourMapView));
Then creating a Graphic to be added to your FeatureLayer:
Graphic graphic = new Graphic() { Geometry = mapPoint, Symbol = yourFeatureLayer.FeatureSymbol };
Please note that if your FeatureLayer doesn't have a default symbol then you need to define your own marker symbol.
You would also need to add attributes to your Graphic. You can do so by looping through your FeatureLayer's "LayerInfo.Fields" to get all fields and set their values in your Graphic's attribute collection.

Hope this helps.
0 Kudos