2

I am using the ArcGIS Silverlight API. I all I need to do is to get the geometry from a feature by objectid to zoom to it:

getFeature(objectid);

So I used WCF service to get the geometry but I received the following error:

Type 'System.__ComObject' cannot be serialized

Can anyone help?

2

You should be able to use System.Net.WebClient to send a request to a server with a url compliant with Esri's REST API.

For example, to retrieve a the feature whose ObjectID=2, passing this url:

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0/2?f=pjson

The server returns a response that includes attributes and geometry:

{
  "feature" : 
  {
    "attributes" : {
      "FID" : 2, 
      "CITY_FIPS" : "01990", 
      "CITY_NAME" : "Anacortes", 
      "STATE_FIPS" : "53", 
      "STATE_NAME" : "Washington", 
      "STATE_CITY" : "5301990", 
      "TYPE" : "city", 
      "CAPITAL" : "N", 
      "ELEVATION" : -99, 
      "POP1990" : 11451, 
      "HOUSEHOLDS" : 4669, 
      "MALES" : 5506, 
      "FEMALES" : 5945, 
      "WHITE" : 10945, 
      "BLACK" : 62, 
      "AMERI_ES" : 192, 
      "ASIAN_PI" : 154, 
      "OTHER" : 98, 
      "HISPANIC" : 233, 
      "AGE_UNDER5" : 725, 
      "AGE_5_17" : 1981, 
      "AGE_18_64" : 6276, 
      "AGE_65_UP" : 2469, 
      "NEVERMARRY" : 1420, 
      "MARRIED" : 5818, 
      "SEPARATED" : 151, 
      "WIDOWED" : 833, 
      "DIVORCED" : 916, 
      "HSEHLD_1_M" : 437, 
      "HSEHLD_1_F" : 711, 
      "MARHH_CHD" : 1032, 
      "MARHH_NO_C" : 1777, 
      "MHH_CHILD" : 76, 
      "FHH_CHILD" : 255, 
      "HSE_UNITS" : 4992, 
      "VACANT" : 323, 
      "OWNER_OCC" : 3181, 
      "RENTER_OCC" : 1488, 
      "MEDIAN_VAL" : 85300, 
      "MEDIANRENT" : 342, 
      "UNITS_1DET" : 3724, 
      "UNITS_1ATT" : 121, 
      "UNITS2" : 134, 
      "UNITS3_9" : 380, 
      "UNITS10_49" : 353, 
      "UNITS50_UP" : 0, 
      "MOBILEHOME" : 200
    }
    , 
    "geometry" : 
    {
      "x" : -122.630685404, 
      "y" : 48.492215849
    }
  }
}

ArcObjects cannot be used within a silverlight app. If you want to turn a resulting REST geometry into an ArcObjects IGeometry, I would use Esri's WPF library to parse the REST, then convert the WPF geometry into an IGeometry.

| improve this answer | |
  • thank you for your reply it's so helpful, kindly if you can give me more details on how to use this url in silverlight application to return the results – geoid Jan 27 '13 at 16:01
0

eventually I found a solution

using Query Task and pass in the where clause the filter like

query.where="objectid=17";

but when i need to save edit delete in sde use WCF service

that's set

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.