How to display Google maps in 2D?

I created a custom map style following this guide

https://www.youtube.com/watch?v=sLZxAB1el6w

The problem that I am currently facing is that I want to display the map in a 2D view, and not in the ground 3D view by default. I do not want to turn on the compass, using which, I believe, you can switch between the two views.

It would be very helpful if you could share any information about this.

thanks

+5
source share
3 answers

As far as I know, there is no way to limit only 2D viewing to just one option.

However, you can change settings like this.

GoogleMapOptions options = new GoogleMapOptions(); options.compassEnabled(false); options.tiltGesturesEnabled(false); options.rotateGesturesEnabled(false); MapView mapView = new MapView(context, options); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap map) { } }); 

For more options, check out the document https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMapOptions

0
source

I think you are looking for MapType:

 @Override public void onMapReady(GoogleMap map) { mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); } 

From api docs:

public static final int MAP_TYPE_HYBRID

Satellite maps with a transparent layer of main streets.

public static final int MAP_TYPE_NONE

No base map fragments.

public static final int MAP_TYPE_NORMAL

Major cards.

public static final int MAP_TYPE_SATELLITE

Satellite maps without tags.

public static final int MAP_TYPE_TERRAIN

Maps of the landscape.

Hope this helps.

0
source

For your Google Map instance, use the animateCamera method and set the slope to 0 degrees for the CameraBuilder instance.

 public void onMapReady(GoogleMap googleMap) { CameraPosition cameraPosition = new CameraPosition.Builder().target(your_lat_long).zoom(16).tilt(0).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } 
0
source

Source: https://habr.com/ru/post/1264258/


All Articles