사업체 및 기타 관심 지점
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
기본적으로 관심 장소(POI)는 해당 아이콘과 함께 기본 지도에
표시됩니다. 관심 장소에는 공원, 학교, 정부 건물 등이
포함됩니다.
또한 지도 유형이 normal
인 경우 비즈니스 관심 장소가 지도에 기본으로
표시됩니다. 비즈니스 관심 장소는 상점, 음식점, 호텔 등의 비즈니스를
나타냅니다. 실내 지도(평면도)의 비즈니스 관심 장소는
라이트 모드 지도에만 표시됩니다.
관심 장소는 Android용 Places SDK에서 정의된 대응하는
장소 ID가 있는 곳입니다. 예를 들어
휴양 공원은 관심 장소이지만, 일반적으로 분수대와 같은 곳은 국가적 또는 역사적 의미를 갖지 않는 한
관심 장소가 아닙니다.
관심 장소의 클릭 이벤트 수신 대기
관심 장소를 탭한 사용자에게 응답하려면
다음 코드 샘플에 표시된 대로 OnPoiClickListener
를
사용하세요.
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();
}
}
관심 장소는 기본적으로 지도에 표시되지만, 클릭 시 실행되는 기본 UI는 없습니다. 즉,
사용자가 관심 장소를 탭할 때 API에서 정보 창이나 다른
사용자 인터페이스를 자동으로 표시하지는 않습니다.
위의 샘플에 나온 것처럼,
GoogleMap.setOnPoiClickListener(OnPoiClickListener)
를
호출하여 지도에
OnPoiClickListener
를 설정합니다.
사용자가 관심 장소를 클릭(탭)하면 앱에서
사용자가 클릭한 관심 장소를 나타내는
OnPoiClick(PointOfInterest)
이벤트를 수신합니다. PointOfInterest
에는
관심 장소의 위도/경도 좌표,
장소 ID 및 이름이 포함됩니다.
지도에 관심 장소 표시 중지
모든 관심 장소 또는 특정 카테고리의 관심 장소에 맞춤 스타일을 적용하여
관심 장소를 숨길 수 있습니다.
다음과 같은 JSON 스타일 선언을 적용하면 지도의 모든 비즈니스 관심 장소가 숨겨집니다.
[
{
"featureType": "poi.business",
"stylers": [
{ "visibility": "off" }
]
}
]
또 다른 예로, 다음 JSON 스타일은 모든 카테고리의 관심 장소 표시를
간소화합니다.
[
{
"featureType": "poi",
"stylers": [
{ "visibility": "simplified" }
]
}
]
Java 코드 및 기타 세부정보에 대해 알아보려면
스타일을 지정하여 지도 지형지물 숨기기 관련 가이드를 읽어보세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-05-09(UTC)
[null,null,["최종 업데이트: 2024-05-09(UTC)"],[[["\u003cp\u003ePoints of Interest (POIs) such as parks, schools, and businesses, are displayed on the map by default with corresponding icons.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can listen for click events on POIs and respond to user interactions using the \u003ccode\u003eOnPoiClickListener\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAlthough POIs are displayed by default, there is no default on-click UI, meaning developers need to implement their own info windows or other UI elements.\u003c/p\u003e\n"],["\u003cp\u003eThe display of POIs can be customized or hidden altogether using JSON style declarations to control their visibility and appearance.\u003c/p\u003e\n"]]],["Points of interest (POIs), including parks, schools, and businesses, appear by default on maps. To handle user taps on POIs, use `OnPoiClickListener` and set it via `GoogleMap.setOnPoiClickListener`. This triggers an `OnPoiClick` event, providing the POI's name, place ID, and coordinates. You can also hide POIs using custom JSON styling by setting the `visibility` to `off` for business POIs for instance or `simplified` for all POIs.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/poi \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/poi \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/examples/event-poi \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nBy default, points of interest (POIs) appear on the base map along with their\ncorresponding icons. POIs include parks, schools, government buildings, and\nmore.\n\nIn addition, *business* POIs appear by default on the map when the map type is\n`normal`. Business POIs represent businesses such as shops, restaurants, hotels,\nand more. Business POIs on [indoor maps (floor plans)](/maps/documentation/android-sdk/map#indoor) appear only on a\n[lite mode](/maps/documentation/android-sdk/lite) map.\n\nA POI corresponds to a [Place ID](/maps/documentation/places/android-sdk/place-id), as defined in the\nPlaces SDK for Android. For example, recreational parks are POIs, but\nthings like water fountains are generally not POIs (unless they're of national\nor historic significance).\n\nListen for click events on POIs\n\nIf you want to respond to a user tapping on a POI, you can use an\n[`OnPoiClickListener`](/android/reference/com/google/android/gms/maps/GoogleMap.OnPoiClickListener) as shown in the following code\nsample:\n\n\nKotlin \n\n```kotlin\ninternal class OnPoiClickDemoActivity : AppCompatActivity(), OnMapReadyCallback, OnPoiClickListener {\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.poi_click_demo)\n val mapFragment = supportFragmentManager.findFragmentById(R.id.map)\n as SupportMapFragment\n mapFragment.getMapAsync(this)\n }\n\n override fun onMapReady(map: GoogleMap) {\n map.setOnPoiClickListener(this)\n }\n\n override fun onPoiClick(poi: PointOfInterest) {\n Toast.makeText(this, \"\"\"Clicked: ${poi.name}\n Place ID:${poi.placeId}\n Latitude:${poi.latLng.latitude} Longitude:${poi.latLng.longitude}\"\"\",\n Toast.LENGTH_SHORT\n ).show()\n }\n}\n\n \n```\n\nJava \n\n```java\nclass OnPoiClickDemoActivity extends AppCompatActivity implements\n OnMapReadyCallback, GoogleMap.OnPoiClickListener {\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.poi_click_demo);\n SupportMapFragment mapFragment;\n mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);\n mapFragment.getMapAsync(this);\n }\n\n @Override\n public void onMapReady(GoogleMap map) {\n map.setOnPoiClickListener(this);\n }\n\n @Override\n public void onPoiClick(PointOfInterest poi) {\n Toast.makeText(this, \"Clicked: \" +\n poi.name + \"\\nPlace ID:\" + poi.placeId +\n \"\\nLatitude:\" + poi.latLng.latitude +\n \" Longitude:\" + poi.latLng.longitude,\n Toast.LENGTH_SHORT).show();\n }\n}\n\n \n```\n\n\u003cbr /\u003e\n\nPOIs appear on the map by default, but there is no default on-click UI. That is,\nthe API does not automatically display an info window or any other user\ninterface when the user taps a POI.\n\nAs the above sample shows, you set the\n[`OnPoiClickListener`](/android/reference/com/google/android/gms/maps/GoogleMap.OnPoiClickListener) on the map by\ncalling\n[`GoogleMap.setOnPoiClickListener(OnPoiClickListener)`](/android/reference/com/google/android/gms/maps/GoogleMap#setOnPoiClickListener(com.google.android.gms.maps.GoogleMap.OnPoiClickListener)).\nWhen a user clicks (taps) on a POI, your app receives an\n[`OnPoiClick(PointOfInterest)`](/android/reference/com/google/android/gms/maps/GoogleMap.OnPoiClickListener#onPoiClick(com.google.android.gms.maps.model.PointOfInterest)) event\nindicating the point of interest (POI) that the user clicked. The\n[`PointOfInterest`](/android/reference/com/google/android/gms/maps/model/PointOfInterest) contains the latitude/longitude coordinates,\nplace ID and name of the point of interest.\n\nStop POIs from showing on the map\n\nYou can hide points of interest (POIs) by applying custom styles to all POIs or\nto specific categories of POIs.\n\nThe following JSON style declaration hides all business POIs on the map: \n\n [\n {\n \"featureType\": \"poi.business\",\n \"stylers\": [\n { \"visibility\": \"off\" }\n ]\n }\n ]\n\nAs another example, the following JSON simplifies the display of all categories\nof POIs: \n\n [\n {\n \"featureType\": \"poi\",\n \"stylers\": [\n { \"visibility\": \"simplified\" }\n ]\n }\n ]\n\nFor Java code and other details, see the guide to\n[hiding map features with styling](/maps/documentation/android-sdk/hiding-features)."]]