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

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked May 10, 2017 at 11:24

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);
answered May 11, 2017 at 19:06
1
  • thans dr it is working fine. Commented May 15, 2017 at 5:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.