본문

180906(목) - Google Maps (Businesses and Other POI)

Google Maps


Businesses and Other POI

- 기본적으로 POIs 는 icon과 함께 base map에 appear

- POIs include parks, schools, government buildings, and more

- businesses POIs는 map type이 normal일 때, appear

ex) shops, restaurants, hotels, and more

- business POIs가 indoor maps일 때는, lite mode map에서만 appear

- POI는 Places SDK의 place에 corresponds

- but unless national or historic significance면 그거슨 POIs가 아니다.


Listen for click events on POIs

OnPoiClickListener

public class OnPoiClickDemoActivity extends FragmentActivity
   
implements OnMapReadyCallback, GoogleMap.OnPoiClickListener {

   
@Override
   
protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
        setContentView
(R.layout.poi_click_demo);

       
SupportMapFragment 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(getApplicationContext(), "Clicked: " +
                        poi
.name + "\nPlace ID:" + poi.placeId +
                       
"\nLatitude:" + poi.latLng.latitude +
                       
" Longitude:" + poi.latLng.longitude,
               
Toast.LENGTH_SHORT).show();
   
}
}


- POSs는 기본적으로 map에 표시되지만, on-click UI 는 없다.

PointOfInterestcontains lat / lng coordinates, place ID, name


Stop POIs form showing on the map

- all POIs or specific categories POIs는 custom styles applying 으로 hide 가능

hiding map features with styling.

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


공유

댓글