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.
Allow plugins to transform location updates #12280
The iOS map SDK needs to support a new plugin that performs a transformation on each location update that comes from the location manager to a specific geodetic datum, by registering an NSValueTransformer. Some corresponding changes are needed in the iOS map SDK to support this plugin:
Define a value transformer name as a constant, such as MGLConvertToDatumTransformerName.
Use the value transformer whenever we position the user dot or camera in response to a user location update.
This would be a lightweight complement to the custom location manager API being implemented in #12013. It would only be appropriate for certain use cases requiring a different datum. This feature is not intended to introduce support for alternative map projections.
As an alternative to consulting a value transformer, support for this plugin could be provided through a custom MGLLocationManager implementation based on #12013. However, that would require the plugin to configure a new CLLocationManager independently of the configuration that’s currently built into the map SDK.
Are you thinking about the SDK provide a default datum converter? The advantage of the new location manager api is that you can account for correcting location offsets or perform a transformation as long as you pass the update to the LM delegate.
If the case is provide a default converter then I agree with @julianrex that this could be a protocol, but then we open the door to provide multiple conversions or at least one.
and -[CoordinateTransformer transformedValue:] would get called at the appropriate times.
NSValueTransformer would have limited capabilities compared to a protocol such as MGLLocationManager. For example, a value transformer probably has to be stateless, unlike a custom MGLLocationManager implementation. On the other hand, a value transformer has the benefit of inheriting all the built-in location manager’s settings. That’s appropriate for datum conversion, which is orthogonal to those settings.
@fabian-guerra, I think we need to implement this change regardless of #12013. An application may need to install the plugin described above and implement their own custom location manager for things like indoor positioning. The map view would transform the location manager’s updates, whether built-in or custom, before using them to position the camera or user location annotation. It’s also conceivable that the plugin would expand to handle overlay data in the future, in which case the registered value transformer could also come in handy.
As I pointed out in #12280 (comment), this means users of the plugin are unable to implement their own custom location managers for purposes like indoor location tracking or location simulation. The plugin will need to expose its own custom custom location manager interface for this purpose.
The China plugin has a public MBCNLocationManager. I made it public but forgot to add it to the header. This has been fixed.
For cases where there is a need for custom location tracking such as indoor or location simulation the value transformer can be used (since indoor LM require calibration it's possible they already deliver the coordinates in the appropriate system).
Activity
julianrex commentedon Jul 2, 2018
I like the idea of providing a transformer - though perhaps this should be defined by a protocol?
fabian-guerra commentedon Jul 2, 2018
Are you thinking about the SDK provide a default datum converter? The advantage of the new location manager api is that you can account for correcting location offsets or perform a transformation as long as you pass the update to the LM delegate.
As an example look at this lines:
mapbox-gl-native/platform/ios/app/MBXCustomLocationViewController.m
Lines 104 to 119 in 5af4080
If the case is provide a default converter then I agree with @julianrex that this could be a protocol, but then we open the door to provide multiple conversions or at least one.
1ec5 commentedon Jul 2, 2018
NSValueTransformer would allow us to support this plugin rather transparently. The plugin would run this code at initialization:
and
-[CoordinateTransformer transformedValue:]would get called at the appropriate times.NSValueTransformer would have limited capabilities compared to a protocol such as MGLLocationManager. For example, a value transformer probably has to be stateless, unlike a custom MGLLocationManager implementation. On the other hand, a value transformer has the benefit of inheriting all the built-in location manager’s settings. That’s appropriate for datum conversion, which is orthogonal to those settings.
1ec5 commentedon Jul 12, 2018
@fabian-guerra, I think we need to implement this change regardless of #12013. An application may need to install the plugin described above and implement their own custom location manager for things like indoor positioning. The map view would transform the location manager’s updates, whether built-in or custom, before using them to position the camera or user location annotation. It’s also conceivable that the plugin would expand to handle overlay data in the future, in which case the registered value transformer could also come in handy.
fabian-guerra commentedon Aug 20, 2018
This was addressed in the China plugin repo. The plugin creates a LM with coordinates conversion and implements the
NSValueTransformer.1ec5 commentedon Aug 21, 2018
As I pointed out in #12280 (comment), this means users of the plugin are unable to implement their own custom location managers for purposes like indoor location tracking or location simulation. The plugin will need to expose its own custom custom location manager interface for this purpose.
/cc @lloydsheng
fabian-guerra commentedon Aug 21, 2018
Elaborating more into the final implementation:
MBCNLocationManager. I made it public but forgot to add it to the header. This has been fixed./cc @lloydsheng @1ec5