Camera Controls¶
There are multiple ways to control the Camera Position in Mappls SDKs. Following are the methods tha you can use:
Move To Target¶
This method allows to move the camera towards the target location.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.newLatLng(LatLng(latitude, longitude)))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(latitude, longitude)));
Move To Target with Zoom¶
This method allows to move the camera towards the target location with a fixed zoom.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(latitude, longitude), zoom))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), zoom));
Move To Target with Padding¶
This method allows to move the camera towards the target location with padding.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.newLatLngPadding(LatLng(latitude, longitude), left, top, right, bottom))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.newLatLngPadding(new LatLng(latitude, longitude), left, top, right, bottom));
Move To Bound¶
This method allows to move the camera towards the target location with view bounds.
Kotlin¶
val latLngBounds = LatLngBounds.Builder()
.include(LatLng(lat1, lng1))
.include(LatLng(lat2, lng2))
.build()
mapplsMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, left, top, right, bottom))
Java¶
LatLngBounds latLngBounds = new LatLngBounds.Builder()
.include(new LatLng(lat1, lng1))
.include(new LatLng(lat2, lng2))
.build();
mapplsMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, left, top, right, bottom));
Zoom To¶
This method allows to zoom the camera to a particular zoom-level. Example, 18/14 etc.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomTo(zoom))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomTo(zoom));
Zoom By¶
This method allows to zoom the camera to a particular zoom by some amount of zoom level
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomBy(2.0))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomBy(2.0));
Zoom In¶
This method allows to zoom in.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomIn())
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomIn());
Zoom Out¶
This method allows to zoom out.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomOut())
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.zoomOut());
Bearing To¶
This method allows to zoom with respect to the bearing.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.bearingTo(bearing))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.bearingTo(bearing));
Tilt To¶
This method allows you to tilt the camera to specefic tilt in degrees eg.,20.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.tiltTo(tilt))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.tiltTo(tilt));
Padding To¶
This method allows to move the camera towards the location with padding.
Kotlin¶
mapplsMap.moveCamera(CameraUpdateFactory.paddingTo(left, top, right, bottom))
Java¶
mapplsMap.moveCamera(CameraUpdateFactory.paddingTo(left, top, right, bottom));
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!