Unable to show feature layer through IOS arcgis runtime sdk

1304
3
03-17-2017 05:26 AM
DasNobel
New Contributor

Hi,

I am using below code to show feature layer but it is not showing in ios app. I have created this feature layer through arcgis online.

    

      //initialize map with basemap

        let map = AGSMap(basemap: AGSBasemap.streetsBasemap())

        

        //assign map to the map view

        self.mapView.map = map

        

        

        

        //initialize service feature table using url

        let featureTable = AGSServiceFeatureTable(URL: NSURL(string: "https://services7.arcgis.com/JRY73mi2cJ1KeR7T/arcgis/rest/services/NewYorkHospitalLayer/FeatureServe...")!)

        //create a feature layer

        let featureLayer = AGSFeatureLayer(featureTable: featureTable)

        

        //add the feature layer to the operational layers

        map.operationalLayers.addObject(featureLayer)

Thanks

Tags (1)
0 Kudos
3 Replies
DavidLednik
Occasional Contributor II

Hi!

You need to specify specific layer inside featureService

let featureTable = AGSServiceFeatureTable(url: URL(string: "https://services7.arcgis.com/JRY73mi2cJ1KeR7T/arcgis/rest/services/NewYorkHospitalLayer/FeatureServe...")!)

regards,

David

DasNobel
New Contributor

Thanks, David. Now I am able to see layer.

Is it possible to show above layer and basemap as an offline mode?

0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Das,

You can load basemap offline mode by creating a tpk file. For more information please check this:

ArcGIS Local Tiled layer—ArcGIS Runtime SDK for iOS | ArcGIS for Developers 

For the featureLayer in offline mode, you need to prepare the data for offline mode, basically enable the sync functions and then you can either choose view-only or editable offline data based on your requirement.

For more information about featureLayer offline, please check: Create an offline map—ArcGIS Runtime SDK for iOS | ArcGIS for Developers  

Hope this can help.

Nathan