Skip to content

mimikero

Program / Security etc…

Menu
Menu

Google Maps API: MarkerClustererのアイコンスタイルをカスタマイズする方法

Posted on 2023年6月9日2023年6月10日 by mimi

Google Maps Marker Clustererのアイコンをカスタマイズしたかったのだが、書き方が大幅に変わっていたのでメモ

markerClusterer 該当コード

MarkerClustererのコード

参考: https://stackoverflow.com/questions/7834284/styling-markerclusterer-icons

<script src="https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js">
const renderer = {
            render: ({ count, position }) =>
                new google.maps.Marker({
                    icon: { url:"IMGURL" }, 
                    label: { text: String(count), color: "white", fontSize: "10px" },
                    position,
                    // adjust zIndex to be above other markers
                    zIndex: Number(google.maps.Marker.MAX_ZINDEX) + count,
            }),
            };
const markerCluster = new markerClusterer.MarkerClusterer({ 
                map, 
                markers,
                renderer,
            });

MarkerClustererPlusのコード

MarkerClustererPlusは非推奨らしい。ややこしい。
https://www.npmjs.com/package/@googlemaps/markerclustererplus

<script src="https://unpkg.com/@googlemaps/markerclustererplus/dist/index.min.js">
new MarkerClusterer(
  map,
  markers,
  {
    imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m',
  },
);

導入

ここでは触れない。

JavaScriptでGoogle MapとMarkerClustererを使用してマーカーをまとめて表示する

コメントを残す コメントをキャンセル

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です

CAPTCHA


email confirm*

post date*

ads

trends post

Spring Boot と Spring Framework バージョン 対応表まとめ(SpringBoot v2,v3)

Excelデータのスクロールバーが短い現象を保存を使わずに直す

エックスサーバーにLaravelプロジェクトをデプロイ

latest post

  • Cockpit-Docker をubuntu20にインストールする
  • PHPのProcessで日本語パラメータを扱うとsurrogates not allowed となる
  • XServerでexecやshell_execを実行すると、Unable to forkとエラーが出るとき
  • tenable解説 混合リソースの検出
  • tenable解説 WebDAV
  • tenable解説 ディレクトリリスト
  • tenable解説 暗号化されていないパスワードフォーム
  • tenable解説 オートコンプリートのパスワードフィールド
  • tenable解説 CVS/SVN ユーザーの漏洩
  • tenable解説 プライベート IP アドレスの漏洩
  • tenable解説 メールアドレスの漏洩
  • tenable解説 バックアップファイル
  • tenable解説 バックアップディレクトリ
  • tenable解説 共通ファイルの検出
  • tenable解説 共通ディレクトリの検出

カテゴリー

  • Authentication & Session
  • BurpSuite
  • Component Vulnerability
  • Data Exposure
  • HTTP Security Header
  • Lodash
  • Moment.js
  • tenable
  • Web Applications
  • Web Servers
  • 未分類
  • 脆弱性解説
©2025 mimikero | WordPress Theme by Superbthemes.com