I'm working on Google Maps, I found a strange error which I never came across before: Here are the details.
I am trying to put two markers in the boundary using,
latLngBounds = new LatLngBounds(mDestination, mOrigin);
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(mDestination).include(mOrigin);
I get following error.
java.lang.IllegalArgumentException: southern latitude exceeds northern latitude (23.029011581089936 > 23.0060917)
at com.google.android.gms.common.internal.Preconditions.checkArgument(Unknown Source:38)
at com.google.android.gms.maps.model.LatLngBounds.<init>(Unknown Source:7)
at com.cmrlabs.tracker.MainActivity.drawRoute(MainActivity.java:324)
at com.cmrlabs.tracker.MainActivity.access$500(MainActivity.java:73)
at com.cmrlabs.tracker.MainActivity$2.onMapClick(MainActivity.java:410)
at com.google.android.gms.maps.zzy.onMapClick(Unknown Source:2)
at com.google.android.gms.maps.internal.zzak.dispatchTransaction(Unknown Source:5)
at com.google.android.gms.internal.maps.zzb.onTransact(Unknown Source:12)
at android.os.Binder.transact(Binder.java:667)
at cj.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):14)
I have no clue how to fix this, any suggestions?
Thank you in advance..!
The LatLngBounds constructor takes two parameters: the southwest and northeast corner. That isn't what you have - you have two points, so you shouldn't be using that constructor. Instead, use the Builder
and call build()
on it in the end to construct the LatLngBounds
object:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(mDestination).include(mOrigin);
latLngBounds = builder.build();