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

MultiPolygon not supported by OnFeatureClickListener? #320

Closed
migrations opened this issue Oct 19, 2016 · 3 comments
Closed

MultiPolygon not supported by OnFeatureClickListener? #320

migrations opened this issue Oct 19, 2016 · 3 comments

Comments

@migrations
Copy link

screenshot_2_polygons
Summary:
When clicking on geojson from type MultiPolygon then setOnFeatureClickListener receives not feature and crashes when you want to use a getProperty

Steps to reproduce:

Use following JSON in the GeoJsonDemoActivity.

replace for example the content of raw/earthquakes.json with this:

{
  "type": "FeatureCollection",
  "features": [{
    "type": "Feature",
    "geometry": {
      "type": "MultiPolygon",
      "coordinates": [
        [
          [
            [25, 41],
            [25, 42],
            [26, 42],
            [26, 41],
            [25, 41]
          ]
        ]
      ]
    },
    "properties": {
      "title": "Test Multipolygon"
    }
  }, {
    "type": "Feature",
    "geometry": {
      "type": "Polygon",
      "coordinates": [
        [
          [27, 41],
          [27, 42],
          [28, 42],
          [28, 41],
          [27, 41]
        ]
      ]
    },
    "properties": {
      "title": "Test Polygon"
    }
  }]
}

ps: i've worked around this issue by splitting all MultiPolygons into Polygons in the app, but that is a "little" ugly ;)

@NativeDevlopment
Copy link

NativeDevlopment commented Nov 12, 2016

Hello Team,
I am facing same issue, could you please suggest me, how to resolve this issue.

Thanks
Amar

@Libby713
Copy link
Contributor

Libby713 commented Dec 5, 2016

Fixed in f848679

@Libby713 Libby713 closed this as completed Dec 6, 2016
@jayraghav
Copy link

Hello Team ,
i am unable to get different different polygon properties on Click of Multy polygon click listener. , could you suggest me how to resolve this issue,
layer.setOnFeatureClickListener(new GeoJsonLayer.GeoJsonOnFeatureClickListener() {
@OverRide
public void onFeatureClick(GeoJsonFeature geoJsonFeature) {
if(geoJsonFeature.hasProperty("id")){
Log.e("get feature",geoJsonFeature.getPropertyKeys().toString());
Log.e("id",geoJsonFeature.getProperty("id"));
Log.e("Name",geoJsonFeature.getProperty("Name"));
}

}

});
Thanks
Amar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants