mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

MGLShapeSource.features(matching predicate: NSPredicate?) returns 0 features

Open Jmaguerre opened this issue 9 years ago • 3 comments

Platform: iOS Mapbox SDK version: 3.6.1

Steps to trigger behavior

  1. Add an MGLShapeSource with one MGLShape feature
  2. Query style for the source by identifier and cast it as MGLShapeSource
  3. Query features in source with MGLShapeSource.features(matching predicate: NSPredicate?) and nil predicate to retrieve all features

Expected behavior

Return an array of features similar to

(lldb) po source.features(matching: nil)
▿ 2 elements
  - 0 : <MGLPolygonFeature: 0x1702cc8d0; count = 4; bounds = { sw = {29.4, -99.1}, ne = {29.4, -99.0}}>
  - 1 : <MGLPolygonFeature: 0x1704ce070; count = 4; bounds = { sw = {29.4, -99.1}, ne = {29.4, -99.0}}>

Actual behavior

0 elements are returned

Screenshots

Mapview with purple polygon feature added created in step 1 img_0210

One thing I noticed is that after the source is retrieved in step 2 from the query from the style the shape attribute of it is nil. Don't know if it is related nor why it is nil even though the feature is added and visible in the map.

Thanks.

Jmaguerre avatar Aug 14 '17 17:08 Jmaguerre

The expected behavior example was taken from version 3.5 of the sdk where it was working

Jmaguerre avatar Aug 14 '17 17:08 Jmaguerre

Might be similar to https://github.com/mapbox/mapbox-gl-native/issues/9646

epau avatar Aug 15 '17 20:08 epau

Related to #9646 and fixed in #9784.

fabian-guerra avatar Aug 18 '17 13:08 fabian-guerra