Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Maplat - Map technology explanation, for implementation based on Map API other than OpenLayers/maplat-coordinates

Maplat - Map technology explanation, for implementation based on Map API other than OpenLayers/maplat-coordinates

How to transform coordinate systems in Maplat

Code for History

September 12, 2021
Tweet

More Decks by Code for History

Other Decks in Technology

Transcript

  1. - Map technology explanation,
    for implementation based on Map API
    other than OpenLayers
    Kohei Otsuka – Code for History
    1

    View Slide

  2. English explanation
    2

    View Slide

  3. List of terms for understanding
    Maplat principles (coordinates)
    Terms Meaning Accurate map Inaccurate map
    merc EPSG:3857 (Web
    Mercator)
    EPSG:3857 EPSG:3857
    xy XY in each coordinate
    system
    EPSG:3857 XY starting point at the
    top left of the image
    (pixel coordinates when
    not scaled)
    sysCoord Convenience
    coordinates for
    processing with the
    map API (coordinates
    used to set up marker
    pins in the original map
    API)
    For OpenLayers,
    EPSG:3857
    For OpenLayers,
    EPSG:3857 for
    convenience (not
    related to actual
    geographic
    coordinates)
    3
    Quote from https://github.com/code4history/MaplatCore/issues/19

    View Slide

  4. List of terms for understanding
    Maplat principles (area)
    Terms Meaning Note
    size Display range in pixel width, height
    radius Display range radius in sysCoord
    definition
    Calculated based on a circle half
    the size of the size, not the
    full ”size” range
    viewPoint Center point + zoom + rotate in sysCoord
    definition
    sysCoord
    s
    5 points in sysCoord definition (center,
    top, bottom, left, right)
    xys 5 points in xy definition
    mercs 5 points in merc definition
    4
    Quote from https://github.com/code4history/MaplatCore/issues/19

    View Slide

  5. Maplat map switching principle 5
    Map coordinates A
    Map coordinates B
    Get center,
    zoom,
    rotate
    viewPoint2SysCoords
    SysCoords xys
    mercs
    Set center,
    zoom,
    rotate
    SysCoords xys
    sysCoords2Xys xys2Mercs
    sysCoords2ViewPoint xys2SysCoords mercs2Xys

    View Slide

  6. How to use several Maplat libraries (1) 6
    Get center,
    zoom,
    rotate
    SysCoords xys
    mercs
    Set center,
    zoom,
    rotate
    SysCoords xys
    sysCoords2Xys xys2Mercs
    xys2SysCoords mercs2Xys
    MaplatCore
    Internally used
    MaplatTin 5 times
    Internally used
    MaplatTin 5 times
    Map coordinates A
    Map coordinates B
    viewPoint2SysCoords
    sysCoords2ViewPoint

    View Slide

  7. Maplat
    MaplatCore
    7
    Foreground map
    OpenLayers
    Background map
    OpenLayers
    Map display control
    Coordinates transformation
    UI
    How to use several Maplat libraries (2)

    View Slide

  8. Maplat
    MaplatCore
    MaplatSwitch
    8
    UI
    Make this process independent
    as MaplatSwitch in the future
    How to use several Maplat libraries (3)
    Foreground map
    OpenLayers
    Background map
    OpenLayers
    Map display control
    Coordinates transformation

    View Slide

  9. How to realize Maplat 9
    Overlay Switch
    ※ If you want to use OpenLayers as a map API, it is already implemented in Maplat/MaplatCore, and
    you can optionally switch between Overlay/Switch, so assume that you want to use other map APIs.
    Foreground map
    Map API
    Background map
    Map API
    Map API
    MaplatCore or
    MaplatSwitch
    Realtime control
    MaplatCore or
    MaplatSwitch
    Coordinates transformation
    Switch displaying map

    View Slide

  10. 日本語説明
    10

    View Slide

  11. Maplat原理理解の用語一覧
    (座標)
    呼称 意味 正確な地図 不正確な地図
    merc EPSG:3857 (Webメルカ
    トル)
    EPSG:3857 EPSG:3857
    xy 各座標系でのXY EPSG:3857 画像左上起点XY (非縮小時
    のピクセル座標)
    sysCoord 地図APIで処理するための
    便宜的座標 (オリジナルの
    地図APIでマーカーピンを
    立てたりする際に使う座
    標)
    OpenLayersの場合は
    EPSG:3857
    OpenLayersの場合は、
    便宜的なEPSG:3857 (実際
    の地理座標とは無関係)
    11
    Quote from https://github.com/code4history/MaplatCore/issues/19

    View Slide

  12. Maplat原理理解の用語一覧
    (領域)
    呼称 意味 備考
    size pixelでの表示範囲 width, height
    radius sysCoord定義での表示範囲半径 sizeの範囲いっぱいいっぱいではな
    く、半分の大きさの円を元に算出
    viewPoint sysCoord定義での中心点+zoom+rotate
    sysCoord
    s
    sysCoord定義での中心点+上下左右4点の5

    xys xy定義での中心点+上下左右4点の5点
    mercs merc定義での中心点+上下左右4点の5点
    12
    Quote from https://github.com/code4history/MaplatCore/issues/19

    View Slide

  13. Maplat地図切り替えの原理 13
    地図座標系A
    地図座標系B
    center,
    zoom,
    rotate
    取得
    viewPoint2SysCoords
    SysCoords xys
    mercs
    center,
    zoom,
    rotate
    設定
    SysCoords xys
    sysCoords2Xys xys2Mercs
    sysCoords2ViewPoint xys2SysCoords mercs2Xys

    View Slide

  14. Maplatライブラリ使い分け (1) 14
    地図座標系A
    地図座標系B
    center,
    zoom,
    rotate
    取得
    viewPoint2SysCoords
    SysCoords xys
    mercs
    center,
    zoom,
    rotate
    設定
    SysCoords xys
    sysCoords2Xys xys2Mercs
    sysCoords2ViewPoint xys2SysCoords mercs2Xys
    MaplatCore
    内部的にMaplatTin
    を5回利用
    内部的にMaplatTin
    を5回利用

    View Slide

  15. Maplat
    MaplatCore
    Maplatライブラリ使い分け (2) 15
    前景地図
    OpenLayers
    背景地図
    OpenLayers
    地図表示制御
    座標系変換処理
    UI

    View Slide

  16. Maplat
    MaplatCore
    MaplatSwitch
    Maplatライブラリ使い分け (3) 16
    前景地図
    OpenLayers
    背景地図
    OpenLayers
    地図表示制御
    座標系変換処理
    UI
    将来的にこの部分をMaplatSwitch
    として分割予定

    View Slide

  17. Maplatの実現方法 17
    Overlay Switch
    ※地図APIとしてOpenLayersを使う場合は、既にMaplat/MaplatCoreで実現されており、
    オプションでOverlay/Switchは切り替えられるので、その他の地図APIを使う場合を想定
    前景地図
    地図API
    背景地図
    地図API
    地図API
    MaplatCore or
    MaplatSwitch
    リアルタイム制御
    MaplatCore or
    MaplatSwitch
    座標など変換
    表示地図切り替え

    View Slide

  18. End
    User: kochizufan
    Github pages: https://code4history.dev/
    E-mail: [email protected]
    18

    View Slide