2020/09,江端さんの技術メモ

$ git clone https://github.com/GuyBrand/WssSample

で取ってきた、コードで、色々調べている。

サーバは、以下で起動。

クアイアントは、

で起動(に失敗)

以下、色々ごそごそやってみる。

ちなみに、getCrtホルダは、証明鍵を作るプログラムのようす
C:\Users\ebata\WssSample\genCrt>ls
genCrt.go new.crt new.key

C:\Users\ebata\WssSample\goClient>curl localhost:9200
Client sent an HTTP request to an HTTPS server.

C:\Users\ebata\WssSample\goClient>curl https://localhost:9200
curl: (77) schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325) - 信頼されていない機関によって証明書チェーンが発行されました。

「信頼されていない機関」って「私」か。そりゃそうだが。

うーん、では、curlコマンドを使ってHTTPSのAPIを叩く と 、SSL通信時発生する証明書エラーとその仕組みを理解する を参考にして、

C:\Users\ebata\WssSample\goClient>curl -k https://localhost:9200

を実行。

色々でてきた。ということは、サーバとしては機能しているようです。

とは言え、

は、解決されていないです。

そもそも、私、SSLの仕組み、きちんと理解できていると思っていません(だからAWSのhttps化で地獄を見ることになった)。今回、イケメンとラブレターで学ぶSSLの仕組み で、なんとか分かったような気になりました。

C:\Users\ebata\WssSample\server の中に入っている、algo.crt を叩いてみたら、

が出てきました。インストールして良いものかどうか迷いましたが、(有効期間内だったようだし)「証明証のインストール」のボタンを押してみました。

