Android Question Google Maps - Floor Plans [Solved]

RichardN

Well-Known Member
Licensed User
Longtime User
There are an increasing number of buildings with floor plans available in Google Maps. Whilst this may be a desireable feature in normal view I am implementing Satellite view for a particular purpose. When you reach a certain zoom level the floor plan replaces the satellite view.

Can this 'feature' be supressed so the floor plan never appears?

....... I see from a post on Stackoverflow that a Java property .setIndoorEnabled(false) can be set.

Can this be exposed in B4A?
 
Last edited:

TILogistic

Expert
Licensed User
Longtime User
see:
1634483011089.png
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
or

Library GoogleMapsExtras

B4X:
GoogleMapsExtras1.SetBuildingsEnabled(GoogleMap1, False)

1634483657045.png
 
Upvote 1

RichardN

Well-Known Member
Licensed User
Longtime User
Thanks @oparra but the designer property 'Buildings Enabled' is already unchecked. Something in my code appears to be switching it back on again.

This code snippet below is used to suppress Google Maps points of interest. Could it be this code that is enabling floor plans again? If so what properties can be changed to return the desired result?

Switch Off Google Maps POI:
..........

Dim MapStyle As String = $"[{"featureType":"poi","stylers":[{"visibility": "off"}]}]"$
    SetGoogleMapStyle(Gmap, MapStyle)
    
.......

Public Sub SetGoogleMapStyle(mGoogleMap As GoogleMap, mMapStyle As String) As Boolean
    Dim jo As JavaObject = mGoogleMap
    Dim style As JavaObject
    style.InitializeNewInstance("com.google.android.gms.maps.model.MapStyleOptions", Array(mMapStyle))
    Return jo.RunMethod("setMapStyle", Array(style))
End Sub
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
After a bit of experimentation the issue is resolved. The designer property of BuildingEnable is a little misleading as it does not affect the layer in question. The desired result is obtained with the GoogleMapsExtras Lib.
B4X:
GoogleMapsExtras.SetIndoorEnabled(Gmap,False)

The Java Object code above used to suppress the Points Of Interest appears quite compatible and does not interfere with the desired result.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Thanks @oparra but the designer property 'Buildings Enabled' is already unchecked. Something in my code appears to be switching it back on again.

This code snippet below is used to suppress Google Maps points of interest. Could it be this code that is enabling floor plans again? If so what properties can be changed to return the desired result?

Switch Off Google Maps POI:
..........

Dim MapStyle As String = $"[{"featureType":"poi","stylers":[{"visibility": "off"}]}]"$
    SetGoogleMapStyle(Gmap, MapStyle)
   
.......

Public Sub SetGoogleMapStyle(mGoogleMap As GoogleMap, mMapStyle As String) As Boolean
    Dim jo As JavaObject = mGoogleMap
    Dim style As JavaObject
    style.InitializeNewInstance("com.google.android.gms.maps.model.MapStyleOptions", Array(mMapStyle))
    Return jo.RunMethod("setMapStyle", Array(style))
End Sub

I know this code and it shouldn't affect the map layer.

 
Upvote 0
Top