Skip to content

JIS X 0410 地域メッシュコードの PL/pgSQL 関数

License

Notifications You must be signed in to change notification settings

KotobaMedia/jismesh-plpgsql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JIS X 0410 地域メッシュコードの PL/pgSQL 関数

以前 jismesh-to-sql という地域メッシュコードを 予め生成したテーブルを作成するツールを公開しましたが、こちらは予め生成というより PL/pgSQL で必要のタイミングで 動的に生成する関数集となります。Rust版 を参考に作っています。

使い方

まずは jismesh.sql を読み込ませる。

SELECT meshcode, ST_AsText(geom) as "geom" FROM jismesh.to_meshcodes(
    ST_SetSRID(ST_MakeBox2D(
        ST_MakePoint(139.745433, 35.658581),
        ST_MakePoint(135.759363, 34.987574)
    ), 4326),
    'Lv1'::jismesh.mesh_level
);
 meshcode |                                                            geom
----------+-----------------------------------------------------------------------------------------------------------------------------
     5235 | POLYGON((135 34.666666666666664,136 34.666666666666664,136 35.33333333333333,135 35.33333333333333,135 34.666666666666664))
     5236 | POLYGON((136 34.666666666666664,137 34.666666666666664,137 35.33333333333333,136 35.33333333333333,136 34.666666666666664))
     5237 | POLYGON((137 34.666666666666664,138 34.666666666666664,138 35.33333333333333,137 35.33333333333333,137 34.666666666666664))
     ...

構成

  • jismesh.sql にすべての関数が入っています。
  • jismesh schema に入ります。search_pathを編集しない場合はすべての関数に jismesh. をつけるの忘れないで。
  • 詳しい使い方は tests/*_test.sql を参照してください

About

JIS X 0410 地域メッシュコードの PL/pgSQL 関数

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published