Businesses and Other Points of Interest

Select platform: Android iOS JavaScript

By default, points of interest (POIs) appear on the base map along with their corresponding icons. POIs include parks, schools, government buildings, and more.

In addition, business POIs appear by default on the map when the map type is normal. Business POIs represent businesses such as shops, restaurants, hotels, and more. Business POIs on indoor maps (floor plans) appear only on a lite mode map.

A POI corresponds to a Place ID, as defined in the Places SDK for Android. For example, recreational parks are POIs, but things like water fountains are generally not POIs (unless they're of national or historic significance).

Listen for click events on POIs

If you want to respond to a user tapping on a POI, you can use an OnPoiClickListener as shown in the following code sample:

Kotlin

internal class OnPoiClickDemoActivity : AppCompatActivity(), OnMapReadyCallback, OnPoiClickListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.poi_click_demo)
        val mapFragment = supportFragmentManager.findFragmentById(R.id.map)
                as SupportMapFragment
        mapFragment.getMapAsync(this)
    }

    override fun onMapReady(map: GoogleMap) {
        map.setOnPoiClickListener(this)
    }

    override fun onPoiClick(poi: PointOfInterest) {
        Toast.makeText(this, """Clicked: ${poi.name}
            Place ID:${poi.placeId}
            Latitude:${poi.latLng.latitude} Longitude:${poi.latLng.longitude}""",
            Toast.LENGTH_SHORT
        ).show()
    }
}

      

Java

class OnPoiClickDemoActivity extends AppCompatActivity implements
    OnMapReadyCallback, GoogleMap.OnPoiClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.poi_click_demo);
        SupportMapFragment mapFragment;
        mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap map) {
        map.setOnPoiClickListener(this);
    }

    @Override
    public void onPoiClick(PointOfInterest poi) {
        Toast.makeText(this, "Clicked: " +
                poi.name + "\nPlace ID:" + poi.placeId +
                "\nLatitude:" + poi.latLng.latitude +
                " Longitude:" + poi.latLng.longitude,
            Toast.LENGTH_SHORT).show();
    }
}

      

POIs appear on the map by default, but there is no default on-click UI. That is, the API does not automatically display an info window or any other user interface when the user taps a POI.

As the above sample shows, you set the OnPoiClickListener on the map by calling GoogleMap.setOnPoiClickListener(OnPoiClickListener). When a user clicks (taps) on a POI, your app receives an OnPoiClick(PointOfInterest) event indicating the point of interest (POI) that the user clicked. The PointOfInterest contains the latitude/longitude coordinates, place ID and name of the point of interest.

Stop POIs from showing on the map

You can hide points of interest (POIs) by applying custom styles to all POIs or to specific categories of POIs.

The following JSON style declaration hides all business POIs on the map:

[
  {
    "featureType": "poi.business",
    "stylers": [
      { "visibility": "off" }
    ]
  }
]

As another example, the following JSON simplifies the display of all categories of POIs:

[
  {
    "featureType": "poi",
    "stylers": [
      { "visibility": "simplified" }
    ]
  }
]

For Java code and other details, see the guide to hiding map features with styling.