Empty feature template in Silverlight app

772
13
07-01-2010 01:16 PM
PaulHarbulak
New Contributor
I've developed a Silverlight web application for testing custom editing functionality and I am able to edit my feature service (which uses a feature class in PostgreSQL).  However, for the life of me I can't get the default feature template to work on the feature layer.  My feature layer is symbolized using a green outline symbol.  When I begin drawing a new polygon it appears as a black outline but when the new polygon is completed it disappears--it doesn't have any symbology and it doesn't take the symbology of the feature layer unless I completely refresh the web app.  Also, if I try adding a TemplatePicker control, the feature layer's template is blank.  Any ideas on what i could be doing wrong?  Thanks.
0 Kudos
13 Replies
dotMorten_esri
Esri Notable Contributor
What version are you using? What are you using to draw and edit the feature? Does your service have a renderer defined without a default symbol, and the graphic you are adding doesn't have an attribute that matches any of the symbols defined in the renderer?
What happens if you explicitly override the renderer with your own instead of using what is coming from the server?
0 Kudos
PaulHarbulak
New Contributor
Thanks for the response!  I'm using version 2.0 of the Silverlight API (with Silverlight 4).  I'm doing testing with both the out-of-the-box EditorWidget control as well as a custom set of buttons with binding to Editor commands (Add, Reshape, Cut, etc.).  My feature service just uses a single symbol (simple fill symbol with just an outline).  However, I define a simple fill symbol in my silverlight app that I use for the Feature Layer.  If I draw a new polygon it won't appear, regardless of whether or not I edit the attributes.  But the new feature is in fact added to the feature class and it appears if I restart the silverlight app.  I added a new template in the source feature class and just copied the default template, and it appears in an editor widget and template picker but it is also blank.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Could you share the layer metadata?
Ie. go to the rest endpoint for the layer, add ?f=pjson to the URL, and paste the response here. (or even better if the service is public, share the URL)
0 Kudos
PaulHarbulak
New Contributor
The services aren't public yet, but here is the json output I got:

{
  "serviceDescription" : null,
  "layers" : [
    {
      "id" : 0,
      "name" : "Fields"
    }
  ],
  "tables" : [
  ]
}
0 Kudos
PaulHarbulak
New Contributor
Here is the metadata for the layer (which is probably what you're looking for...judging from how little info I gave you in the previous post...)

{
  "id" : 0,
  "name" : "Fields",
  "type" : "Feature Layer",
  "displayField" : "id",
  "description" : "",
  "copyrightText" : "",
  "relationships" : [
  ],
  "geometryType" : "esriGeometryPolygon",
  "minScale" : 0,
  "maxScale" : 0,
  "extent" : {
    "xmin" : -10449839.8159,
    "ymin" : 5111035.6446,
    "xmax" : -10437153.7118,
    "ymax" : 5117429.5595,
    "spatialReference" : {
      "wkid" : 3857
    }
  },
  "drawingInfo" : {"renderer" :
    {
      "type" : "simple",
      "symbol" :
      {
        "type" : "esriSFS",
        "style" : "esriSFSSolid",
       
        "color" : [
          209,
          255,
          115,
          255
        ],
        "outline" :
        {
          "type" : "esriSLS",
          "style" : "esriSLSSolid",
         
          "color" : [
            85,
            255,
            0,
            255
          ],
          "width" : 1.5
        }
      },
      "label" : "",
      "description" : ""
    },
    "transparency" : 0,
    "labelingInfo" : null},
  "hasAttachments" : false,
  "htmlPopupType" : "esriServerHTMLPopupTypeAsHTMLText",
  "objectIdField" : "objectid",
  "globalIdField" : "",
  "typeIdField" : "",
  "fields" : [
    {
      "name" : "objectid",
      "type" : "esriFieldTypeOID",
      "alias" : "OBJECTID",
      "editable" : false,
      "domain" : null
    },
    {
      "name" : "id",
      "type" : "esriFieldTypeInteger",
      "alias" : "ID",
      "editable" : true,
      "domain" : null
    },
    {
      "name" : "growerid",
      "type" : "esriFieldTypeInteger",
      "alias" : "GrowerID",
      "editable" : true,
      "domain" : null
    },
    {
      "name" : "farmid",
      "type" : "esriFieldTypeInteger",
      "alias" : "FarmID",
      "editable" : true,
      "domain" : null
    },
    {
      "name" : "legal_description",
      "type" : "esriFieldTypeString",
      "alias" : "legal_description",
      "editable" : true,
      "length" : 255,
      "domain" : null
    },
    {
      "name" : "own_lease",
      "type" : "esriFieldTypeSmallInteger",
      "alias" : "owned",
      "editable" : true,
      "domain" : null
    },
    {
      "name" : "legal_acres",
      "type" : "esriFieldTypeDouble",
      "alias" : "legal_acres",
      "editable" : true,
      "domain" : null
    },
    {
      "name" : "calculated_acres",
      "type" : "esriFieldTypeDouble",
      "alias" : "calc_acres",
      "editable" : true,
      "domain" : null
    },
    {
      "name" : "system_name",
      "type" : "esriFieldTypeString",
      "alias" : "system_name",
      "editable" : true,
      "length" : 10,
      "domain" : null
    },
    {
      "name" : "user_name",
      "type" : "esriFieldTypeString",
      "alias" : "user_name",
      "editable" : true,
      "length" : 20,
      "domain" : null
    }
  ],
  "types" : [
  ],
  "templates" : [
    {
      "name" : "Test",
      "description" : "Default field layer symbology",
      "drawingTool" : "esriFeatureEditToolPolygon",
      "prototype" : {
        "attributes" : {
          "user_name" : null,
          "id" : 0,
          "growerid" : 0,
          "farmid" : 1,
          "system_name" : null,
          "legal_description" : null,
          "own_lease" : 0,
          "legal_acres" : null,
          "calculated_acres" : null
        }
      }
    },
    {
      "name" : "Fields",
      "description" : "",
      "drawingTool" : "esriFeatureEditToolPolygon",
      "prototype" : {
        "attributes" : {
          "user_name" : null,
          "id" : 0,
          "growerid" : 0,
          "farmid" : 0,
          "system_name" : null,
          "legal_description" : null,
          "own_lease" : 0,
          "legal_acres" : null,
          "calculated_acres" : null
        }
      }
    }
  ],
  "capabilities" : "Query,Editing"
}
0 Kudos
dotMorten_esri
Esri Notable Contributor
Hmm looks fine to me. What does your layer xaml look like?
0 Kudos
PaulHarbulak
New Contributor
Morten, this is the layer xaml:

<esri:FeatureLayer ID="Fields" FeatureSymbol="{StaticResource SelectSymbol}"
                        Url="http://vm-jupiter02/ArcGISServer/rest/services/Fields/FeatureServer/0"
                        OutFields="*"
                        DisableClientCaching="True"
                        AutoSave="False"
                        ValidateEdits="True" />
0 Kudos
dotMorten_esri
Esri Notable Contributor
Don't set the FeatureSymbol property.
0 Kudos
PaulHarbulak
New Contributor
I already tried that.  It uses a default symbology and selection symbol but the template is still empty.  Same problem as before.
0 Kudos