Select to view content in your preferred language

Problem with the identification of objects

414
1
06-21-2019 10:46 AM
AlexanderKulikov
Emerging Contributor

Hello! There was a problem with the identification of objects. mGeoElements equal to zero. what is the reason? how can I fix it? I can't get attributes because of this. ArcGIS Runtime SDK for Android 100.4.1

mSceneView.setOnTouchListener(new DefaultSceneViewOnTouchListener(mSceneView){
    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        // get the screen point where user tapped
        android.graphics.Point screenPoint = new android.graphics.Point((int) e.getX(), (int) e.getY());
        // ...

        final ListenableFuture<List<IdentifyLayerResult>> identifyFuture = mSceneView.identifyLayersAsync(screenPoint, 5,
                false);

        identifyFuture.addDoneListener(new Runnable() {
            @Override
            public void run() {
                try {

                    List<IdentifyLayerResult> identifyLayersResults = identifyFuture.get();
                    StringBuilder message = new StringBuilder();

                    for (IdentifyLayerResult identifyLayerResult : identifyLayersResults) {
                        if (identifyLayerResult.getElements().size() > 0) {

                            GeoElement topmostElement = identifyLayerResult.getElements().get(0);
                            if (topmostElement instanceof Feature) {
                                Feature identifiedFeature = (Feature)topmostElement;
                                attr = topmostElement.getAttributes();
                                Set<String> keys = attr.keySet();
                                for (String key : keys) {
                                    Object value = attr.get(key);



                                    if(value != null) {
                                        message.append(key + " | " + value + "\n");
                                    }

                                }
                            }

                        }
                    }
                    showDialog(attr);
0 Kudos
1 Reply
GuntherHeppner
Esri Contributor

Hi Alexander, please check the following:


- You seem to get two IdentifyLayerResult instances back. Have you checked that neither of them contains any results?
- Try to increase the search tolerance, i.e. instead of 5 dp pass 30 dp for example.

- If none of this helps, please provide more information of the data in your scene. What layer types are in your scene? Would you be able to share your scene with us?

Gunther

0 Kudos