A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/maps/documentation/ios-sdk/poi below:

Businesses and other points of interest | Maps SDK for iOS

Businesses and other points of interest

Stay organized with collections Save and categorize content based on your preferences.

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 kGMSTypeNormal. Business POIs represent businesses such as shops, restaurants, hotels, and more.

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

Listening for click events on POIs

If you want to respond to a user tapping on a POI, implement GMSMapViewDelegate, and implement the mapView(_:didTapPOIWithPlaceID:name:location:) method, as shown in the following example:

Swift
import GoogleMaps

class POI: UIViewController, GMSMapViewDelegate {

  override func loadView() {
    let camera = GMSCameraPosition.camera(
      withLatitude: 47.603,
      longitude:-122.331,
      zoom:14
    )
    let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
    mapView.delegate = self
    self.view = mapView
  }

  func mapView(
    _ mapView: GMSMapView,
    didTapPOIWithPlaceID placeID: String,
    name: String,
    location: CLLocationCoordinate2D
  ) {
    print("You tapped \(name): \(placeID), \(location.latitude)/\(location.longitude)")
  }
}
      
Objective-C
#import "POI.h"
@import GoogleMaps;

@interface POI () <GMSMapViewDelegate>

@end

@implementation POI

- (void)loadView {
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:47.603
                                                            longitude:-122.331
                                                                 zoom:14];
  GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
  mapView.delegate = self;
  self.view = mapView;
}

#pragma mark - GMSMapViewDelegate

- (void)mapView:(GMSMapView *)mapView
    didTapPOIWithPlaceID:(NSString *)placeID
                    name:(NSString *)name
                location:(CLLocationCoordinate2D)location {
  NSLog(@"You tapped %@: %@, %f/%f", name, placeID, location.latitude, location.longitude);
}

@end
      
Showing details in an info window

POIs appear on the map by default, but there is no default on-click UI (the API does not automatically display an info window or any other user interface when the user taps a POI). The following example shows how to use a marker to display an info window for a POI:

Swift
// Declare GMSMarker instance at the class level.
let infoMarker = GMSMarker()

// Attach an info window to the POI using the GMSMarker.
func mapView(
  _ mapView: GMSMapView,
  didTapPOIWithPlaceID placeID: String,
  name: String,
  location: CLLocationCoordinate2D
) {
  infoMarker.snippet = placeID
  infoMarker.position = location
  infoMarker.title = name
  infoMarker.opacity = 0;
  infoMarker.infoWindowAnchor.y = 1
  infoMarker.map = mapView
  mapView.selectedMarker = infoMarker
}
      
Objective-C
// Declare a GMSMarker instance at the class level.
GMSMarker *infoMarker;

// Attach an info window to the POI using the GMSMarker.
- (void)mapView:(GMSMapView *)mapView
    didTapPOIWithPlaceID:(NSString *)placeID
                    name:(NSString *)name
                location:(CLLocationCoordinate2D)location {
  infoMarker = [GMSMarker markerWithPosition:location];
  infoMarker.snippet = placeID;
  infoMarker.title = name;
  infoMarker.opacity = 0;
  CGPoint pos = infoMarker.infoWindowAnchor;
  pos.y = 1;
  infoMarker.infoWindowAnchor = pos;
  infoMarker.map = mapView;
  mapView.selectedMarker = infoMarker;
}
      
Stopping POIs from showing on the map

You can hide 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 more details, see the guide to hiding map features with styling.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-23 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 UTC."],[[["Points of interest (POIs) such as parks, schools, and businesses are displayed on the base map by default, with business POIs appearing only in the `kGMSTypeNormal` map type."],["Developers can listen for click events on POIs and respond to user taps by implementing the `GMSMapViewDelegate` and the `mapView(_:didTapPOIWithPlaceID:name:location:)` method."],["While POIs are shown automatically, there is no default on-click UI; developers can display an info window by using a marker and attaching it to the POI."],["Custom styles can be applied to hide all or specific categories of POIs on the map, such as business POIs or simplifying the display of all POIs."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4