Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KMZ loads fine, onFeatureClick callback sometimes brings null features #742

Open
dkati opened this issue Jun 4, 2020 · 9 comments
Open
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@dkati
Copy link
Contributor

dkati commented Jun 4, 2020

Summary

Loading KMZ works perfectly but onFeatureClick callback, sometimes brings null property.

same kmz with same feature all the time, sometimes it says that property is null.

actually,

if (!feature.hasProperties()){
                        Log.e(TAG,"no properties.");
                    }

triggers

Environment details

  1. Device (ARM based)
  2. android 8.1
  3. com.google.maps.android:android-maps-utils:1.3.3

Steps to reproduce

seems kinda random.thats why i cant debug it

Code example

  mLayerListener = new GeoJsonLayer.GeoJsonOnFeatureClickListener() {
            @Override
            public void onFeatureClick(Feature feature) {
               Log.e(TAG,feature.getProperty("description");
            }
 }
 mLayer = new KmlLayer(getMap(), *a file stream*, baseActivity);
 mLayer.addLayerToMap();
 mLayer.setOnFeatureClickListener(mLayerListener);
@dkati dkati added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jun 4, 2020
@arriolac
Copy link
Contributor

arriolac commented Jun 4, 2020

Are you able to share the .kmz file to help us repro this?

@dkati
Copy link
Contributor Author

dkati commented Jun 4, 2020

@dkati
Copy link
Contributor Author

dkati commented Jun 4, 2020

In order to reproduce, load it, check the feature, clear the map, remount kml, recheck feature.

Repeat

@dkati
Copy link
Contributor Author

dkati commented Jun 5, 2020

i also implemented an asynctask for rendering (constructor) and it has the same result...

randomly i get no property
(Caching issue?)

@arriolac
Copy link
Contributor

arriolac commented Jun 11, 2020

Confirmed that I'm able to reproduce this issue. Digging into it 🔍

@arriolac
Copy link
Contributor

Seems like the issue is that the KMLLayer does not deterministically add KMLFeatures in the same order. Since your KMZ file contains overlapping polygons, this presents as an issue wherein tapping on the same region clicks different polygons (depending on which polygon was added last in an overlapping region). You can validate this by checking out the KML demo in the demo app on my branch chris/fix/742.

@dkati
Copy link
Contributor Author

dkati commented Jun 11, 2020

Any ideas? Imma also build library from scratch in order to find something

@arriolac arriolac added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed triage me I really want to be triaged. labels Jun 18, 2020
@arriolac
Copy link
Contributor

arriolac commented Jun 18, 2020

Do you have control over the KMZ file? Easiest workaround is to make sure there are no overlapping layers. Otherwise, the solution would be to ensure that KML parsing and adding layers to the map should be deterministic in order for the same file.

@dkati
Copy link
Contributor Author

dkati commented Jun 30, 2020

good evening and sorry for the delayed answer.

No i do not have control over the kml. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants