<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FeatureLayer initWithJson in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83983#M841</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Adam,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think this is actually the intent of the initWithJSON constructor. This constructor returns a Feature Layer based upon a JSON representation of the feature attributes.&amp;nbsp; Here is an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feature layer json {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentVersion = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; drawingInfo =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; editable = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryType = esriGeometryPoint;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hasAttachments = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; maxScale = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; minScale = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What exactly are you looking to do?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Mar 2011 15:44:34 GMT</pubDate>
    <dc:creator>ClayTinnell</dc:creator>
    <dc:date>2011-03-17T15:44:34Z</dc:date>
    <item>
      <title>FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83980#M838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to build a feature layer using a JSON string but there is no point showing on the simulator when I run the project. Am I going about it the correct way?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;- (void)viewDidLoad
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; [super viewDidLoad];
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSURL *serviceUrl = [NSURL URLWithString:kMapServiceURL];
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSTiledMapServiceLayer *tiledMapServiceLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:serviceUrl];
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView addMapLayer:tiledMapServiceLayer withName:@"World Street Map"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; //test FL w/ JSON
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSString *featureCollection = @"{\"layerDefinition\": { \"geometryType\": \"esriGeometryPoint\"&amp;nbsp; }, \"featureSet\": { \"features\": [ { \"attributes\": { \"key\": \"someValue\"}, \"geometry\": {\"x\":-122.408951,\"y\":37.783206,\"spatialReference\":{\"wkid\":4326}}&amp;nbsp; } ] } }";
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; SBJsonParser *parser = [[SBJsonParser alloc] init];
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSDictionary *json = [parser objectWithString:featureCollection];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSFeatureLayer *featureLayer = [[AGSFeatureLayer alloc] initWithJSON:json];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView addMapLayer:featureLayer withName:@"FL"];
 
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 01:45:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83980#M838</guid>
      <dc:creator>AdamPfister</dc:creator>
      <dc:date>2011-03-16T01:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83981#M839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am fairly new to Objective-C so please take this for what it is worth.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would first check if that long string makes it into your featureCollection NSString object. You probably know this, but you can try NSLogging featureCollection - does the string appear as you expect it in the console?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 18:44:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83981#M839</guid>
      <dc:creator>PaulLohr</dc:creator>
      <dc:date>2011-03-16T18:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83982#M840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I threw a breakpoint in after it loaded up the json and then printed it out.&amp;nbsp; Then i went here, &lt;/SPAN&gt;&lt;A href="http://jsonformatter.curiousconcept.com/"&gt;http://jsonformatter.curiousconcept.com/&lt;/A&gt;&lt;SPAN&gt;, and everything came back ok so i'm pretty sure the JSON is formatted correctly.&amp;nbsp; I wonder if there is some key/value pair I'm missing that is required for the FeatureLayer to properly serialize?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 19:29:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83982#M840</guid>
      <dc:creator>AdamPfister</dc:creator>
      <dc:date>2011-03-16T19:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83983#M841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Adam,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think this is actually the intent of the initWithJSON constructor. This constructor returns a Feature Layer based upon a JSON representation of the feature attributes.&amp;nbsp; Here is an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feature layer json {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentVersion = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; drawingInfo =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; editable = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryType = esriGeometryPoint;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hasAttachments = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; maxScale = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; minScale = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What exactly are you looking to do?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 15:44:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83983#M841</guid>
      <dc:creator>ClayTinnell</dc:creator>
      <dc:date>2011-03-17T15:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83984#M842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to construct a FeatureLayer from a stored JSON string in the same way it's done in the JavaScript API shown here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/featurelayer.htm#FeatureLayerConst2"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/featurelayer.htm#FeatureLayerConst2&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this possible w/ the iOS API?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 15:52:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83984#M842</guid>
      <dc:creator>AdamPfister</dc:creator>
      <dc:date>2011-03-17T15:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83985#M843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This may get you a little closer.&amp;nbsp; I still don't see the point, but I am getting the feature to show up in the feature layer.&amp;nbsp; Note... I adjusted the json a little and changed the point and the spatial reference to a known point:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NSString *ld = @"{ \"geometryType\": \"esriGeometryPoint\"&amp;nbsp; }";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SBJsonParser *parser = [[SBJsonParser alloc] init];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NSDictionary *layerDefinition = [parser objectWithString:ld];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NSString *fs = @"{ \"features\": [ { \"attributes\": { \"key\": \"someValue\"}, \"geometry\": {\"x\":-9407733.852498,\"y\":4735858.166659,\"spatialReference\":{\"wkid\":102100}}&amp;nbsp; } ] }";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NSDictionary *featureSet = [parser objectWithString:fs];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSFeatureLayer *featureLayer = [[AGSFeatureLayer alloc] initWithLayerDefinitionJSON:layerDefinition featureSetJSON:featureSet];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;featureLayer.outFields = [NSArray arrayWithObject:@"*"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[self.mapView addMapLayer:featureLayer withName:@"FL"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NSLog(@"features: %@ ",featureLayer.graphics);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSPoint *point = [AGSPoint pointWithX:-9407733.852498 y:4735858.166659 spatialReference:self.mapView.spatialReference]; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSEnvelope *extent = [AGSEnvelope envelopeWithXmin:point.x ymin:point.y xmax:point.x+50 ymax:point.y+50 spatialReference:mapView.spatialReference]; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[self.mapView zoomToEnvelope:extent animated:YES];&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 19:20:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83985#M843</guid>
      <dc:creator>ClayTinnell</dc:creator>
      <dc:date>2011-03-17T19:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83986#M844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What I'm trying to do is just see what it would take to create a simple FL that will always be constant within the application.&amp;nbsp; If I can create the FL from a JSON string without having to add it from an actual data source like a MapService, it may be beneficial for me.&amp;nbsp; Just trying things out as I'm new to the iOS scene.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help and I'll give that a try and report back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 19:26:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83986#M844</guid>
      <dc:creator>AdamPfister</dc:creator>
      <dc:date>2011-03-17T19:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer initWithJson</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83987#M845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like that worked.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 21:54:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/featurelayer-initwithjson/m-p/83987#M845</guid>
      <dc:creator>AdamPfister</dc:creator>
      <dc:date>2011-03-17T21:54:17Z</dc:date>
    </item>
  </channel>
</rss>

