You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
MGLShapeSource should have a shape array convenience initializer #7453
Despite -[MGLShapeSource initWithIdentifier:shape:options:] documentation mentioning the possibility of using an MGLShapeCollectionFeature to manage multiple features, developers unfamiliar with the Simple Features specification are unlikely to discover this capability and will assume that a shape source can only be used with one shape. We should add the following convenience initializers to MGLShapeSource so developers don’t have to go through MGLShapeCollection explicitly:
-initWithIdentifier:shapes:options: would wrap the shapes in an MGLShapeCollection.
-initWithIdentifier:features:options: would wrap the features in an MGLShapeCollectionFeature.
If we encounter a shapes array that contains an MGLFeature, should we treat it as an ordinary shape, or should we upgrade to an MGLShapeCollectionFeature and wrap the other shapes in features?
I’d prefer not to add a shapes or features property, since that blurs the definition of the kind of data this source actually holds.
If we encounter a shapes array that contains an MGLFeature, should we treat it as an ordinary shape, or should we upgrade to an MGLShapeCollectionFeature and wrap the other shapes in features?
This is a good question. I think that developers who are unfamiliar with the Simple Features specification will also be unfamiliar with the distinction between geometry objects (shapes) and feature objects.
Since creating an MGLFeature is as easy as creating an MGLShape (even if the meta data properties of MGLFeature are not used) and because most developers will eventually realize they want to create feature objects to unlock the full power of runtime and data driven styling, I think that offering only -initWithIdentifier:features:options: and directing developers to that API in documentation and examples could help simplify one of the most initially confusing parts of the runtime styling API and reduce the support workload a bit.
The existing APIs (and a new -initWithIdentifier:shapes:options: that treats any MGLFeatureas an ordinary shape) should suffice for developers who really want or need to work with geometries for some reason.
Activity
boundsj commentedon Jan 10, 2017
This is a good question. I think that developers who are unfamiliar with the Simple Features specification will also be unfamiliar with the distinction between geometry objects (shapes) and feature objects.
Since creating an
MGLFeatureis as easy as creating anMGLShape(even if the meta data properties ofMGLFeatureare not used) and because most developers will eventually realize they want to create feature objects to unlock the full power of runtime and data driven styling, I think that offering only-initWithIdentifier:features:options:and directing developers to that API in documentation and examples could help simplify one of the most initially confusing parts of the runtime styling API and reduce the support workload a bit.The existing APIs (and a new
-initWithIdentifier:shapes:options:that treats anyMGLFeatureas an ordinary shape) should suffice for developers who really want or need to work with geometries for some reason.boundsj commentedon Jan 12, 2017
Fixed in #7665 on the release-ios-v3.4.0 branch.