REACT

google-maps-react [리액트 구글 맵 기본 장소 마커 지우기]

user-anonymous 2022. 4. 8. 19:15
728x90

구글 맵에서 기존에 있던 장소 마커를 지우고 싶을 경우

//커스텀 맵 스타일 선언
const mapStyle = [
    {
      featureType: 'poi', //(물가, 교량..등 장소)
      elementType: 'labels.icon',
      stylers: [{ visibility: 'off' }],
    },
  ...
  
  return(
  <Map
  ...
  styles={mapStyle}
  />
  
  )

위에 처럼 해주면 된다


참고
https://developers.google.com/maps/documentation/javascript/examples/maptype-styled-simple

Styled Map Types  |  Maps JavaScript API  |  Google Developers

This example creates a new map type, which the user can select from the map type control. The map type includes custom styles. TypeScript function initMap(): void { // Create a new StyledMapType object, passing it an array of styles, // and the name to be

developers.google.com

https://developers.google.com/maps/documentation/javascript/style-reference

Style Reference for Maps JavaScript API  |  Google Developers

Select platform: Android iOS JavaScript With style options you can customize the presentation of the standard Google map styles, changing the visual display of features like roads, parks, businesses, and other points of interest. As well as changing the st

developers.google.com



728x90
반응형