Skip to content
Advertisement

How I can get LatLng class from Mapbox library?

I have updated a Mapbox library to the last version. Now I can’t find a LatLng class.

With this package (com.mapbox.mapboxsdk.geometry.LatLng) LatLng class isn’t available at all. In the official documentation I cant find this class. Perhaps they replaced this class by another one.

Advertisement

Answer

Following this migrate-to-v10 documentation you should use Point:

In v10, all the LatLng related methods and parameters are replaced with Point. Remember that the latitude and longitude parameters are reversed between LatLng and Point.

pre-v10:

CircleOptions circleOptions = new CircleOptions()
 .withLatLng(new LatLng(6.687337, 0.381457))

v10:

val circleOptions: CircleOptions = CircleOptions()
 .withPoint(Point.fromLngLat(0.381457, 6.687337))
Advertisement