mbgl::Map::getStyleJSON() returns the exact string that was originally passed into mbgl::Map::setStyleJSON() or fetched from the style URL, even if the style has been mutated since then using the runtime styling API. It should instead return a serialized representation of the current style, reflecting any changes made using the runtime styling API (and annotations API?).
Ultimately, I think the iOS/macOS SDK should expose an -[MGLStyle JSONDataUsingEncoding:] method that would use mbgl::Map::getStyleJSON() to return the current style. This method would complement the initializers proposed in #6386, make it easier to implement the runtime styling API in React Native Mapbox GL (mapbox/react-native-mapbox-gl#416), and allow macosapp to save out the results of any runtime styling changes in MapDocument.
mbgl::Map::getStyleJSON()
returns the exact string that was originally passed intombgl::Map::setStyleJSON()
or fetched from the style URL, even if the style has been mutated since then using the runtime styling API. It should instead return a serialized representation of the current style, reflecting any changes made using the runtime styling API (and annotations API?).Ultimately, I think the iOS/macOS SDK should expose an
-[MGLStyle JSONDataUsingEncoding:]
method that would usembgl::Map::getStyleJSON()
to return the current style. This method would complement the initializers proposed in #6386, make it easier to implement the runtime styling API in React Native Mapbox GL (mapbox/react-native-mapbox-gl#416), and allow macosapp to save out the results of any runtime styling changes in MapDocument./cc @jfirebaugh @frederoni