よく分かりませんが、言われるがまま(にボタンを押していきました。

そんでもって、サーバ側からは、C:\Users\ebata\WssSample\server>go run main.go hub.go conn.go クライアント側には、C:\Users\ebata\WssSample\goClient>go run goClient.go conn.go hub.go を入力しましたが ―― うん、症状改善なし、でした。

一応ブラウザから https://localhost:9200 を押下したみたのですが、

こんな感じですねえ。サーバのエラー表示はこんな感じです。

「詳細設定」ボタンを押して、「localhost にアクセスする(安全ではありません)」を押下すると、一応動きます。

この画面2枚上げると、表示が連動しているのが分かります。

Windows10の環境設定画面から、以下のような設定もやってみたけどダメでした(ので消しました(別の問題を引き起こしそうだったので))

(一時休憩)

現在勉強中のページ

MacでGolangでhttpdでTLSでLet's Encryptを使ってみた。

ここで困っていたら、普段からご教示して頂いているSさんから「mkcertを使ってみたら」というアドバイスを頂きました。で、get clone https://github.com/FiloSottile/mkcert.git などもやってみたのですが、ソースコードしか入っていなくて、このコンパイル方法も良く分かりませんでした。

https://github.com/FiloSottile/mkcertを除いてみたら、バイナリがダウンロードできそうことが分かりました。

でもって、ここから、Windows10で使えそうなバイナリをダウンロードしました。

ダウンロードしたところから、直接叩いてみたら、C:\Users\Ebata\AppData\Local\mkcert の中に、鍵ができていましたが、最初に、mkcer -installしろ、と言われています。

本当はmkcertにリネームした方が良いのでしょうが、面倒なので、そのまま mkcert-v1.4.1-windows-amd64.exe -install でセットしました。

その後、mkcert-v1.4.1-windows-amd64.exe localhost 127.0.0.1 と入力すると、"localhost" と "127.0.0.1"を含む鍵が、カレントディレクトリにできるようです。

で、"localhost+1-key.pem"を "algo.key"とリネームして、"localhost+1.pem"を"algo.crt"とリネームして、C:\Users\ebata\WssSample\serverに放り込む。

C:\Users\ebata\WssSample\server>go run main.go conn.go hub.go
file algo.crt found switching to https

とこの状態で、ブラウザから、https://localhost:9200を入力

おお! 警告が出なくなった!!! サーバはちゃんと動いているみたい。

では、クライアントのプログラムも・・・

画像に alt 属性が指定されていません。ファイル名: image-28.png

うん、こっちはダメだな。

    ws, _, err := websocket.NewClient(c, u, wsHeaders, 1024, 1024)
    if err != nil {
            fmt.Println(err.Error())
            return
    }

トレースで、このNewClient()でエラーが出ているのは分かっているんですが、この原因は分かりません。

クライアント側のコードでは、鍵の読み込みをしていないようです。

ちなみに、WssSample/gemCrt に鍵を生成するプログラムが入っていますが、これで作った鍵では、httpsの認証問題をクリアできませんでしたので、素直に「mkcertを使ってみたら」と申し上げます。

(もう一度チャレンジしますが今日は▽ここまで)。

2020/09,江端さんの忘備録

私、基本的に、人間の善性を信じていません。

I, basically, do not believe in the goodness of man.

自分の軸は、"孟子"よりも"荀子"側に倒れている、という感じです。

I feel like my axis is more on the side of "Junkyo" than "Mengzi".

同時に、これは「どちらかが正解」というものでもない、ということも知っています。

At the same time, I know that this isn't an "either/or" thing.

要するに、これは、個々の人間のビジョン(価値観)に基づくものです。

In short, this is based on an individual's vision (values).

世界は、自分の立ち位置(時間、場所、環境、過去の経験、その他)によって、見え方が変わるものですから。

Because the world can be seen differently depending on where we are at (time, place, environment, past experiences, etc.).

-----

ただ、ですね、そんな私であっても「人間は生れながらにして善である」を信じてしまうことがあります。

However, even then, I sometimes believe that "human beings are good as they are born."

例えば、

For example,

$ git clone https://github.com/GuyBrand/WssSample
Cloning into 'WssSample'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 16 (delta 0), reused 16 (delta 0), pack-reused 0
Unpacking objects: 100% (16/16), 8.69 KiB | 67.00 KiB/s, done.

という出力結果を見て、多幸感に満ちている時です。

It is the time when I am full of euphoria by seeing the output result.

-----

Golangのwebsocketのwss対応で、一日中、四苦八苦していたところに、こういうサンプルプログラムを惜しげもなく、世界に公開してくれる人がいる ――

When I knew someone who would like to release this kind of sample program to the world, where I was struggling all day with Golang's websocket wss support ---

その事実だけで、私は「世界を信じてもいい」と思えるのです。

That fact alone makes me think, "I can believe in the world."

2020/09,江端さんの忘備録

家族全員分のマイナポイント(一人5000円分)の登録完了しました(長女だけは、自力でやりきると、がんばっているようです)。

I've completed registration for all of my family's Miner Points(My Number card-based cashless payment services) (\5,000 per person) (only my senior daughter seems to be working hard to make it through on her own).

私は、「お国がくれる」というものなら、何だって貰います。

I'll take whatever "my country gives me".

自宅のPCにカードリーダを常備している、私の面目躍如(めんもくやくじょ)です。

I have a card reader on my home PC, characteristically masterful

ただ、家族分のポイントを、まとめて一つのクレジットカードに放り込めないというのは ―― まあ、そりゃ、セキュリティや詐欺対策の点からして『当然』だと思いますが ―― そこそこ、面倒くさかったです。

However, it was rather troublesome that the points for the family could not be thrown together into one credit card. Well, I think it's "natural" from the point of view of security and fraud measures.

ですから、私以外の家族については、定期券(PASMO)の方に放り込みました。

Therefore, for families other than me, I threw them on a commuter pass (PASMO).

ところが、PASMOは、事前の仮登録が必要とやらで、それに気がつかなかった為に、かなり、すったもんだしました。

However, PASMO needed preliminary registration in advance and I didn't notice it, so it was pretty wasteful.

-----

それでも、「行政は、このシステムを簡単に使えるようにするため、がんばっている」と思います。

Nevertheless, "the administration is working hard to make this system easy to use,

しかし、残念ながら、それは、私がシステムエンジニアだから分かる、とも思います。

But, unfortunately, I'm a systems engineer, so I understand that, I think.

-----

長女が興味深いことを言っていました。

My senior daughter had something interesting to say.

『要するに、政府は、国民のITリテラシー向上の為に、国民を訓練をしている訳だね』

"In short, the government is training the people to improve their IT literacy."

と。

確かに ―― 全ての国民が、マイナンバーカードを自由自在に使えれば、現在の行政の窓口業務は、(直感ですが)半分以下にできると思います。

Certainly, if all the people can use My Number Card freely, the current administrative window work can be less than half (intuitively).

これは、社会保障予算のダイナミックな配分変更が期待できる、明るい未来です。

This is a bright future, where we can expect a dynamic change in the social security budget.

-----

それにしても、『政府が、国民のITリテラシ向上の為の、訓練をしている』なら、『先ずは、IT教育をなんとかせえよ』と言いたい。

Even so, if "the government is training to improve the IT literacy of the people," I would like to say, "First of all, what should I do with IT education?"

未だに、スマホの学校への持ち込みを禁止している、アホな学校が多数あるようです(ええ、驚くほど身近にあって、驚いています)。

There still seem to be a lot of stupid schools that ban smartphones from bringing them to school (yes, they're surprisingly close to me).

逆だろ、逆。

"It's the opposite isn't it?"

スマホを、授業中に「教材」として使う教育カリキュラムを、今直ぐにでも始めないと、本当にヤバいと思います。

I think that it is really dangerous if we do not immediately start the educational curriculum that uses smartphones as "teaching materials" during classes.

私の目から見ても、行政(文部科学省等)がその方向に舵を切っているのは、明らかです。

From my point of view, it is clear that the administration (MEXT, etc.) is turning in that direction.

しかし、ITリテラシー絶無の老害グループ(現場の教師とPTA)が、それを妨害しまくっています。

However, useless old without IT literacy(on-site teachers and PTAs) are hindering it.

-----

かく言う私も、いずれは、その老害グループの仲間入りは確定です。

As I said, it is certain that I will eventually join the useless old

近い未来、私は、社会からやっかいもの扱いされて、とてつもなく不便で、もの凄く不愉快な思いをすることでしょう。

In the near future, I will be treated as a nuisance by society, which will be incredibly inconvenient and extremely unpleasant.

それでも、少なくとも「次の世代の邪魔をしない」ために、「それらに耐える」という覚悟はできてます。

Still, at least I'm prepared to "put up with them" so as not to "get in the way of the next generation".

2020/09,江端さんの技術メモ

Freemindのノード(orセル?)の表示欄を長くしたくて、これまで色々奮闘してきましたが、上手くいっておりません。

上記の赤い円でくくった部分を、3倍程度の長さにしたいのです。

「長文編集(alt+Return)」を使えば? という指摘はもっともなのですが、画面を移動させるきに、思考が一瞬停止する煩わしさが嫌いで、「長文編集(alt+Return)」を使わずになんとかしたいのです。

この不便さを理解して貰うのは難しのですが、私は、SKKIMEという特殊なIMEを使っています。SKKIMEでは、漢字変換中の文字が、このノードの終端にくると表示されなくなり、文章が書けなくなるのです。

見落している設定があるのかもしれないと期待していますが、もしダメなら諦めて、他のMindMapツールを探そうと思っています。

私、10年以上も、MindManagerを使ってきたのですが、古いバージョンがWindowsのバージョンでは動かなくなって、Freemindに乗り換えた、という経緯があります(加えて、MindManagerは、私が必要としない機能が満載で、高価で、もう個人では手がでません)。

私の場合、「MindMapでコラムを執筆する」という特殊な使い方をしていますので、Mindmapの本来の思想(単語レベルでの入力)と外れていることは分かっています。しかし、Freemindを使い続けられるのであれば、大変助かります。

ちなみに、わずかではありますが、「ソースコードレベルの改造」も視野に入れていますので、その点からアドバイスを頂けても大変助かります。

何卒、お助け頂けますよう、お願い申し上げます。

お手数ですが、ご連絡先は、こちらをご利用頂ければ幸甚と存じます。

http://kobore.net/mailAddress.gif

2020/09,江端さんの技術メモ

AnacondaとJupyter notebookのインストール

https://www.anaconda.com/download/

http://jupyter.org/ をインストールしておく。

Anaconda Prompt(anaconda3)を起動

>pip install qiskitでライブラリをインストールする

>conda listで qiskitがインストールされているかを確認できる。

つぎにAnaconda Nabigation(anaconda3)を起動する

Juypyter Notebook(anaconda3)

python3の入力環境を立ち上げる

で、こんな感じで入力する。

取り敢えず、ここまで(直ぐに忘れるのでメモ)

2020/09,江端さんの技術メモ

https://www.ibm.com/quantum-computing/

Ibm_xxxxxxxxではログインできなかったので、googleのアカウントでログイン

うん、多分作れているんだろう。000」と「011」が約50%で発生している(上位ビットは無視して良い思う)から。1024回くらい繰返しているみたい。ただ、(当然だけど)量子の非局所化を確認する方法って、ないんだろうなぁ

2020/09,江端さんの忘備録

昨夜、昔の自分のコラムのレビューをしていたら、ダイエット(摂食障害)について、コメントが付いているのに気がつきました。

I was reviewing my old column last night and noticed a comment attached to it about diet (eating disorders).

―― 「また食事を摂らなけばならない」と思うだけで、明日が来るのが怖い

"I'm scared that tomorrow will come just by thinking "I have to eat again""

-----

この壮絶なフレーズを目にして、私は、涙が出そうになりました。

When I saw this fierce phrase, I was about to cry.

「食べない」のではなく「食べられなくなる」という、悪魔の病気 ―― 拒食症

The Devil's Disease of not "not eating" but "not being able to eat" -- Anorexia

このコラムは、「半世紀を生きた」「男性」である私ですら、簡単に「拒食症」のスパイラルに陥っていった実体験のレポートです。

This column is a real report of a real-life experience where even I, a "man" who "lived half a century", easily went into an "anorexia" spiral.

ましてや、「ティーンエイジャ」の「女の子」にとっては、拒食症に至るプロセスが「坂道を転げ落ちるように」簡単であることは、想像に難くありません。

And it's not hard to imagine that for a "teenage" "girl" the process of getting to anorexia is as easy as "rolling downhill".

このコラムでは、ありとあらゆる主観や感情を排して、私(江端)の体を使った「実験」と「観測」と「物理現象」だけを使って、拒食症に至るメカニズムを説明しています。

In this column, I explain the mechanism leading to anorexia using only my (Ebata's) own body "experiments", "observations" and "physical phenomena", eliminating all kinds of subjectivity and emotions.

-----

このコラムを読んだ保護者が、このコラムを、拒食症になってしまった子ども(多くは女の子)に拒食症を説明するための資料として使っている、との話も聞きました。

I also heard that parents who read this column use it as a resource to explain anorexia to anorexic children (mostly girls).

ジャンジャン使って下さい。

Please use this without limit.

印刷、教材、講演、その他、ありとあらゆる非営利使用について、私への問い合わせは一切不要です。

You don't need to contact me about printing, teaching materials, lectures, or any non-profit use.

(*)但し、Web化権については、EE Times Japan社に、独占使用権があります。

(*) However, EE Times Japan has an exclusive license to use on the Web.

-----

私の試算(シミュレーション)が正しれば、

If my estimation (simulation) is correct,

■我が国の拒食症による死亡者は、年間584人(フランスでは、3000~4000人)

- The number of deaths from anorexia nervosa in Japan is 584 per year (3000 to 4000 in France).

■わが国(日本)の若い女性の半分以上(または、大部分)の死因が、拒食症

- More than half (or all) of the young women in Japan (Japan) die from anorexia.

となり「若い女性は、死ぬためにダイエットをしている」という解釈(もちろん極論)も成立します。

This means that "young women are dieting to die" (of course, the extreme theory) also holds.

-----

保護者の皆様は、お子様に、

Parents, please explain to your child that

「ダイエットに失敗する」ことは ―― 特にティーンエイジャの女の子にとっては ―― 「死を免れた幸運」である

"failing to lose weight" is "good fortune that has escaped death"

ことを、説明してあげて下さい。

Especially for teenage girls.

江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

今の私が欲しいものは、

What I want now is,

―― リモートで共有可能な電子ホワイトボード

"electronic whiteboards that can be shared remotely"

です。

多分、このような「共有ホワイトボード」は販売されていると思います。

Maybe these "shared whiteboards" are available for sale.

しかし、双方の環境に同じ機材を導入するのは、簡単ではなさそうです。高そうですし。

However, it doesn't seem to be easy to install the same equipment in both environments. Maybe it is expensive.

-----

タブレットと磁気ペンを使った「ボード共有」という手もあるのですが、まだ本格導入には早い段階でしょう。

There is also the possibility of "board sharing" using a tablet and a magnetic pen, but it's probably still early days for full implementation.

それと、タブレットとというのは書き難いんです、特に文字。もちろん「慣れ」もあるでしょうが。

And it's hard to write with a tablet, especially with text. Of course I need "experience" too.

しかし、私は、時々イラストを「作る」ため、ペンタブ使ってみたことがあったのですが、相性は良くなかったです。

However, I had tried using a pen-tab to "create" an illustration from time to time, but it wasn't a good match for me.

結局、使うの止めてしまいました(もったいない投資でした)。

I ended up stopping using the pen tabs (it was a waste of an investment).

今は、マウスとショートカットキーだけで絵を作っています("SAI"使いです)。

Now I create pictures using only the mouse and shortcut keys (as a "SAI" user).

-----

共有が無理なら、ホワイトボードを含めた仮オフィスを、自分の部屋に作る、ですかね。

If I can't share, I guess I'll make a temporary office, including a whiteboard, in my room.

YouTuberではないですが。

I'm not a YouTuber.

YouTubeと言えば、私、数本、YouTubeに投稿しています。

Speaking of YouTube, I've posted a few of them on YouTube.

メモに纏めるのが面倒なことを、ビデオ撮影して、YouTubeに放り込んでいるだけですが。

I'm just videotaping and throwing things on YouTube that I can't be bothered to write down.

-----

私、リアル世界のミーティングが開催できない今の世界が好きです。

I love the world where real world meetings cannot be held.

コロナ禍は収束して欲しいですが、Skype会議は収束して欲しくありません。

I want the Corona disaster to subside, but I don't want the Skype conference to subside.

"5時間"より"15分間"の方がいいです。

"15 minutes" is better than "5 hours".

成田空港のセキュリティで毎度足止め喰らって、狭いエコノミー席で、巨漢の外国人に押し潰されながら10時間を過し、時差ボケで苦しみながら、英語での発表を強いられるよりも ――

Every time I get held up by security at Narita Airport, spending ten hours in a cramped economy seat, being crushed by a giant foreigner, suffering from jet lag, and being force to present in English...

自宅で英文の資料を描いて、それらしい英語をしゃべって、ビデオクリップを作り、ネットでサーバに投稿する、新時代の国際学会「バンザイ」です。

It's a new-age international conference, "Banzai," where I draw English material at home, speak English about it, make video clips, and post them to a server on the Internet.

-----

しかし、その一方で、その為の設備投資は、避けえないと思っています。

However, on the other hand, I believe that capital investment for this purpose is inevitable.

―― 江端家書斎、スタジオ化計画

"Ebata's study, studio project"

この、書類と書籍(マンガコミックを含む)で溢れかえるカオス状態の部屋を、いかに、無機質な会議室のように装うか ――

How to make this chaotic room full of papers and books (including manga comics) look like an inorganic conference room?

先ずは、デジタル映像加工技術の検討です。

The first step is to examine digital video processing technology.

2020/09,江端さんの技術メモ

以下、https://github.com/SINTEF-9012/PruneCluster の簡単な翻訳

PruneCluster is a fast and realtime marker clustering library.
PruneClusterは、高速でリアルタイムなマーカークラスタリングライブラリです。

Example 1: 150 000 randomly moving markers.
例1:150,000個のマーカーをランダムに移動させる。

 Example 2: Realtime clusters of tweets.
例2. リアルタイムでツイートのクラスターを作成します。

It's working with Leaflet as an alternative to Leaflet.markercluster.
Leaflet.markerclusterの代替としてLeafletと連携しています。

The library is designed for large datasets or live situations. The memory consumption is kept low and the library is fast on mobile devices, thanks to a new algorithm inspired by collision detection in physical engines.
このライブラリは、大規模なデータセットやライブの状況を想定して設計されています。物理エンジンの衝突検出にヒントを得た新しいアルゴリズムを採用しているため、メモリ消費量は低く抑えられており、ライブラリはモバイルデバイス上で高速に動作します。

Features
特徴

Realtime
リアルタイム

The clusters can be updated in realtime. It's perfect for live datasets or datasets you want to filter at runtime.
クラスターをリアルタイムで更新することができます。ライブデータセットや、実行時にフィルタリングしたいデータセットに最適です。

Fast
高速化

Number of markers
マーカーの数
First step
最初のステップ
Update (low zoom level)
更新(低倍率)
Update (high zoom level)
更新(高倍率)
100instantinstantinstant
1 000instantinstantinstant
10 00014ms3ms2ms
60 00070ms23ms9ms
150 000220ms60ms20ms
1 000 0001.9s400ms135ms

These values are tested with random positions, on a recent laptop, using Chrome 38. One half of markers is moving randomly and the other half is static. It is also fast enough for mobile devices.
これらの値は、最近のノートパソコンで、Chrome 38を使用して、ランダムな位置でテストされています。マーカーの半分はランダムに動き、残りの半分は静止しています。モバイル端末でも十分に高速です。

If you prefer real world data, the 50k Leaflet.markercluster example is computed in 60ms (original).
実世界のデータをお望みなら、50k Leaflet.markercluster の例は 60ms (オリジナル) で計算されています。

Weight
ウエイト

You can specify the weight of each marker.
各マーカーのウエイトを指定することができます。

For example, you may want to add more importance to a marker representing an incident, than a marker representing a tweet.
例えば、ツイートを表すマーカーよりも、事件を表すマーカーの方がウエイトが高い場合があります。

Categories
カテゴリ

You can specify a category for the markers. Then a small object representing the number of markers for each category is attached to the clusters. This way, you can create cluster icons adapted to their content.
マーカーのカテゴリを指定することができます。そして、各カテゴリのマーカーの数を表す小さなオブジェクトがクラスタに添付されます。このようにして、その内容に合わせたクラスタアイコンを作成することができます。

Dynamic cluster size
動的なクラスタサイズ

The size of a cluster can be adjusted on the fly (Example)
クラスターの大きさをその場で調整可能(例)

Filtering
フィルタリング

The markers can be filtered easily with no performance cost.
性能コストをかけずに、簡単にマーカーをろ過することができます。

Usage
使用方法

Classic Way
古典的な方法

	<!-- In <head> -->
	<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css"
  integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ=="
  crossorigin=""/>

	<!-- In <head> or before </body> -->
	<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"
  integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log=="
  crossorigin=""></script>
	<script src="PruneCluster/dist/PruneCluster.js"></script>

Webpack & NPM

npm install exports-loader prunecluster

import { PruneCluster, PruneClusterForLeaflet } from 'exports-loader?PruneCluster,PruneClusterForLeaflet!prunecluster/dist/PruneCluster.js'

Example

var pruneCluster = new PruneClusterForLeaflet();

...
var marker = new PruneCluster.Marker(59.8717, 11.1909);
pruneCluster.RegisterMarker(marker);
...

leafletMap.addLayer(pruneCluster);

PruneClusterForLeaflet constructor

PruneClusterForLeaflet([size](#set-the-clustering-size), margin);

You can specify the size and margin which affect when your clusters and markers will be merged.
クラスターとマーカーがマージされるときに影響するサイズとマージンを指定できます。

size defaults to 120 and margin to 20.
サイズはデフォルトで120、マージンは20に設定されています。

Update a position
ポジションの更新

marker.Move(lat, lng);

Deletions
削除

// Remove all the markers
pruneCluster.RemoveMarkers();

// Remove a list of markers
pruneCluster.RemoveMarkers([markerA,markerB,...]);

Set the category
カテゴリを設定する

The category can be a number or a string, but in order to minimize the performance cost, it is recommended to use numbers between 0 and 7.
カテゴリは数字でも文字列でも構いませんが、パフォーマンスコストを最小限に抑えるために、0~7の間の数字を使用することをお勧めします。

marker.category = 5;

Set the weight
ウエイトを設定する

marker.weight = 4;

Filtering
フィルタリング

marker.filtered = true|false;

Set the clustering size
クラスタリングサイズを設定する

You can specify a number indicating the area of the cluster. Higher number means more markers "merged". (Example)
クラスタの領域を示す数値を指定することができます。数値が大きいほど、より多くのマーカーが "マージ "されていることを意味します。(例)

pruneCluster.Cluster.Size = 87;

Apply the changes
変更を適用する

Must be called when ANY changes are made.
変更が行われたときに呼び出されなければなりません。

pruneCluster.ProcessView();

Add custom data to marker object
マーカーオブジェクトにカスタムデータを追加

Each marker has a data object where you can specify your data.
各マーカーには、データを指定できるデータオブジェクトがあります。

marker.data.name = 'Roger';
marker.data.ID = '76ez';

Setting up a Leaflet icon or a Leaflet popup
リーフレットアイコンやリーフレットのポップアップを設定する

You can attach to the markers an icon object and a popup content
マーカーにはアイコンオブジェクトとポップアップコンテンツを添付することができます。

marker.data.icon = L.icon(...);  // See http://leafletjs.com/reference.html#icon
marker.data.popup = 'Popup content';

Faster leaflet icons
より高速なリーフレットアイコン

If you have a lot of markers, you can create the icons and popups on the fly in order to improve their performance.
マーカーが多い場合は、その場でアイコンやポップアップを作成しておくとパフォーマンスが向上します。

function createIcon(data, category) {
    return L.icon(...);
}

...

marker.data.icon = createIcon;

You can also override the PreapareLeafletMarker method. You can apply listeners to the markers here.
PreapareLeafletMarkerメソッドをオーバーライドすることもできます。ここではマーカーにリスナーを適用することができます。

pruneCluster.PrepareLeafletMarker = function(leafletMarker, data) {
    leafletMarker.setIcon(/*... */); // See http://leafletjs.com/reference.html#icon
    //listeners can be applied to markers in this function
    leafletMarker.on('click', function(){
    //do click event logic here
    });
    // A popup can already be attached to the marker
    // bindPopup can override it, but it's faster to update the content instead
    if (leafletMarker.getPopup()) {
        leafletMarker.setPopupContent(data.name);
    } else {
        leafletMarker.bindPopup(data.name);
    }
};

Setting up a custom cluster icon
カスタム クラスター アイコンの設定

pruneCluster.BuildLeafletClusterIcon = function(cluster) {
    var population = cluster.population, // the number of markers inside the cluster
        stats = cluster.stats; // if you have categories on your markers

    // If you want list of markers inside the cluster
    // (you must enable the option using PruneCluster.Cluster.ENABLE_MARKERS_LIST = true)
    var markers = cluster.GetClusterMarkers() 
        
    ...
    
    return icon; // L.Icon object (See http://leafletjs.com/reference.html#icon);
};

Listening to events on a cluster
クラスタ上のイベントを聞く

To listen to events on the cluster, you will need to override the BuildLeafletCluster method. A click event is already specified on m, but you can add other events like mouseover, mouseout, etc. Any events that a Leaflet marker supports, the cluster also supports, since it is just a modified marker. A full list of events can be found here.
クラスタ上のイベントをリッスンするには、BuildLeafletClusterメソッドをオーバーライドする必要があります。クリックイベントはすでに m で指定されていますが、マウスオーバーやマウスアウトなどの他のイベントを追加することができます。リーフレットマーカーがサポートしているイベントはすべて、クラスタもサポートしています。イベントの完全なリストはこちらを参照してください。

Below is an example of how to implement mouseover and mousedown for the cluster, but any events can be used in place of those.
以下にクラスタのマウスオーバーとマウスダウンの実装例を示しますが、これらの代わりに任意のイベントを使用することができます。

pruneCluster.BuildLeafletCluster = function(cluster, position) {
      var m = new L.Marker(position, {
        icon: pruneCluster.BuildLeafletClusterIcon(cluster)
      });

      m.on('click', function() {
        // Compute the  cluster bounds (it's slow : O(n))
        var markersArea = pruneCluster.Cluster.FindMarkersInArea(cluster.bounds);
        var b = pruneCluster.Cluster.ComputeBounds(markersArea);

        if (b) {
          var bounds = new L.LatLngBounds(
            new L.LatLng(b.minLat, b.maxLng),
            new L.LatLng(b.maxLat, b.minLng));

          var zoomLevelBefore = pruneCluster._map.getZoom();
          var zoomLevelAfter = pruneCluster._map.getBoundsZoom(bounds, false, new L.Point(20, 20, null));

          // If the zoom level doesn't change
          if (zoomLevelAfter === zoomLevelBefore) {
            // Send an event for the LeafletSpiderfier
            pruneCluster._map.fire('overlappingmarkers', {
              cluster: pruneCluster,
              markers: markersArea,
              center: m.getLatLng(),
              marker: m
            });

            pruneCluster._map.setView(position, zoomLevelAfter);
          }
          else {
            pruneCluster._map.fitBounds(bounds);
          }
        }
      });
      m.on('mouseover', function() {
        //do mouseover stuff here
      });
      m.on('mouseout', function() {
        //do mouseout stuff here
      });

      return m;
    };
};

Redraw the icons
アイコンを再描画

Marker icon redrawing with a flag:
マーカーアイコンを旗で再描画。

marker.data.forceIconRedraw = true;

...

pruneCluster.ProcessView();

Redraw all the icons:

pruneCluster.RedrawIcons();

Acknowledgements
謝辞

This library was developed in context of the BRIDGE project. It is now supported by the community and we thank the contributors.
このライブラリはBRIDGEプロジェクトの文脈で開発されました。現在はコミュニティによってサポートされており、貢献者に感謝しています。

Licence
ライセンス

The source code of this library is licensed under the MIT License.
このライブラリのソースコードはMITライセンスの下でライセンスされています。

インストール方法

C:\Users\ebata>git clone https://github.com/SINTEF-9012/PruneCluster.git
Cloning into 'PruneCluster'…
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 1054 (delta 3), reused 2 (delta 1), pack-reused 1044
Receiving objects: 100% (1054/1054), 68.39 MiB | 9.96 MiB/s, done.
Resolving deltas: 100% (699/699), done.
Updating files: 100% (54/54), done.

C:\Users\ebata>cd PruneCluster

ここで初めてドキュメントに目を通す。

PruneClusterは、高速でリアルタイムなマーカークラスタリングライブラリです。

Leaflet.markerclusterの代替としてLeafletと連携しています。

このライブラリは、大規模なデータセットやライブ状況向けに設計されています。物理エンジンの衝突検出に着想を得た新しいアルゴリズムのおかげで、メモリ消費量は低く抑えられ、ライブラリはモバイルデバイス上で高速に動作します。
クラスターをリアルタイムで更新することができます。ライブデータセットや、実行時にフィルタリングしたいデータセットに最適です。
各マーカーの重みを指定できます
たとえば、ツイートを表すマーカーよりも、事件を表すマーカーの方が重要度が高い場合があります。
マーカーのカテゴリを指定することができます。そして、各カテゴリのマーカーの数を表す小さなオブジェクトがクラスタに添付されます。このようにして、その内容に合わせたクラスタアイコンを作成することができます。

C:\Users\ebata\PruneCluster\examples>の中にあるサンプルのhtmlの中の座標をいじるだけで、こんなことができました。

https://kobore.net/soft/PruneCluster/examples/toyosu.100.html

このクラスタを無くすには、例えば

var leafletView = new PruneClusterForLeaflet(1,1);  // (120,20)がデフォルト

とかすればいいみたい。

その上で、オブジェクトを1000個に増やしたものが以下になります。

https://kobore.net/soft/PruneCluster/examples/toyosu2.1000.html

以上

2020/09,江端さんの忘備録

今日、部長の許可を得て、久々に社外出張をしております。

Today, with the permission of the general manager, I made a business trip outside the company for a long time.

『一度は、ホワイトボードを使った、技術打ち合わせをしたい』という先方のご要求に因るものですが、私も同意できました。

Due to the partner company's request, "I'd like to have a technical meeting at least once, using a whiteboard," I agreed with them.

リモート会議のツール(アプリ等)は、日々精錬され続けており、そして、私たちもリモート会議に慣れつつあります。

Remote conferencing tools (e.g. apps) are being refined every day, and we are getting used to them.

良いことだと思います。

I think it's a good thing.

-----

今回出張するに際して、改めて気がついたのですが、たった1時間の打ち合わせの為に、

When I went on this business trip, I realized once again. There was a lot to prepare for the meeting, which was only an hour long.

■ビジネスカジュアルに着替えて、

- get dressed in business casual.

■必要な資料をPCに入れて、さらにバックアップ用の印刷をして、

- put the necessary materials into the computer, print out some more backups, and

■電車の時間や天候を調べて

- check the train times and weather.

■熱中症対策の為、徒歩移動を止めてタクシーを使い、

- prevent heat stroke, and stop walking and take a taxi.

■直射日光の中で電車を待ち、

- wait for a train in the direct sun.

■電車の中では、マスクとソーシャルディスタンスを気にし続け、

- keep worrying about my mask and social distances on the train

■移動時間が往復3時間

- three-hour round trip.

ここまでで、トータル5時間以上。

So far, more than five hours in total.

これが、リモート会議であれば、準備時間は15分弱です。

If this is a remote meeting, the preparation time is less than 15 minutes.

-----

以前にも申し上げましたが、現時点で、全ての人間や事象について適用可能な「生産性の定義」は存在していません。

As I've said before, there is no "definition of productivity" available for all people and events at this time.

例えば、この5時間の時間には、移動に必要となった、タクシーや鉄道会社の利益も含まれるからです。

For example, this five hours includes the profits of the taxi and train companies.

ただ、この5時間が、「私の利益になっているか?」と言えば、明らかに"No"と言えます。

Have the last five hours benefited me? If you ask me, the answer is clearly "No."

私の仕事は、ドキュメントの作成ができて、プログラム開発ができる環境があれば十分であり、

In my work, it's enough to have an environment where I can create documentation and develop programs.

―― 現時点で、もっとも整備された仕事の環境は、私の部屋

"at the moment, the most organized work environment is my room"

です。

ただ、この夏、コンピュータとエアコンをブンブン回していますので、江端家の電気代は凄いことになっていそうです。

However, we've been using the computer and air conditioner a lot this summer, so the Ebata family's electricity bill is going to be amazing.

(続く)

(To be continued)