0

I am new in the arcgis runtime. I am trying to develop an android application.

Steps that i follwed

  • Created an account in arcgis.com .
  • Then i created one Feature Layer (hosted) from the shape files zip .
  • Then i share this to everyone.
  • I copied the url given at the below. url is . Please see the output for the url.
  • Then i try to implemet means to show this in the map on my android application And trying to do some feature-layer-query.Refference is in the GITHUB
  • I am trying to replace the service_url to my url. I am doing the search operation and getting the result from the online then trying to zoom that extent. But is noe even showing my map too.
  • Now i am getting problem. it showing the error in

    05-10 16:31:23.516 20030-20030/com.esri.arcgisruntime.samples.featurelayerquery E/Feature layer query: Feature search failed for: kulathoor. Error=com.esri.arcgisruntime.ArcGISRuntimeException: Invalid JSON

Please see the below image for ref enter image description here

My code try

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // inflate MapView from layout
        mMapView = (MapView) findViewById(R.id.mapView);

        // create a map with the topographic basemap
        final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
        // set the map to be displayed in the mapview
        mMapView.setMap(map);

        // create feature layer with its service feature table
        // create the service feature table
        //mServiceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));
        mServiceFeatureTable = new ServiceFeatureTable("https://services7.arcgis.com/7FyZZrSIYfiWYztL/arcgis/rest/services/MyGisFileLayerTest/MapServer");
        // create the feature layer using the service feature table
        mFeaturelayer = new FeatureLayer(mServiceFeatureTable);
        mFeaturelayer.setOpacity(1.0f);
        //override the renderer
        SimpleLineSymbol lineSymbol= new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 1);
        SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);
        mFeaturelayer.setRenderer(new SimpleRenderer(fillSymbol));

        // add the layer to the map
        map.getOperationalLayers().add(mFeaturelayer);

        // zoom to a view point of the USA
        mMapView.setViewpointCenterAsync(new Point(-11000000, 5000000, SpatialReferences.getWebMercator()), 100000000);
    }

Can you find out where i am doing mistake . Why the may is not shwing in my app. Below is the screen shot of my application.enter image description here

1 Answer 1

1

Update your FeatureServer url to the layer id, https://services7.arcgis.com/7FyZZrSIYfiWYztL/ArcGIS/rest/services/MyGisFileTest/FeatureServer/0. Here is some updated code:

    ArcGISMap map = new ArcGISMap(Basemap.Type.STREETS_VECTOR, 8.498151, 76.929790, 10);
    // set the map to be displayed in this view
    mMapView.setMap(map);
        ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable("https://services7.arcgis.com/7FyZZrSIYfiWYztL/ArcGIS/rest/services/MyGisFileTest/FeatureServer/0");
    FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
    featureLayer.setOpacity(1.0f);
    SimpleLineSymbol lineSymbol= new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 1);
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);
    featureLayer.setRenderer(new SimpleRenderer(fillSymbol));

    map.getOperationalLayers().add(featureLayer);
1
  • thans dr it is working fine.
    – Pranav MS
    Commented May 15, 2017 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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