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

2014年3月31日月曜日

40 - TinyOWS 2 - XML ファイルを使った設定

40-2 XML ファイルを使った設定
「Configuring TinyOWS with an XML File(http://mapserver.org/trunk/tinyows/configfile.html)」
TinyOWS を設定する最も簡単な方法は、tinyows.xml ファイルを使います。
パスの初期設定は、/etc/tinyows.xml です。TINYOWS_CONFIG_FILE 環境設定で、独自のパス設定ができます。

40-2-1 設定ファイルの例
「Configuration file simple Example」
demo ディレクトリに tinyows.xml という設定ファイルの例があります。これを /etc ディレクトリにコピーします。
<tinyows online_resource="http://127.0.0.1/cgi-bin/tinyows"
         schema_dir="/usr/local/share/tinyows/schema/">

  <pg host="127.0.0.1" user="postgres" password="postgres" dbname="tinyows_demo" port="5432"/>

  <metadata name="TinyOWS Server"
            title="TinyOWS Server - Demo Service" />

  <layer retrievable="1"
         writable="1"
         ns_prefix="tows"
         ns_uri="http://www.tinyows.org/"
         name="world"
         title="World Administrative Boundaries" />

  <layer retrievable="1"
         writable="1"
         ns_prefix="tows"
         ns_uri="http://www.tinyows.org/"
         name="france"
         title="French Administrative Sub Boundaries (IGN - GeoFLA Departements)" />

</tinyows>


40-2-2 設定ファイルのテスト
「Testing your config.xml file」
次のコマンドで、設定ファイルのテストをします。

user@debian7-vmw:~/tinyows-1.1.0$ ./tinyows --check
Content-Type: application/xml

<?xml version='1.0' encoding='UTF-8'?>
<ows:ExceptionReport
 xmlns='http://www.opengis.net/ows'
 xmlns:ows='http://www.opengis.net/ows'
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xsi:schemaLocation='http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd'
 version='1.1.0' language='en'>
 <ows:Exception exceptionCode='ConnectionFailed' locator='init_OWS'>
  <ows:ExceptionText>Connection to database failed</ows:ExceptionText>
 </ows:Exception>
</ows:ExceptionReport>


データベースに接続できませんでした。
ログを出力するように tinyows.xml の内容に次のように追加します。

<tinyows online_resource="http://127.0.0.1/cgi-bin/tinyows"
         schema_dir="/usr/local/share/tinyows/schema/"
         log="/var/log/tinyows.log"
         log_level="15">
---


上記コマンドを実行します。ログをみると、

user@debian7-vmw:~/tinyows-1.1.0$ vim /var/log/tinyows.log 
[Wed Mar 19 20:32:27 2014] [EVENT] == TINYOWS STARTUP ==
[Wed Mar 19 20:32:27 2014] [ERROR] FATAL:  ???"postgres"???????????????
FATAL:  ???"postgres"???????????????

[Wed Mar 19 20:32:27 2014] [ERROR] Connection to database failed
[Wed Mar 19 20:32:27 2014] [EVENT] == TINYOWS SHUTDOWN ==


postgres ユーザで接続できないのを解決できなかったので、一般ユーザで接続できるようにします。

root@debian7-vmw:~# vim /etc/tinyows.xml
---
  <pg host="127.0.0.1" user="user" password="password" dbname="tinyows_demo" port="5432"/>
---


user@debian7-vmw:~/tinyows-1.1.0$ su - postgres
パスワード:
postgres@debian7-vmw:~$ psql tinyows_demo 
psql (9.1.12)
"help" でヘルプを表示します.

tinyows_demo=# \d

                  リレーションの一覧
 スキーマ |       名前        |     型     |  所有者  
----------+-------------------+------------+----------
 public   | france            | テーブル   | postgres
 public   | france_gid_seq    | シーケンス | postgres
 public   | geography_columns | ビュー     | postgres
 public   | geometry_columns  | テーブル   | postgres
 public   | spatial_ref_sys   | テーブル   | postgres
 public   | world             | テーブル   | postgres
 public   | world_gid_seq     | シーケンス | postgres
(7 行)


tinyows_demo=# ALTER VIEW geography_columns OWNER TO user;
ALTER VIEW
tinyows_demo=# ALTER TABLE geometry_columns OWNER TO user;
ALTER TABLE
tinyows_demo=# ALTER TABLE spatial_ref_sys OWNER TO user;
ALTER TABLE
tinyows_demo=# ALTER TABLE france OWNER TO user;
ALTER TABLE
tinyows_demo=# ALTER TABLE world OWNER TO user;
ALTER TABLE
tinyows_demo=# ALTER SEQUENCE france_gid_seq OWNER TO user;
ALTER SEQUENCE
tinyows_demo=# ALTER SEQUENCE world_gid_seq OWNER TO user;
ALTER SEQUENCE
tinyows_demo=# \d

                 リレーションの一覧
 スキーマ |       名前        |     型     | 所有者 
----------+-------------------+------------+--------
 public   | france            | テーブル   | user
 public   | france_gid_seq    | シーケンス | user
 public   | geography_columns | ビュー     | user
 public   | geometry_columns  | テーブル   | user
 public   | spatial_ref_sys   | テーブル   | user
 public   | world             | テーブル   | user
 public   | world_gid_seq     | シーケンス | user
(7 行)

tinyows_demo=# \q

user@debian7-vmw:~/tinyows-1.1.0$ ./tinyows --check
TinyOWS version:   1.1.0
FCGI support:      No
Config File Path:  /etc/tinyows.xml (TinyOWS XML)
PostGIS Version:   1.5.3
PostGIS dsn:       host=127.0.0.1 user=user password=password dbname=tinyows_demo port=5432 
Output Encoding:   UTF-8
Database Encoding: UTF8
Schema dir:        /usr/local/share/tinyows/schema/
Log file:          /var/log/tinyows.log
Log level:         ERROR EVENT QUERY SQL
Display bbox:      Yes
Estimated extent:  No
Check schema:      Yes
Check valid geoms: Yes
Available layers:
 - public.world (4326) -> tows:world [RW]
 - public.france (27582) -> tows:france [RW]

2013年11月5日火曜日

4 - Debian7 の設定

ここでは、自分用にこんな設定をしました、というものをまとめてみました。

4-1 「パネル」によく使うソフトを追加
「アプリケーション」メニューをクリックして「インターネット」 -> 「iceweasel ウェブブラウザ」のアイコンを「パネル(デスクトップの上部の黒い帯)」にドラッグアンドドロップします。

4-2 効果音をつける
a Synapticパッケージマネージャで gnome-audio をインストール。
b 効果音がならないので Synapticパッケージマネージャで次のパッケージをインストール。

esound-common

4-3 iceweasel(FireFox)のアドオン
iceweasel(FireFox)を使いやすくするために次のアドオンをインストールしました。

Searchbar Autosizer: 検索ボックスが文字に合わせて広がります。
Firebug: JavaScript 解析ツール。

アドオンのインストールは、ツール -> アドオン をクリックして検索します。
iceweasel(FireFox)のバージョンがアドオンに対応していないときはバージョン履歴から対応するバージョンのものを選択してください。


4-4 スクリーンショット
ショートカットキーの登録
MacBook に Print ボタンがないのでショートカットキーを登録します。
アプリケーション -> システムツール -> 設定 -> システム設定 をクリック。


「キーボード」 をダブルクリック。







「ショートカット」タブをクリック。
「スクリーンショット」の「スクリーンショットを撮る」の「ショートカット」を「F12」に、「ウィンドウのスクリーンショットを撮る」の「ショートカット」を「Alt+F12」にします。
画像は「画像」フォルダに保存されます。

(「操作」の項目をクリックすると「ショートカット」が「新しいアクセラレータ. 」に換わるので変更したいキーを押します。)

4-5 Windows7共有
(後で VMware Player の共有を使うようにします。)
場所 -> サーバへ接続 をクリック。







「サーバーへ接続」ウィンドウで、

サーバー情報
サーバー名:Windows のコンピュータ名
種類:Windows共有

「接続する」ボタンをクリック。


ドメイン:Windows で設定したもの(何もしていなければ WORKGROUP になっているはず。)ユーザー名:Windows の一般ユーザー名(PC を自分しか使わないのでDebian と Windows のユーザー名とパスワードを同じにしておきました。)
パスワード:Windows の一般ユーザーのパスワード

を入力し、「続行」ボタンをクリック。




2011年4月17日日曜日

7 ka-map 3 - 設定

7-3 ka-Map の設定(config.php など)
ka-Map 設定ファイル の config.php の修正の前に次の操作をします。
ka-map/include ディレクトリに config.dist.php ファイルがあるので、同じディレクトリにconfig.php という名前でコピーします。

~/mapsite$ cp ka-map/include/config.dist.php ka-map/include/config.php

ライブラリポインタの設定 の通りに config.php を修正していきます。
(vimなどエディタを使い慣れていない人は、使い慣れた操作ができるテキスト・エディタで起動します。
アプリケーション−アクセサリ−テキスト・エディタ [一般ユーザでOK])

$szPHPMapScriptModule = 'php_mapscript_46.'.PHP_SHLIB_SUFFIX;
->$szPHPMapScriptModule = 'php_mapscript.'.PHP_SHLIB_SUFFIX;

他は修正しません。
gmap の部分はつぎのようにすべてコメントアウトします。
/* $aszGMap = array (
 *        'title' => 'GMap 75',
 *        'path' => '../../gmap/htdocs/gmap75.map',
 *        'scales' => array( 40000000, 25000000, 12000000, 7500000, 3000000, 1000000 ),
 *        'format' =>'PNG'
 *         Sample authorized_users entry. See auth.php for more details:
 *          ,'authorized_users' => array('popplace' => array('user1', 'user2'),
 *                                       'park'     => array('user1')
 *         
 *);
 */

global.map 用に次のように追加します。
userは自分の環境に合わせて換えます。
 $aszWeather = array(
         'title' => 'Global Weather',
         'path' => '/home/user/mapfile/global.map',
         'scales' => array( 100000000, 50000000, 15000000 ),
         'format' => 'PNG'
 );

$aszMapFiles を次のように修正します。
 $aszMapFiles = array( /* 'gmap' => $aszGMap */
               'weather' => $aszWeather

/* Add more elements to this array to offer multiple mapfiles */

);

$szMap を次のように修正します。
/* $szMap = 'gmap'; */
$szMap = 'weather';

$szBaseCacheDir(画像一時保存フォルダ)を次のように修正します。
$szBaseCacheDir = "/tmp/kacache/";
-> $szBaseCacheDir = "/home/user/mapsite/ms_tmp/kacache/";

ka-Mapはパーミッションに問題なければ画像一保存フォルダを自動的に作成します。
また、マップファイルの IMAGEPATH や IMAGURL が正しくなくても地図を表示します。
地図の表示が成功した後、もう一度設定を確認してください。

続く ...

2009年10月21日水曜日

OpenLayers 21d FeatureServer configration ファイル

featureserver-1.12/featureserver.cfg ファイルを次の様に修正します。

# Metadata section allows you to define the default
# service type to be created, and location for error logging
[metadata]
default_service=JSON
# error_log=error.log
error_log=/home/user/workspace/openlayersTokyoproj/featureserver-1.12/trunk/error.log

# each additional section is a 'layer', which can be accessed.
# see DataSources.txt for more info on configuring.
[scribble]
type=DBM
# file=/tmp/featureserver.scribble
file=/home/user/fs_tmp/featureserver.scribble
gaping_security_hole=yes


#shapefile 1
[railroad]
type=OGR
dsn=/home/user/mapdata/tokyo/N02-08_EB02.shp
layer=N02-08_EB02

#shapefile 2
[river]
type=OGR
dsn=/home/user/mapdata/tokyo_bmi/WL.shp
layer=suigaisen

#postgis layer 1
[gyoseisen]
type=PostGIS
dsn=host=localhost dbname=tokyo_bmi user=user password=balanced
layer=gyoseisen
fid=gid
geometry=the_geom
srid=-1

#postgis layer 2
[gyoseikai]
type=PostGIS
dsn=host=localhost dbname=tokyo user=user password=balanced
layer=gyoseikai
fid=gid
geometry=the_geom
srid=-1

#open street map
[osm]
type=OSM
osmxapi=no

#flickr
[flickr]
type=Flickr
user_id=12345678@N09
#ダミーです。
#tags=newyork

#twitter
[twitter]
type=Twitter
username=anytwitteruser
#twitter のユーザID

2009年10月19日月曜日

OpenLayers 21b OpenLayers を使った FeatureServer のデモ

最初に確認することは、scribble レイヤにアクセスし gml を取得するため、次の様にタイプします:

http://localhost/featureserver112/featureserver.cgi/scribble/all.gml

まだデモアプリケーションを使用しない限り、空の WFS:FeatureCollectionツリーが取得されます。

次に、featureserver-1.12 にある index.html ファイルをみてください。

http://localhost/featureserver112/

次のようなエラーメッセージ

Your browser does not support vector rendering. Currently supported renderers are:
SVG
VML



が表示された場合は featureserver-1.12/index.html の次のコードを修正してください。

---
<!--
<script src="http://openlayers.org/api/2.5-rc5/OpenLayers.js"></script>
-->
<script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
---

ベクトル図をいくつか追加してから再度レイヤのGML(またはJSONまたはGeoJSONまたはatomまたは他のすべてのもの)を取得することを試します。

http://localhost/featureserver112/featureserver.cgi/scribble/all.gml

上記の例では、データのある WFS:FeatureCollection ツリーが取得されます。
上記 URL の gml(format) の部分を JSON など他の形式に変えると出力されるデータの形式が変わります。
all(id)の部分は feature の id を指定します。all は feature がすべて出力されます。
URL をクエリパラメタでフィルタができます。
詳しくは、featureserver-1.12/doc/Querying.txt を参照してください。

FeatureServer はデモのデータを curl を使って編集できます。

curl は、各種プロトコルを使用しているサーバからファイルを取得するためのクライアントプログラムです。コマンドは、ユーザがマシンと一切対話しなくても済むように設計されています。 (Debian curl パッケージサイトから引用。)

Synaptic パッケージマネージャでインストールします。

フィーチャ(id = 2)を削除し、再度挿入してみます。

削除する前に、JSONにフィーチャを保存します(ブラウザのアドレスに入力):

http://localhost/featureserver112/featureserver.cgi/scribble/2.json

表示されたデータを "2.json" というファイル名でホームディレクトリに保存します。
削除します:

user@debian:~$ curl -X DELETE http://localhost/featureserver112/featureserver.cgi/scribble/2.json
{"features": []}

FeatureServer Demo ページの 「GML」や「Edit JSON」リンクをクリックして削除されていることを確認します。
ブラウザの「戻る」ボタンで Demo ページに戻ります。

再挿入します:

user@debian:~$ curl -d @2.json http://localhost/featureserver112/featureserver.cgi/scribble/create.json
{"features": [{"geometry": {"type": "Polygon", "coordinates": [[[17.578125, 54.4921875], [-5.625, 21.4453125], [35.15625, 16.5234375], [17.578125, 54.4921875]]]}, "id": 5, "properties": {"strokeColor": "red", "title": "Feature 4", "author": "Your Name Here"}}]}