ラベル OpenStreetMap の投稿を表示しています。 すべての投稿を表示
ラベル OpenStreetMap の投稿を表示しています。 すべての投稿を表示

2016年1月31日日曜日

2 - ol3.13ex 148b - OpenStreetMap Reprojection with ScaleLine Control 2

「scaleline-indiana-east.js(2148-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

「2148-ol3ex.js」
proj4.defs('Indiana-East', 'PROJCS["IN83-EF",GEOGCS["LL83",DATUM["NAD83",' +
 'SPHEROID["GRS1980",6378137.000,298.25722210]],PRIMEM["Greenwich",0],' +
 'UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],' +
 'PARAMETER["false_easting",328083.333],' +
 'PARAMETER["false_northing",820208.333],' +
 'PARAMETER["scale_factor",0.999966666667],' +
 'PARAMETER["central_meridian",-85.66666666666670],' +
 'PARAMETER["latitude_of_origin",37.50000000000000],' +
 'UNIT["Foot_US",0.30480060960122]]');
var map = new ol.Map({
 layers: [
  new ol.layer.Tile({
  /** ol.layer.Tile 
   * For layer sources that provide pre-rendered, tiled 
   * images in grids that are organized by zoom levels for 
   * specific resolutions. 
   * プリレンダリング(事前描画)を提供するレイヤソースのため
   * の、特定の解像度でのズームレベルによって編成されているグ
   * リッドのタイルイメージ。(ol3 API)
   */
   source: new ol.source.OSM()
   /** source:
    * Source for this layer. Required.(ol3 API)
    */
   /** ol.source.OSM 
    * Layer source for the OpenStreetMap tile server.
    * OpenStreetMap タイルサーバのレイヤソース。(ol3 API)
    */
  })
 ],
 target: 'map',
 view: new ol.View({
  projection: 'Indiana-East',
  center: ol.proj.fromLonLat([-85.685, 39.891], 'Indiana-East'),
  /** ol.proj.fromLonLat(coordinate, opt_projection)
   * Transforms a coordinate from longitude/latitude to a 
   * different projection.
   * 緯度/経度座標から異なる投影に変換します。(ol3 API)
   */
  zoom: 7,
  extent: ol.proj.transformExtent([-172.54, 23.81, -47.74, 86.46],
   'EPSG:4326', 'Indiana-East'),
  /** ol.proj.transformExtent(extent, source, destination)
   * Transforms an extent from source projection to 
   * destination projection. This returns a new extent 
   * (and does not modify the original).
   * ソース投影から変換先投影へ範囲を変換します。これは、新しい
   * 範囲を返します(オリジナルを変更しません)。(ol3 API)
   */
  minZoom: 6
 })
});
map.addControl(new ol.control.ScaleLine({units: 'us'}));


2 - ol3.13ex 148a - OpenStreetMap Reprojection with ScaleLine Control 1

「OpenStreetMap Reprojection with ScaleLine Control (scaleline-indiana-east.html)」を参考に地図を表示してみます。
説明に次のようにあります。

This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.
この例では、米国の単位で ScaleLine 制御を含む NAD83 indiana East の OpenStreetMap のクライアント側の再投影を示しています。

HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.13.0」->「examples」->「scaleline-indiana-east.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「scaleline-indiana-east.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。




d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「2148-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「scaleline-indiana-east.html」の内容をコピーして「2148-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「2148-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「scaleline-indiana-east.js」の内容をコピーして貼り付け、修正します。「scaleline-indiana-east-require.js」も「2148-ol3ex-require.js」に貼り付けます。

「2148-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-combined.min.css" type="text/css">
  <!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  
  「resources」の位置が変わりました。
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.13.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.13.0/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.13.0/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.13.0/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js"></script>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
  <title>OpenStreetMap Reprojection with ScaleLine 
   Control</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css,
  CSSファイルで設定されたセレクタを使用。
  -->
  <header class="navbar" role="navigation">
   <div class="container" id="navbar-inner-container">
    <!--
    <a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    -->
    <!-- ディレクトリ修正 -->
    <a class="navbar-brand" href="v3.13.0/examples/"><img src="v3.13.0/examples/resources/logo-70x70.png"> OpenLayers 3 Examples</a>
   </div>
  </header>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">OpenStreetMap Reprojection with 
      ScaleLine Control</h4>
      <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Demonstrates client-side reprojection 
      of OpenStreetMap to NAD83 Indiana East.</p>
     <div id="docs"><p>This example shows client-side 
      reprojection of OpenStreetMap to NAD83 Indiana East, 
      including a ScaleLine control with US units.</p>
     </div>
     <div id="api-links">Related API documentation: 
      <ul class="inline">
       <li>
        <!-- <a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a> -->
        <a href="v3.13.0/apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a> -->
        <a href="v3.13.0/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.control.ScaleLine.html" title="API documentation for ol.control.ScaleLine">ol.control.ScaleLine</a> -->
        <a href="v3.13.0/apidoc/ol.control.ScaleLine.html" title="API documentation for ol.control.ScaleLine">ol.control.ScaleLine</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a> -->
        <a href="v3.13.0/apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.proj.html" title="API documentation for ol.proj">ol.proj</a> -->
        <a href="v3.13.0/apidoc/ol.proj.html" title="API documentation for ol.proj">ol.proj</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.OSM.html" title="API documentation for ol.source.OSM">ol.source.OSM</a> -->
        <a href="v3.13.0/apidoc/ol.source.OSM.html" title="API documentation for ol.source.OSM">ol.source.OSM</a>
       </li>
      </ui>
     </div>
    </div>
   </div>
   <div class="row-fluid">
    <div id="source-controls">
     <a id="copy-button">
      <i class="fa fa-clipboard"></i> Copy
     </a>
     <a id="jsfiddle-button">
      <i class="fa fa-jsfiddle"></i> Edit
     </a>
    </div>
    <form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
    <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
   </div>
  </div>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.13.0/examples/resources/common.js"></script>
  <script src="v3.13.0/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=scaleline-indiana-east"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2148-ol3ex"></script>
  </body>
</html>


COMMONJS は

COMMONJS
http://webpack.github.io/docs/commonjs.html

に、次のようにあります。

The CommonJS group defined a module format to solve JavaScript scope issues by making sure each module is executed in its own namespace.
This is achieved by forcing modules to explicitly export those variables it wants to expose to the “universe”, and also by defining those other modules required to properly work.
To achieve this CommonJS give you two tools:
the require() function, which allows to import a given module into the current scope.
the module object, which allows to export something from the current scope.

CommonJSグループは、それ自身の名前空間内で実行されている各モジュールを確認することによって、JavaScriptのスコープ問題を解決するためのモジュールフォーマットを定義しました。
これは、それが「universe(?)」に公開したい変数を明示的にエクスポートするモジュールを強制することによって、同じように、正常に動作するのに必要な他のモジュールを定義することによって、達成されます。
この CommonJS を達成するために2つのツールを与えます:
require()関数、指定したモジュールを現在のスコープにインポートすることができます。
モジュールオブジェクト、現在のスコープからエクスポートすることができます。


Prism は、

Prism
http://prismjs.com/

に、次のようにあります。

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.
Prismは、最新のWeb標準に構築されたことを考慮し軽量で拡張可能なシンタックスハイライトです。それは Dabblet からスピンオフで、何千人も日々そこで試験されています。


ZeroClipboard は

ZeroClipboard v2.x
http://zeroclipboard.org/

に、次のようにあります。

The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
ZeroClipboard ライブラリは、見えない Adobe Flash ムービーとJavaScript のインターフェイスを使用してテキストをクリップボードにコピーする簡単な方法を提供します。

Debian 8 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2015年11月30日月曜日

2 - ol3.11ex 137b - OpenStreetMap reprojection example 2

「reprojection-wgs84.js(2137-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

「2137-ol3ex.js」
var map = new ol.Map({
 layers: [
  new ol.layer.Tile({
  /** ol.layer.Tile 
   * For layer sources that provide pre-rendered, tiled 
   * images in grids that are organized by zoom levels for 
   * specific resolutions. 
   * プリレンダリング(事前描画)を提供するレイヤソースのため
   * の、特定の解像度でのズームレベルによって編成されているグ
   * リッドのタイルイメージ。(ol3 API)
   */
   source: new ol.source.OSM()
   /** ol.source.OSM 
    * Layer source for the OpenStreetMap tile server.
    * OpenStreetMap タイルサーバのレイヤソース。(ol3 API)
    */
  })
 ],
 renderer: common.getRendererFromQueryString(),
// 'common.js' により URL にある renderer を返します
 target: 'map',
 view: new ol.View({
  projection: 'EPSG:4326',
  center: [0, 0],
  zoom: 1
 })
});

2 - ol3.11ex 137a - OpenStreetMap reprojection example 1

「OpenStreetMap reprojection example (reprojection-wgs84.html)」を参考に地図を表示してみます。
説明に次のようにあります。

This example shows client-side reprojection of OpenStreetMap in WGS84.
この例では、WGS84 の OpenStreetMap のクライアント側の再投影を示しています。
HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.11.2」->「examples」->「reprojection-wgs84.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「reprojection-wgs84.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。



d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「2137-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「reprojection-wgs84.html」の内容をコピーして「2137-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「2137-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「reprojection-wgs84.js」の内容をコピーして貼り付け、修正します。「reprojection-wgs84-require.js」も「2137-ol3ex-require.js」に貼り付けます。

「2137-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-combined.min.css" type="text/css">
  <!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  「resources」の位置が変わりました。
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.11.2/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.11.2/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.11.2/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.11.2/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>OpenStreetMap reprojection example</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css,
  CSSファイルで設定されたセレクタを使用。
  -->
  <header class="navbar" role="navigation">
   <div class="container" id="navbar-inner-container">
    <!--
    <a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    -->
    <!-- ディレクトリ修正 -->
    <a class="navbar-brand" href="v3.11.2/examples/"><img src="v3.11.2/examples/resources/logo-70x70.png"> OpenLayers 3 Examples</a>
   </div>
  </header>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">OpenStreetMap reprojection example</h4>
     <p id="shortdesc">Demonstrates client-side reprojection 
       of OpenStreetMap in WGS84.</p>
     <div id="docs"><p>This example shows client-side 
      reprojection of OpenStreetMap in WGS84. </p>
     </div>
     <div id="tags">reprojection, projection, openstreetmap, 
      wgs84, tile</div>
     <div id="api-links">Related API documentation: 
      <ul class="inline">
       <li>
       <!-- <a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a> -->
        <a href="v3.11.2/apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a>
       </li>,
       <li>
       <!-- <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a> -->
        <a href="v3.11.2/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a> -->
        <a href="v3.11.2/apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.OSM.html" title="API documentation for ol.source.OSM">ol.source.OSM</a> -->
        <a href="v3.11.2/apidoc/ol.source.OSM.html" title="API documentation for ol.source.OSM">ol.source.OSM</a>
       </li>
      </ui>
     </div>
   </div>
  </div>
  <div class="row-fluid">
    <div id="source-controls">
     <a id="copy-button">
      <i class="fa fa-clipboard"></i> Copy
     </a>
     <a id="jsfiddle-button">
      <i class="fa fa-jsfiddle"></i> Edit
     </a>
    </div>
    <form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
    <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
   </div>
  </div>
  <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.11.2/examples/resources/common.js"></script>
  <script src="v3.11.2/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=reprojection-wgs84"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2137-ol3ex"></script>
  </body>
</html>


COMMONJS は

COMMONJS
http://webpack.github.io/docs/commonjs.html

に、次のようにあります。

The CommonJS group defined a module format to solve JavaScript scope issues by making sure each module is executed in its own namespace.
This is achieved by forcing modules to explicitly export those variables it wants to expose to the “universe”, and also by defining those other modules required to properly work.
To achieve this CommonJS give you two tools:
the require() function, which allows to import a given module into the current scope.
the module object, which allows to export something from the current scope.

CommonJSグループは、それ自身の名前空間内で実行されている各モジュールを確認することによって、JavaScriptのスコープ問題を解決するためのモジュールフォーマットを定義しました。
これは、それが「universe(?)」に公開したい変数を明示的にエクスポートするモジュールを強制することによって、同じように、正常に動作するのに必要な他のモジュールを定義することによって、達成されます。
この CommonJS を達成するために2つのツールを与えます:
require()関数、指定したモジュールを現在のスコープにインポートすることができます。
モジュールオブジェクト、現在のスコープからエクスポートすることができます。


Prism は、

Prism
http://prismjs.com/

に、次のようにあります。

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.
Prismは、最新のWeb標準に構築されたことを考慮し軽量で拡張可能なシンタックスハイライトです。それは Dabblet からスピンオフで、何千人も日々そこで試験されています。


ZeroClipboard は

ZeroClipboard v2.x
http://zeroclipboard.org/

に、次のようにあります。

The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
ZeroClipboard ライブラリは、見えない Adobe Flash ムービーとJavaScript のインターフェイスを使用してテキストをクリップボードにコピーする簡単な方法を提供します。

Debian 8 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2014年10月30日木曜日

2 - ol3ex 22b - Localized OpenStreetMap example 2

OpenCycleMap と OpenSeaMap は、OpenStreetMap を元に作成された地図です。
日本で、OpenCycleMap は作成されていますが、 OpenSeaMap はありません。(OpenSeaMap は、ドイツ北部の海域をサポートしています。)

OpenCycleMap(http://www.opencyclemap.org/)
OpenCycleMap(http://www.opencyclemap.org/docs/)に次のようにあります。

The OpenCycleMap global cycling map is based on data from the OpenStreetMap project. At low zoom levels it is intended for overviews of national cycling networks; at higher zoom levels it should help with planning which streets to cycle on, where you can park your bike and so on.
OpenCycleMap グローバルサイクリングマップは、OpenStreetMap のプロジェクトのデータに基づいています。低いズームレベルでは、全国のサイクリングネットワークの概要を対象としています。高いズームレベルでは、バイクを駐車できる場所のように、サイクルリング(ツーリング)の行程の計画に役立てることができます。
The map is updated every few days with the latest data from OpenStreetMap. News about OpenCycleMap can be found in the OpenStreetMap archives on my blog.
マップは、OpenStreetMap の最新データで数日ごとに更新されます。 OpenCycleMap についてのニュースは、私のブログで OpenStreetMap のアーカイブで見つけることができます。

OpenSeaMap(http://www.openseamap.org/)
OpenSeaMap Wiki(http://wiki.openstreetmap.org/wiki/OpenSeaMap)に次のようにあります。

History and fundamentals
OpenSeaMap was created in 2009 in response to a great need for freely-accessible seafaring maps. OpenSeaMap's goal is to add nautical and tourism information that would interest sailors OSM, and to present it in a pleasing way. This includes beacons, buoys and other seamarks, port information, repair shops, ship supplies and much more, but also shops, restaurants and places of interest. OpenSeaMap is part of OpenStreetMap and uses its database.
OpenSeaMap は、自由にアクセス可能な船乗り用マップに対する大きな要求に応じて、2009年に作成されました。 OpenSeaMap の目標は、航路や船員のOSMの興味になる観光の情報を追加することと、楽しい方法でそれを提示するです。これはショップ、レストラン、興味のある場所だけでなく、ビーコン、ブイ、他の航路目標、ポート情報、修理工場、船舶用品やさらに多くのものが含まれています。 OpenSeaMap は OpenStreetMap の一部であり、そのデータベースを使用しています。

「222-ol3ex.js」
/** tiles.openseamap.org does not set CORS headers, so we 
 * have to disable crossOrigin and we cannot use WebGL.
 * tiles.openseamap.org は CORS ヘッダを設定していないので、
 * crossOrigin を無効にする必要があり、WebGL を使用するこ
 * とはできません。
 */
var openCycleMapLayer = new ol.layer.Tile({
/** ol.layer.Tile 
 * For layer sources that provide pre-rendered, tiled 
 * images in grids that are organized by zoom levels for 
 * specific resolutions. 
 * プリレンダリング(事前描画)を提供するレイヤソースのための、
 * 特定の解像度でのズームレベルによって編成されているグリッドの
 * タイルイメージ。(ol3 API)
 */
 source: new ol.source.OSM({
 /** ol.source.OSM 
  * Layer source for the OpenStreetMap tile server.
  * OpenStreetMap タイルサーバのレイヤソース。(ol3 API)
  */
  attributions: [
   new ol.Attribution({
   /** ol.Attribution
    * An attribution for a layer source.
    * レイヤソースの属性(ol3 API)
    */
    html: 'All maps &copy; ' +
     '<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
   }),
   ol.source.OSM.DATA_ATTRIBUTION
   // v3.1.0 以降 ol.source.OSM.ATTRIBUTION を使用
  ],
  url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
 })
});
var openSeaMapLayer = new ol.layer.Tile({
 source: new ol.source.OSM({
  attributions: [
   new ol.Attribution({
    html: 'All maps &copy; ' +
     '<a href="http://www.openseamap.org/">OpenSeaMap</a>'
    }),
    ol.source.OSM.DATA_ATTRIBUTION
   // v3.1.0 以降 ol.source.OSM.ATTRIBUTION を使用
  ],
  crossOrigin: null,
  /** crossOrigin
   * The crossOrigin attribute for loaded images. Note 
   * that you must provide a crossOrigin value if you 
   * are using the WebGL renderer or if you want to 
   * access pixel data with the Canvas renderer. See 
   * https://developer.mozilla.org/en-US/docs/Web/HTML/
   * CORS_enabled_image for more detail.
   * ロードされたイメージの crossOrigin属性。WebGLのレンダ
   * ラーを使用している場合、または、キャンバスレンダラでピ
   * クセルデータにアクセスする場合、crossOrigin 値を提供な
   * ければならないことに注意してください。詳細は 
   * https://developer.mozilla.org/en-US/docs/Web/HTML/
   * CORS_enabled_image を参照してください。(ol3 API)
   */
  url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
 })
});
var map = new ol.Map({
 layers: [
  openCycleMapLayer,
  openSeaMapLayer
 ],
 target: 'map',
 controls: ol.control.defaults({
 /** controls
  * Controls initially added to the map. 
  * If not specified, ol.control.defaults() is used.
  * 初期設定で、マップに追加されたコントロール。
  * 明示されていなければ、ol.control.defaults() が使用されます。
  * (ol3 API)
  */
 /** ol.control.defaults()
  * デフォルトでは、マップに含まコントロールのセット。
  * 特に設定しない限り、これは、以下の各コントロールの
  * インスタンスを含むコレクションを返します。(API Doc より)
  * ol.control.Zoom, ol.control.Rotate, ol.control.Attribution
  */
  attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
  /** @type 
   * 値のタイプ(型)の説明 - 式などで表示
   * attributionOptions の値の型は、
   * olx.control.AttributionOptions の型を使用。
   * (@use JSDoc[http://usejsdoc.org/]より)
   */
   collapsible: false // 折りたたみ
  })
 }),
 view: new ol.View({
  maxZoom: 18,
  center: [-244780.24508882355, 5986452.183179816],
  zoom: 15
 })
});
 

2 - ol3ex 22a - Localized OpenStreetMap example 1

「Simple example(localized-openstreetmap.html)」を参考に地図を表示してみます。説明には、

Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.
カスタムタイルサーバとカスタムアトリビューションを使用した、場所を限定した OpenSeaMap マップの例。
The base layer is OpenCycleMap with an overlay from OpenSeaMap. The OpenSeaMap tile server does not support CORS headers.
ベースレイヤは、OpenSeaMap からのオーバーレイを使用した OpenCycleMap です。 OpenSeaMap タイルサーバは、CORS((Cross-Origin Resource Sharing)ブラウザがオリジン(HTMLを読み込んだサーバのこと)以外のサーバからデータを取得する仕組み) ヘッダをサポートしていません。

HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.0.0」->「examples」->「localized-openstreetmap.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「localized-openstreetmap.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。



d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「222-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「localized-openstreetmap.html」の内容をコピーして「222-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「222-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「localized-openstreetmap.js」の内容をコピーして貼り付け、修正します。「localized-openstreetmap-require.js」も「222-ol3ex-require.js」に貼り付けます。


「222-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
  <link rel="stylesheet" href="../resources/layout.css" type="text/css">
  <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
-->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.0.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.0.0/resources/bootstrap/css/bootstrap.min.css" type="text/css">
  <link rel="stylesheet" href="v3.0.0/resources/layout.css" type="text/css">
  <link rel="stylesheet" href="v3.0.0/resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
  <title>Localized OpenStreetMap example</title>
 </head>
 <body>
  <!-- 
  bootstrap.min.css, bootstrap-responsive.min.css で設定されたセレクタを使用。
  -->
  <div class="navbar navbar-inverse navbar-fixed-top">
   <div class="navbar-inner">
    <div class="container">
<!--
     <a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
-->
      <!-- ディレクトリ修正 -->
     <a class="brand" href="v3.0.0/examples/"><img src="v3.0.0/resources/logo.png"> OpenLayers 3 Examples</a>
    </div>
   </div>
  </div>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Localized OpenStreetMap example</h4>
     <p id="shortdesc">Example of a Localized OpenStreetMap with  custom tile server and a custom attribution.</p>
     <div id="docs">
      <p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> 
       with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>. 
       The OpenSeaMap tile server does not support <a href="http://enable-cors.org/">CORS</a> headers.</p>
<!--
      <p>See the <a href="localized-openstreetmap.js" target="_blank">localized-openstreetmap.js source</a> to see how this is done.</p>
-->
       <!-- ファイル修正 -->
      <p>See the <a href="222-ol3ex.js" target="_blank">222-ol3ex.js source</a> to see how this is done.</p>
     </div>
     <div id="tags">cors, localized-openstreetmap, openseamap, openstreetmap</div>
    </div>
   </div>
  </div>
<!--
  <script src="jquery.min.js" type="text/javascript"></script>
  <script src="../resources/example-behaviour.js" type="text/javascript"></script>
-->
  <!-- ディレクトリ修正
   jQuery Minified版と
   example-behaviour.js(Examples用 JSコード[文字コードなど])
  -->
  <script src="v3.0.0/examples/jquery.min.js" type="text/javascript"></script>
  <script src="v3.0.0/resources/example-behaviour.js" type="text/javascript"></script>
<!--
  <script src="loader.js?id=localized-openstreetmap" type="text/javascript"></script>
-->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=222-ol3ex" type="text/javascript"></script>

 </body>
</html>

2014年3月9日日曜日

38 - 外部サービスを利用する 3 - Open Street Map

38-3 Open Street Map
Open Street Map は、クリエーティブコモンズライセンスにしたがって提供されています。クリエーティブコモンズライセンスについては、「cretive commons 表示 - 継承 3.0 非移植 (CC BY-SA 3.0)(https://creativecommons.org/licenses/by-sa/3.0/deed.ja)」を参照してください。使用者は、使用した資料のクレジットの明示と、改変した場合はそれを明示すればフリーに使えます。

OpenLayers の Development Examples の「Basic OSM Example(http://openlayers.org/dev/examples/osm.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(両方とも example フォルダにもありました。)を参考に Open Street Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。

前前章、38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)

a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。

---
<style type="text/css">
/*
 .olControlAttribution { 
  bottom: 0px;
  left: 2px;
  right: inherit;
  width: 400px;
 }
*/
/* マウスポジションを上部に設置 */
 .olControlMousePosition {
  top: 0px;
 }
</style>
---
  layers: [
// ここから追加 (Google Map レイヤは削除)
   new OpenLayers.Layer.OSM(
    {
     isBaselayer: true
   }),
// ここまで
/*
   new OpenLayers.Layer.WMS( "R.Takata Height WMS",
    "http://192.168.1.200:8080/geoserver/wms",
    {
     layers: 'npn:rikuzentakata5m-epsg2452'
    },{
     isBaselayer: true
   }),
*/
---

2013年11月19日火曜日

17 - Open Street Map 4 - スタイリングの確認

17-5 OpenStreetMap スタイリングの確認a 左側の欄の「Layer Preview」をクリックします。





b 「npn:roads」の「OpenLayers」リンクをクリックします。



c 「wms を開く」ダイアログで「ファイルを保存する」を選択しボタンをクリックします。





wms の内容は次のようになっています。

<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" >   <ServiceException>
      The requested Style can not be used with this layer.  The style specifies an attribute of aeroway and the layer is: npn:roads
</ServiceException></ServiceExceptionReport>


osm_roads スタイルの Runway のデータを削除します。
(下記の方法で時間がかかる場合は、osm_roads.sld ファイルを修正してアップロードしてください。)
c 左側の欄の Data -> Styles をクリックします。






d osm_roads をクリックします。





 e <!-- Runways from openstreetmap --> から
<-- end of zoom level b --> までを削除します。
(「roads」の「Default Style」が「osm_roads」であることを確認します。)

f 左側の欄の「Layer Preview」をクリックします。







g 「npn:roads」の「OpenLayers」リンクをクリックします。
「wms を開く」ダイアログで「ファイルを保存する」を選択しボタンをクリックします。

wms の内容は次のようになっています。


<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" >   <ServiceException>
      The requested Style can not be used with this layer.  The style specifies an attribute of highway and the layer is: npn:roads
</ServiceException></ServiceExceptionReport>

osm_roads.sld ファイルのすべての
<NamedLayer> の <Name> を npn:roads にします。<-1
<Rule> の <Name> を npn:roads にします。これは表示に影響はない(?)と思います。<-2
<ogc:Filter> の <ogc:PropertyName> を type にします。<-3

---
<NamedLayer>
 <Name>npn:roads</Name> <-1
  <UserStyle>
   <Title>A boring default style</Title>
   <Abstract>A sample style that just prints out a green line</Abstract>

   <!-- start of zoom level 3 -->

   <FeatureTypeStyle>
    <Rule>
     <Name>npn:roads</Name> <-2
     <Title>freeways- outer zoom level</Title>
     <Abstract>freeways style openstreetmap data</Abstract>
     <ogc:Filter>
      <ogc:Or>
       <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>type</ogc:PropertyName> <-3
        <ogc:Literal>residential</ogc:Literal>
       </ogc:PropertyIsEqualTo>
       <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>type</ogc:PropertyName> <-3
        <ogc:Literal>unclassified</ogc:Literal>
       </ogc:PropertyIsEqualTo>
      </ogc:Or>
     </ogc:Filter>
     <MinScaleDenominator>1000</MinScaleDenominator>
     <MaxScaleDenominator>4000</MaxScaleDenominator>
     <LineSymbolizer>
      <Stroke>
       <CssParameter name="stroke">#f4faf6</CssParameter>
       <CssParameter name="stroke-width">12</CssParameter>
       <CssParameter name="stroke-linejoin">round</CssParameter>
      </Stroke>
     </LineSymbolizer>
     <TextSymbolizer>
      <Label>
       <ogc:PropertyName>name</ogc:PropertyName>
      </Label>
      <Font>
       <CssParameter name="font-size">10</CssParameter>
       <CssParameter name="font-family">Arial</CssParameter>
       <CssParameter name="font-color">#eeeeee</CssParameter>
      </Font>
     <LabelPlacement>
      <LinePlacement>
       <PerpendicularOffset>
         0
       </PerpendicularOffset>
      </LinePlacement>
     </LabelPlacement>
     <Halo>
      <Radius>
       <ogc:Literal>1</ogc:Literal>
      </Radius>
      <Fill>
       <CssParameter name="fill">#f4faf6</CssParameter>
      </Fill>
     </Halo>
     <Fill>
      <CssParameter name="fill">#808080</CssParameter>
     </Fill>
     <VendorOption name="maxDisplacement">50</VendorOption>
     <VendorOption name="labelAllGroup">true</VendorOption>
     <VendorOption name="removeOverlaps">true</VendorOption>
     <VendorOption name="followLine">true</VendorOption>
     <VendorOption name="group">true</VendorOption>
    </TextSymbolizer>
   </Rule>
  </FeatureTypeStyle>
---

roads の type の内容は次の通りです。

user@debian7-vmw:~$ psql osm
psql (9.1.9)
"help" でヘルプを表示します.

osm=> \dt
               リレーションの一覧
 スキーマ |       名前       |    型    | 所有者 
----------+------------------+----------+--------
 public   | geometry_columns | テーブル | user
 public   | roads            | テーブル | user
 public   | spatial_ref_sys  | テーブル | user
(3 行)

osm=> SELECT DISTINCT type FROM roads;
       type      
------------------
_unclassified
<pedestrian>
abandoned
bridleway
bus_guideway
bus_stop
byway
construction
constructions
corridor
crossing
cy[
cycleway
destroyed
disused
elevator
emergency_access
escalator
escape
ferry
footpath
footway
fre
ire
living_street
mini_roundabout
minor
motorway
motorway_link
old_trunk
path
payh
pedestrian
platform
primary
primary_link
proposed
raceway
residential
residential;seco
residential;unc
residential;uncl
rest_area
road
secondary
secondary_link
service
service;road
services
slope
steps
tertiary
tertiary_link
track
traffic_signals
trunk
trunk_link
turning_loop
unclassified
unclassified;re
unclassified;res
undefined
unsurfaced
yellow_line
yes

(END):q

このうち、osm_roads.sld に設定されているものは次の通りです。

residential
unclassified
primary
secondary
tertiary
motorway
trunk


倍率によって、表示できる道路、線の太さ、色が変わるように設定されています。
「Layer Preview」をクリックして「npn:roads」の「OpenLayers」リンクをクリックしてください。
最初の倍率では何も表示されません。
拡大すると表示されるようになります。
(メモリ3個目。表示に時間がかかりました。)

Throw GeoServer a curve (and it will be labeled)
http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/

に説明があります。
これによってラベルが道路に沿って表示されます。

17 - Open Street Map 3 - スタイリングの設定

17-4 OpenStreetMap のスタイリングの設定

GeoServer and OpenStreetMap ページ
http://blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap/

の「Making sense of the data」の「map key」リンクをクリックすると

Map Features-OpenStreetMap Wiki ページ
http://wiki.openstreetmap.org/wiki/Map_Features

が表示されます。
Available languages の「日本語」リンクをクリックします。
Ja:Map Features-OpenStreetMap Wiki ページの「ご注意」内の「Japan tagging」をクリックします。
ここには日本の道路の表示についてかかれています。
GeoServer and OpenStreetMap ページの Styling の 「final SLD」では英国の道路に対応していますが、これを使ってスタイリングします。


1「final SLD」リンクをクリックしてダウンロードします。
2 osm_roadsld.zip を解凍します。

user@debian7-vmw:~/ダウンロード$ unzip osm_roadssld.zip
Archive: osm_roadssld.zip
inflating: osm_roads.sld

3 ログインした GeoServer ページの左側の欄の Data -> Styles をクリックします。





4 Styles ページの「Add a new style」をクリックします。





5 New style ページで

Name: osm_roads
Workspace: npn

と入力します。


6 New style ページの下の方の SLD file の「参照」ボタンをクリックします。


7 「ファイルのアップロード」で osm_roads.sld を選択し「開く」ボタンをクリックします。





8 「Upload...」リンクをクリックします。



9 「Validate」ボタンをクリックします。
次のようなエラーが表示されました。

line 23: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Name'. One of '{"http://www.opengis.net/sld":Symbolizer}' is expected.
line 66: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Halo'. One of '{"http://www.opengis.net/sld":VendorOption}' is expected.
---

h GeoServer and OpenStreetMap ページ
http://blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap/

のコメントと

Throw GeoServer a curve (and it will be labeled)ページ
http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/

を参考に、osm_roads をつぎのように修正します。
該当するすべての <FeatureTypeStyle> で

---
<FeatureTypeStyle>
 <Rule>  
  <Name>topp:planet_osm_line</Name>
  <Title>freeways- outer zoom level</Title>
  <Abstract>freeways style openstreetmap data</Abstract>  
  <ogc:Filter>
   <ogc:Or>
    <ogc:PropertyIsEqualTo>
     <ogc:PropertyName>highway</ogc:PropertyName>
     <ogc:Literal>residential</ogc:Literal>
    </ogc:PropertyIsEqualTo>
    <ogc:PropertyIsEqualTo>
     <ogc:PropertyName>highway</ogc:PropertyName>
     <ogc:Literal>unclassified</ogc:Literal>
    </ogc:PropertyIsEqualTo>
   </ogc:Or>
  </ogc:Filter>
  <!-- Min および MaxScaleDenominator を LineSymbolizer の直前に Property(type) によって値が違うので一つずつ修正してください -->
  <MinScaleDenominator>1000</MinScaleDenominator>
  <MaxScaleDenominator>4000</MaxScaleDenominator>
  <!-- ここまで -->
  <LineSymbolizer>
   <Stroke>
    <CssParameter name="stroke">#f4faf6</CssParameter>
    <CssParameter name="stroke-width">12</CssParameter>
    <CssParameter name="stroke-linejoin">round</CssParameter>
   </Stroke>
  </LineSymbolizer>
  <TextSymbolizer>
   <Label>
    <ogc:PropertyName>name</ogc:PropertyName>
   </Label>   
   <Font>
    <CssParameter name="font-size">10</CssParameter>
    <CssParameter name="font-family">Arial</CssParameter>
    <CssParameter name="font-color">#eeeeee</CssParameter>
   </Font>         
   <LabelPlacement>
    <LinePlacement>
     <PerpendicularOffset>
       0
     </PerpendicularOffset>
    </LinePlacement>
   </LabelPlacement>
   <Halo>   
    <Radius>
     <ogc:Literal>1</ogc:Literal>
    </Radius>
    <Fill>
     <CssParameter name="fill">#f4faf6</CssParameter>
    </Fill>
   </Halo>   
   <Fill>
    <CssParameter name="fill">#808080</CssParameter>
   </Fill>
   <!-- VendorOption を TextSymbolizer 終了タグの直前に -->
   <VendorOption name="maxDisplacement">50</VendorOption>
   <VendorOption name="labelAllGroup">true</VendorOption>
   <VendorOption name="removeOverlaps">true</VendorOption>
   <VendorOption name="followLine">true</VendorOption>
   <VendorOption name="group">true</VendorOption>
    <!-- ここまで -->
  </TextSymbolizer>
 </Rule>
</FeatureTypeStyle>
---

no validation error と表示されたら「submit」ボタンをクリックします。




i 左側の欄の Data -> Layers をクリックします。






j 「osm」の「roads」をクリックします。
k ページ上部の「Publishing」タブをクリックします。
l 「WMS Setting」の「Default Style」を「osm_roads」にします。
(他は変更しません。)

m ページ下部の「Save」ボタンをクリックします。

17 - Open Street Map 2 - GeoServer に登録

17-3 GeoServer に OpenStreetMap のデータを登録
PostGIS データベース "osm" の data store を作成します。
1 左側の欄の「Data」の「Stores」をクリックします。




2 「Add new Store」をクリックします。





3 「PostGIS」をクリックします。





4 Workspace の初期設定は変えずに、Basic Store Info の Name と Description を入力します。

Workspace: npn (変更なし)
Data Source Name: osm
Description: Open Street Map (説明、任意です)
Enabled: チェックする(変更なし)

5 PostGIS データベースの Connection Parameters を指定します。

host: localhost (変更なし)
port: 5432 (変更なし)
database: osm
schema: public (変更なし)
user: user (roads テーブルに接続できるユーザ)
password: ●●●●●●● (user がテーブルに接続するときのパスワード)
Namespace: http://www.myhome.net/npn(固定)
Expose primary keys: チェックしない(変更なし)
max connections: 10 (変更なし、任意です)
min connections: 1 (変更なし、任意です)
fetch size: 1000 (変更なし、任意です)
Connection timeout: 20 (変更なし、任意です)
validate connection: チェックする
Primary key metadata table: (空、変更なし、任意です)
Session startup SQL: (空、変更なし、任意です)
Session close-up SQL: (空、変更なし、任意です)
Loose bbox: チェックする(変更なし)
Estimated extends: チェックする(変更なし)
preparedStatements: チェッしない(変更なし)
Max open prepared statements: 50 (変更なし、任意です)
encode functions:チェッしない(変更なし)

6 「Save」ボタンをクリックします。

「New Layer」画面に追加されたレイヤ一覧が表示されます。
Layer Name: 「roads」 の「Publish」をクリックします。


「Edit Layer」
0 「Create a new data store」から続けて操作しても OK です。
1 左側の欄の「Data」の「Layers」をクリックします。



2 「Add a new resource」をクリックします。





3 「New Layer」の「Add a new layer」の「Add layer from」ドロップダウンから「npn:osm」を選択します。
4 OSM store のリソース(レイヤ)のリストが表示されます。
「roads」の「Publish」をクリックします。

5 選択したレイヤのリソースと編集した情報の設定をします。

「Basic Resource Info」を入力します。
Name: roads (変更なし)
Title: Roads (最初の文字を大文字に変更 任意)
Abstract: Open Street Map Roads (任意)

「Keywords」を入力します。
(Keyword に属性が追加できます。「言語」と「Vocabulary」です。)
Current Keywords: (追加したキーワードが表示されます)
New Keyword: 道路, osm, Open Street Map(右欄のリストから「日本語」を選択 任意)
(1つずつ入力して「Add Keyword」ボタンをクリック)
Vocabulary: category(道路)(任意)

「Metadata links」は変更しません。

「Coordinate Reference Systems」を入力します。
Native SRS: 空(変更なし)
Declared SRS: EPSG:4326 (「Find」ボタンをクリックして「4326」を検索して表示された「4326」をクリック)
SRS handling: Force declared (変更しない)

6 「Bounding Boxes」を入力します。
Native Bounding Box: (「Compute from data」をクリック -以下の値が入力されました)
Min X: 127.76203918457
Min Y: 26.709924697876
Max X: 146.834716796875
Max Y: 44.986759185791
Lat/Lon Bounding Box: (「Compute from native bounds」をクリック -以下の値が入力されました)
Min X: 127.76203918457
Min Y: 26.709924697876
Max X: 146.834716796875
Max Y: 44.986759185791

7 ページ上部の「Publishing」タブをクリックします。


8 「WMS Settings」の「Default Style」を「simple_roads」にします。
(他は変更しません。)



 9 ページ下部の「Save」ボタンをクリックします。

「Layer」ページの一番下に「roads」が追加されます。

「Preview the Layer」
1 左側の欄の「Layer Preview」をクリックし、「roads」を検索します。




2 Common Formats 列の「OpenLayers」をクリックします。


3 成功すれば、OpenLayers Map がポリゴンで表示されます。
(データが大きいので私は表示できませんでした。3目盛り拡大すると表示されるかもしれません。)