Reputation: 295
I want to remove all the default object or places from google maps. I hope to know is this easier or building on overlay is easier. I want a blank map that supported by google. I will add the places or the object I need whenever I want , is this possible to do? maps.clear()
doesn't add any help, I want to something onCreate()
method or onStart()
method to remove all the places and have a blank map with no places just road and buildings.
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mapReady = true;
Double latitude = location.getLatitude();
Double longitude = location.getLongitude();
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
// Add a marker in Sydney and move the camera
//LatLng sydney = new LatLng(-34, 151);
LatLng currentPosition = new LatLng(latitude,longitude);
mMap.addMarker(new MarkerOptions().position(currentPosition).title("Current Location"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(currentPosition));
mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
mMap.setMapType();
loadNearByPlaces(latitude,longitude);
}
This the start code I used. How to modify it and make it do what I need?
Upvotes: 2
Views: 933
Reputation: 32128
You can hide default icons for places and POIs and achieve your goal if you apply custom styling.
Have a look at the tutorial:
https://developers.google.com/maps/documentation/android-api/styling
The styling wizard is available at:
https://mapstyle.withgoogle.com/
For example to hide all businesses on the map you apply the following style
[
{
"featureType": "poi.business",
"stylers": [
{
"visibility": "off"
}
]
}
]
Upvotes: 2