ธุรกิจและจุดสนใจอื่นๆ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โดยค่าเริ่มต้น จุดที่น่าสนใจ (POI) จะปรากฏบนแผนที่ฐานพร้อมกับไอคอนที่เกี่ยวข้อง
POI ได้แก่ สวนสาธารณะ โรงเรียน อาคารรัฐบาล และ
อื่นๆ
นอกจากนี้ จุดที่น่าสนใจของธุรกิจจะปรากฏบนแผนที่โดยค่าเริ่มต้นเมื่อประเภทแผนที่เป็น
normal
POI ของธุรกิจแสดงถึงธุรกิจต่างๆ เช่น ร้านค้า ร้านอาหาร โรงแรม
และอื่นๆ POI ของธุรกิจในแผนที่ในอาคาร (แปลนพื้น) จะปรากฏในแผนที่โหมด Lite เท่านั้น
POI จะสอดคล้องกับรหัสสถานที่ตามที่กำหนดไว้ใน
Places SDK สำหรับ Android เช่น สวนสาธารณะเป็นจุดที่น่าสนใจ แต่
สิ่งต่างๆ เช่น น้ำพุ โดยทั่วไปจะไม่ใช่จุดที่น่าสนใจ (เว้นแต่จะมี
ความสำคัญระดับชาติหรือทางประวัติศาสตร์)
รอรับเหตุการณ์คลิกในจุดที่น่าสนใจ
หากต้องการตอบสนองต่อผู้ใช้ที่แตะจุดที่น่าสนใจ คุณสามารถใช้
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();
}
}
POI จะปรากฏบนแผนที่โดยค่าเริ่มต้น แต่ไม่มี UI ที่คลิกได้เริ่มต้น กล่าวคือ
API จะไม่แสดงหน้าต่างข้อมูลหรืออินเทอร์เฟซผู้ใช้อื่นๆ โดยอัตโนมัติ
เมื่อผู้ใช้แตะ POI
ดังตัวอย่างข้างต้น คุณตั้งค่า
OnPoiClickListener
บนแผนที่ได้โดย
เรียก
GoogleMap.setOnPoiClickListener(OnPoiClickListener)
เมื่อผู้ใช้คลิก (แตะ) จุดที่น่าสนใจ แอปจะได้รับเหตุการณ์
OnPoiClick(PointOfInterest)
ซึ่งระบุจุดที่น่าสนใจ (POI) ที่ผู้ใช้คลิก
PointOfInterest
มีพิกัดละติจูด/ลองจิจูด
รหัสสถานที่และชื่อของจุดที่น่าสนใจ
หยุดแสดงจุดที่น่าสนใจบนแผนที่
คุณซ่อนจุดที่น่าสนใจ (POI) ได้โดยใช้รูปแบบที่กำหนดเองกับ POI ทั้งหมดหรือ
กับหมวดหมู่ POI ที่เฉพาะเจาะจง
การประกาศรูปแบบ JSON ต่อไปนี้จะซ่อนจุดที่น่าสนใจของธุรกิจทั้งหมดในแผนที่
[
{
"featureType": "poi.business",
"stylers": [
{ "visibility": "off" }
]
}
]
อีกตัวอย่างหนึ่งคือ JSON ต่อไปนี้จะช่วยลดความซับซ้อนในการแสดงหมวดหมู่ทั้งหมด
ของจุดที่น่าสนใจ
[
{
"featureType": "poi",
"stylers": [
{ "visibility": "simplified" }
]
}
]
ดูโค้ด Java และรายละเอียดอื่นๆ ได้ในคู่มือการซ่อนฟีเจอร์ของแผนที่ด้วยการจัดรูปแบบ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 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)."]]