Supplementation: SVG Map data divided into mosaic tegular

This page is English Version of the Japanese article of this blog.

In the explanation of SVG Map data divided into mosaic tegular, all tiles were assumed to be an equal size for the simplification. However, the arrangement of the tile can be arbitrarily specified in SVG Map according to the (x,y,width,height) attributes of the image element of the container file. Therefore, an individual tile need not be an equal size.
#Please refer to this article about the compare with other architectures.

The figure below is an appearance of the tile division of the coast lines data of Japan used with Tiny SVG Base Map content.
URL of the container is the following.
http://www.svg-map.org/svg/basemaps/GMapJpz/jpCoast.dbf.svgz
Because all contents of Tiny SVG Base Map are static files, you might understand the dividing mechanism by reading the source code.

Rtile

Embedded metadata

This page is English Version of the Japanese article of this blog.

There are use cases of storing the metadata (or semantics) excluding drawing in the SVG Map data, and doing processing that uses it. These processing corresponds to the processing done with GIS in general. Needless to say, the conspicuous processing of GIS is mapping of geospatial information.

Here, the object of the metadata might have the case of the entire document and the case of an individual graphics primitive in the document.

There is a geographic coordinates reference system description of SVG as an example of the former. The method of putting information described by RDF/XML in the metadata element right under the svg element is used as the notation.

And, the method similar to the former can be adopted for latter metadata. (However, it will use xlink to specify an individual graphics primitive. ) (Reference information) In addition, there is a method of storing the metadata of RDF/XML by setting up the metadata element as a child element of each graphics primitive, too. However, these methods are disadvantageous in the storage efficiency of data and processing efficiency of the viewer.
On the other hand, it seems that the microformats-like method of setting up metadata in each graphics primitives as attributes is effective in this viewpoint. (Reference information) This method doesn't violate the recommended specification of SVG, though this method doesn't conform to the notation of RDF/XML.
Especially, the following advantages are pointed out for processing efficiency.

  • Connection processing of separating information is unnecessary in the processing stage, because neither the graphics primitive nor metadata are separate in the document.
  • The optimization of the processing performance is easy, because the assumption of the insertion of an unspecified data structure (There are metadata structure below < metadata > elements. ) in individual graphics primitives is unnecessary.
  • It is easy to set the style to an individual figure based on metadata, by a simple tool such as text editors. (Of course, it is also possible to use XSLT. )
  • # Please refer to this article about the advantage of a storage efficiency side.

Moreover, the utilities of simple techniques such as microformats and GRDDL are acknowledged.
The SVG Map consortium will support metadata by this simple method by occasion of above.

Specification for embedment of metadata in individual graphics primitives

  • Metadata can be set up in each graphics primitive as attributes.
  • The data structure by corresponding RDF is as follows.
    <graphicsPrimitiveName id="ID" attributeName="attributeValue" .../>
    ==
    [ID]:(subject) -- attributeName:(predicate) --> [attributeValue]:(object)
    It is likely to be declared at the same time as follows.
    [ID]:(subject) -- rdf:type:(predicate) --> [graphicsPrimitiveName]:(object)
  • It is necessary to declare the namespace to the metadata's attribute respectively.
  • The attribute based on two or more vocabularies can be set by declaring two or more namespaces.
  • Literal (character string and numerical value, etc.) and resources (URL,URI) can be used as a property value. The limitation of the value is assumed to be dependence on the schema (RDF Schema is assumed as it. ) specified for a namespace declaration.
  • Two or more property values can be given to one attribute by using the comma separated value.
  • In the graphics primitive to which metadata is set, it is desirable that the id attribute is set. (When it is not set, it might be considered an anonymous node in the data structure of RDF. )

    Example:
     <svg  xmlns="http://www.w3.org/2000/svg"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
      <path id="t1"
          foaf:nick="O-BUILDNG"
          rdf:type="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing"
          dc:title="OOX company building"
          stroke="green" d="....." />
     </svg>

The extension which realizes a free zooming map

This page is English Version of the Japanese article of this blog.

SVG is vector graphics data which can be expanded and contracted without a degradation of a rendition. However, since the same data is only expanded and contracted, an information content does not change following it. On the other hand, in digital map application, the functionality to change the information content displayed with expansion and contraction is often offered.

There may be general-purpose functionality which can control the visibility of each graphics primitive according to the scaling factor of a view to realize this functionality. It seems that it is pended for the moment although the specifications which realize this were examined in the disputation stage of SVG1.2 temporarily (source). Then, the SVG Map consortium considered that this functionality was indispensable in a Web map services, and was made to extend as SVG Map Profile.

Property to extend  :   figure-visibility
The property which sets the parameter for controlling the visibility according to a view scale to a graphics primitive 
The target containing element: Basic Shapes, <path>, <text>, <use>, <g>, <image>, <animation>

Format  :   figure-visibility="[minimum scale], [maximum scale]"
When a view scale is between A and B, the graphics primitive is displayed.
# Definition of a view scale
100x ([Length in the screen-coordinates system of the graphic] / [Length in the SVG coordinate system of the graphic]) [%]

Name space  :   The specifications extended as SVG Map Profile are embedded to a SVG data using Namespaces in XML specifications.
Namespace URL for SVG Map Profile  :   http://purl.org/svgmap/profile
Recommend prefix :   go

Example :
 <svg ... xmlns:go="http://purl.org/svgmap/profile">
  ....
  <circle cy="100" cy="100" go:figure-visibility="100,200"/>
 </svg>
A circle graphic is displayed between the scaling factors 1. to 2..

Figvis

The viewer which reads a map dynamically according to a view scaling factor

The mechanism which reads map data dynamically according to a view scaling factor is realized by extending the implementation requirements specification 2 of "SVG Map data divided into mosaic tegular" based on this extension.

The implementation requirements specification of a viewer
When this property is organized in the <image> (or <animation>) element, the map services which obtains map data dynamically according to a scale is constructed.
When the <image> element enters into the scaling-factor span which should be displayed, the viewer must implement at least the logic which obtains dynamically the graphics data which the <image> element is referring to.

Example:   Please refer to the map data (http://www.svg-map.org/svg/basemaps/worldMapZ.svg) introduced by "Tiny SVG Base Map Content".

SVG Map data divided into mosaic tegular

This page is English Version of the Japanese article of this blog.

This specifications offers format and processing method for SVG Map data divided into mosaic tegular

Free scrolling map services are provided by a lot of Web Map services including google Maps. The technology that achieves it will be classified into two.
One is a type that dynamically generates the map corresponding to the display area of the user agent from the geospatial data base. Its specifications are provided for as a open and standard like WMS. However, it tends to become heavy because of dynamic map generation process. (See also an article of NASA's OnEarth)
On the other hand, there are type that displays the data divided into mosaic tegular prepared beforehand after clipping and sticking together. This method is advantageous for making to higher performance.  In addition, it is advantageous also for the simplification and the lowering the cost of the server. It might be also possible to serve by ordinary httpd without DBMS and dynamic data generation. Therefore, many of services of the map on Web uses this kind of method. However, this method tends to be hard coded and is made for exclusive use at each services. Because a desirable segmentation methodology of the map tile and the access method to it might be different at each service, and the mechanism was achieved by exclusive ECMA SCRIPT program, and it becomes hard code and proprietary so far.

Then, SVG Map profile offers an open latter mechanism by securing the freedom of the segmentation methodology and generalizing the access method. And it is also possible to apply former method like WMS because the access method is ordinary HTTP.
This mechanism is achieved by applying a basic specification of SVG. It explains the method of achieving it as follows.

SVG Map data divided into mosaic tegular

The map tile files will be synthesized to one map with the SVG file that settles them as shown in figure. Thus, the SVG file that importing of other files and settles is called container SVG file.

Tile2_3

Here, the function for importing of the file is achieved by <image> element that SVG originally has. Example of container SVG file is shown as follows. The storage structure of each tile is free according to URL. The arrangement place of each tile is also free according to the (x,y,width,
height) attribute. However, it is necessary to describe the arrangement of all tiles into the container SVG file.

Container.svg

<svg ... viewBox="20 110 120 85">
<metadata ... />
<image   x="0"   y="0" width="100" height="70" xlink:href="0_0.svg"/>
<image x="100"   y="0" width="100" height="70" xlink:href="1_0.svg"/>
<image x="200"   y="0" width="100" height="70" xlink:href="2_0.svg"/>
<image   x="0"  y="70" width="100" height="70" xlink:href="0_1.svg"/>
<image x="100"  y="70" width="100" height="70" xlink:href="1_1.svg"/>
<image x="200"  y="70" width="100" height="70" xlink:href="2_1.svg"/>
<image   x="0" y="140" width="100" height="70" xlink:href="0_2.svg"/>
<image x="100" y="140" width="100" height="70" xlink:href="1_2.svg"/>
<image x="200" y="140" width="100" height="70" xlink:href="2_2.svg"/>
</svg>

It is possible to display it by sticking the map tile together by such a description according to an original SVG specification. Moreover, the segmentation methodology of the tile is considerably free. That is, the map where tiling was done can be displayed within the range of the original SVG specification for which W3C provides.

Note 1:  However, this is a story in the specification. It actually depends on the content of the viewer implementation. For instance, because svg cannot be referred in < image > element in the SVG viewer of Firefox at present yet, the tiling of SVG cannot be done. (If the tiles are jpeg, it seems to be able to do it. )
Note 2: Even as for hyper-layering that is the function for the main interoperability of SVG Map, container SVG file is important. In tiling, the importing data is arranged. On the other hand, they are piled up in hyper-layering. There are no changes in importing and the display of two or more data.

Implementation specification of viewer
The specification on the viewer side as the SVG Map profile is newly provided.

Requirement 1: First of all, the viewer in accordance with the SVG Map profile should be able to do the importing the SVG files by <image> element.

When the SVG viewer not devised reads container SVG, all the tile data to which the image element refers might try to be downloaded. The problem might be not brought up to the operation of the viewer because there are only nine pieces in the example above. However, a serious problem might occur for data from which is divided into 100x100 tiles for instance. Then the SVG Map viewer should have the following logics corresponding to the above-mentioned container SVG data.

Requirement 2: The viewer in accordance with SVG Map profile should be implementd the following logic at least.
When the area of <image> element (It is specified with w, y, width, and height property ) of the SVG document comes in contact with the view box of the viewer, the data to which <image> element refers are dynamically acquired.

It explains the mechanism in the following figure. [Explanatory drawing of display logic(swf animation)]
Green tiles are tile data that should be loaded.

  • First, because viewBox of the container is "20  110  120  85", lower left four files (0_1.svg, 1_1.svg, 0_2.svg, 1_2.svg) are acquired.
  • Here, it is assumed that the user did scrolling in an upper right direction. Then, the view box of the viewer moves. As a result, (0_0.svg,1_0.svg) and (2_0.svg,2_1.svg) are loaded one after another.
  • Yellow tiles are the data that became unnecessary because it came off from viewBox though loaded once. It depends on the viewer implementation whether maintains as long as the memory permits or throws.

Note: Only by this specification, when a wide view box where all tiles are displayed is specified, reading all tiles will start. In the article in the future, the explanation of the profile that enables the expansion and the reduced display is scheduled.

Geographic coordinates support

This page is English Version of the Japanese article of this blog.

The most important information of SVG Map data is an information for associating a SVG coordinate and geographic coordinates. It is described as a coordinate reference system (Coordinate Reference System) metadata.

The description rule of a SVG Map profile's coordinate reference system metadata is based on SVG1.1 specifications (Geographic Coordinate Systems).
However, in order to cancel the ambiguity of specifications and to simplify a implementation, the profile who performs a new restriction is defined.
A SVG Map profile's data must have a coordinate reference system metadata. It must be described by declaration by the following RDF/XML sentences.

  • Coordinate reference system property
    crs:CoordinateReferenceSystem
    A coordinate reference system which this documentation uses is declared
    Domain: SVG contents
    Range: A CRS type instance

    Name space of this property :
    xmlns:crs="http://opengis.org/xmldtds/transformations.dtd"
    This vocabulary is quoted from "Recommended Definition Data for Coordinate Reference Systems and Coordinate Transformations" which OGC recommended in the past.
    .
  • A CRS type instance
    For the moment, only a following CRS type instance is recommended.
    http://purl.org/crs/84

    Generally this resource is called WGS-84.
    However, it is a two-dimensional coordinate system, the first parameter (X) of that is a Longitude and the second parameter (Y) is a Latitude. And the unit is a "degree", respectively.
    This coordinate reference system is equivalent to "CRS:84" (Annex B3) which OGC defined for WMS1.3.0.

    Notes 1: We searched for URIs for
    "CRS:84". However, the appropriate one was not able to be found. Although we barely discovered the URN "urn:ogc:def:crs:OGC:1.3:CRS84", a clear declaration of that was not able to be found out. Then, we decided to organize purl(persistent URL) for "CRS:84".
    .
    Notes 2: On the other hand, "EPSG:4326" is known as one of the coordinate reference systems of WGS-84. However, the first parameter (X) of that is a Latitude and the second parameter (Y) is a Longitude.  That is, "CRS:84" which SVG Map uses has a reverse sequential order of a parameter compared with it.
    .
    Notes 3: purl is URIs which can be accessed by a web browser. The document for "CRS:84" can obtain from this uniform resource locator (http://purl.org/crs/84).
    .
    Restriction of CRS is because it is the advantage that an interoperability can be improved, making the implementation to a user terminal easy by setting CRS to one.  For example, when superimposing two or more maps, it becomes unnecessary to take into consideration the difference in a coordinate reference system as a matter of fact. WGS-84 coordinate system may be used by the geographic information of the majority on an internet. Furthermore, it is also a native coordinate reference system of GPS which many portable terminals are implementing. Consequently, the inconvenience by this restriction will not occur in a majority of applications.
    .
  • A SVG coordinates conversion property
    svg:transform
    The transformation between the coordinate value of a SVG contents and the coordinate value of a geographical coordinate reference system is given.
    Domain:  CRS type instance
    Range:   Text which can be used with a SVG transform property (it is generalizable as an affine transformation parameter)

    The transformation is as follows.
      SVG_X: X coordinate of a SVG data
      SVG_Y: Y coordinate of a SVG data
      Geo_X: The first parameter of geographic coordinates (By restriction of a CRS type instance, it is a Longitude.)
      Geo_Y: The second parameter of geographic coordinates (By the restriction of a CRS type instance, it is a Latitude.)
      a , b , c , d , e , f:  The applicable values of parameters(SVG transform(a,b,c,d,e,f) )

      SVG_X = a * Geo_X + c * Geo_Y + e
      SVG_Y = b * Geo_X + d * Geo_Y + f

    When this properties is not declared, it is considered that that value is matrix (1, 0, 0, 1, 0, 0). 
    .
  • Map projection for SVG Map
    The geographic coordinate transformation property of SVGMap is limited only the first affine transformation. Therefore, the projection that can be used with SVG Map is limited to the equirectangular projection (And, Plate Caree that is the derived form that takes the standard parallel on the equator).
    It is also possible to use the drawing with non-diagonal section of the affine transformation. (It corresponds to a drawing that rotated equirectangular projection. )
    This limitation will offer a practicable drawing in most use cases. However, it might be inconvenient in the map of the high latitude region etc.  However, the function built into beforehand by the rendering system of SVG can be used and because it is a simple linear transformation, implementation on user agent is facilitated. As a result, the scalability (especially, small terminal) will be improved.
    .
  • Example
    <?xml version="1.0" encoding="UTF-8"?>
    <svg xmlns="
    http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <metadata>
      <rdf:RDF
       xmlns:rdf="
    http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:crs="
    http://opengis.org/xmldtds/transformations.dtd"
       xmlns:svg="
    http://www.w3.org/2000/svg">
       <rdf:Description>
        <crs:CoordinateReferenceSystem
         rdf:resource="
    http://purl.org/crs/84"
         svg:transform="matrix(15.3631,0.0,0.0,-18.6994,-1889.2916,849.9202)"/>
       </rdf:Description>
      </rdf:RDF>
    </metadata>
    <circle cx="258.1401" cy="185.1558" r="10.0" stroke="none" fill="green"/>
    </svg>
    In this example, the metadata of the geographic coordinate reference system is expressed in the following RDF graphs in Notation 3.
    <This SVG Document> crs:CoordinateReferenceSystem http://purl.org/crs/84.
    <http://purl.org/crs/84> svg:transform "matrix(15.3631,0.0,0.0,-18.6994,-1889.2916,849.9202)".
    The parameters of the SVG coordinate transformation property are as follows.
    a=15.3631
    b=0.0
    c=0.0
    d=-18.6994
    e=-1889.2916
    f=849.9202
    And, geographic coordinates that correspond to SVG coordinates (258.1401,185.1558) at the center of < circle > figure become as follows.
    258.1401 =  15.3631 * Geo_X - 1889.2916
    185.1558 = -18.6994 * Geo_Y + 849.9202

    Geo_X(Longitude) = 139.7694
    Geo_Y(Latitude) =  35.5500

The index of SVG Map Profile 1.0

This page is English Version of the Japanese article of this blog.

SVG Map profile   1.0 (proposal) 2007.12.19 update

Abstract :
This specification describes the SVG Map profile 1.0.

A SVG Map profile is a profile who realizes the map services which satisfies the requirement indicated separately. Therefore, in spite of being based on SVG1.1Tiny specifications, in order that a SVG Map profile may improve the applicability to a map services, the following restricts and extensions are carried out.

メタデータの埋め込み

 SVG Map形式の地図データにメタデータを埋め込みたいという要望があります。地図に意味情報(セマンティクス)を持たせ、その意味情報を用いた検索や解析などの処理をコンピュータで行うことが可能になるためです。 これらの処理は、一般にGISで行われている処理に相当します。
#もちろんGISの最も特徴的な処理は「図化」すなわち地図表現することなのは言うまでもありません

 ここで、SVG Mapコンテンツへの埋め込まれるメタデータの意味としては、SVG Mapコンテンツのドキュメント全体に対するメタデータと、ドキュメント中の個々の図形要素に対するメタデータの二つが挙げられるでしょう。前者のメタデータの埋め込みは、RDF/XMLによって記述された情報を<svg>ルート要素直下に置かれた<metadata>要素に入れる という手法が、例えば地理的な座標参照系の記述方法などで採られています。
 一方、後者のメタデータに関しては、W3C ESW Wiki:GeoMetadataOverSvgにあるように、前者と同様の方法(ただし、個々の図形要素を指定するためにxlinkを用いる。)に対して、図形要素に直接属性を埋め込むことによる、より簡易な方法は有効と考えられます。(なお、この方法はSVGの勧告仕様に違反していません)

 この方法は、RDF/XMLの記法に準拠しておらず、複雑なデータ構造を直接記述できないものの、データ格納効率と作業性の面で優れています。データ格納効率に関しては端折ります(別途詳説予定)が、作業性に関して以下のメリットが指摘できます。

  • 図形要素とメタデータが文書中で分離していないため、処理段階において分離した情報を結合する処理が不要
  • 個々の図形要素に不特定のデータ構造(<metadata>子要素以下のメタデータ構造)が挿入されることを想定しなくて良いため、処理性能の最適化が容易
  • テキストエディタなどの簡易な手段を用いて、直接埋め込まれたメタデータを元にして個々の図形にスタイルを設定することが可能(もちろんXSLTを用いることも可能)

また、microformatsや、GRDDLなど、近年このような簡易な方法でコンテンツにメタデータを埋め込む手法の有用性が認知されています。

 以上の理由により、SVG Mapコンソーシアムでは、この簡易な方法によるメタデータの埋め込みをサポートすることにします。

個々の図形要素へのメタデータの埋め込み仕様

  • 各図形要素に、メタデータを属性として付加することができる。
  • 相当するRDFによるデータ構造は以下の通り
     <図形要素名 id="ID" 属性="属性値" .../>
     =
     [ID]:(主語) -- 属性:(述語) --> [属性値]:(目的語)
    なお、[ID]:(主語) -- rdf:type:(述語) --> [図形要素名]:(目的語)も同時に言明されるでしょう。
  • 付加される属性は、それぞれSVGと異なるネームスペースを持ち、正しくネームスペースが宣言されている必要がある。
  • ネームスペースを複数宣言することによって、複数の語彙に基づく属性を埋め込むこともできる。
  • 属性値としてリテラル(文字列・数値など)とリソース(URL,URI)を用いることができる。値の制限は、ネームスペース宣言において指定されるスキーマ(RDF Schemaを想定)によって行われるものとする。
  • カンマ","区切りを用いて、一種類の属性に複数の属性値を持たせることができる。
  • 埋め込まれる図形要素には、id属性が付与されていることが好ましい。(付与されていない場合、RDFによるデータ構造では、匿名ノードとして扱われる)

記述例:
 <svg  xmlns="http://www.w3.org/2000/svg"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:foaf="http://xmlns.com/foaf/0.1/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
  <path id="t1"
      foaf:nick="おービル"
      rdf:type="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing"
      dc:title="OOX商会ビル"
      stroke="green" d="....." />
 </svg>

タイリングされた地図データ - 補足

タイリングされた地図データの解説では、簡単化のためにすべてのタイルは等しいサイズとしていました。しかし、SVG Mapでは、タイルの配置はコンテナファイルのimage要素のx,y,width,height属性によって任意に指定できます。したがって、個々のタイルが等しいサイズである必要はありません。もちろんタイルのサイズがたとえば日本の1次メッシュや2次メッシュなどと一致している必要もありません。(もちろんそのようなタイルを配置してもかまいません。)

下の図は、Tiny SVG Base Map contentで使用されている、日本の海岸線データのタイル分割の様子です。そのコンテナのURLはhttp://www.svg-map.org/svg/basemaps/GMapJpz/jpCoast.dbf.svgzです。Tiny SVG Base Map contentのコンテンツは全て静的なファイルですので、ソースコードをご覧いただけば分割の仕組みが理解できると思います。
#静的なファイルで伸縮スクロール自在な地図サービスを構築できることはSVG Mapの特徴のひとつとなっています。これについては後日詳説します。

Rtile

フリーズーム地図を実現する拡張機能

 SVGは、描画の劣化なく伸縮自在なグラフィックスデータですが、同じデータを伸縮するだけですので、伸縮に伴って情報量が変わるわけではありません。一方、電子地図アプリケーションでは、一般に伸縮に伴って表示される情報量を変化させる機能が提供されています。

 この機能を実現する汎用的な手法として、表示倍率に応じて個々の図形要素の表示非表示を制御できる機能が考えられます。SVGでも一時Ver.1.2の検討段階で、これを実現する仕様が検討(出典)されましたが、今のところペンディングになっています。SVG Mapコンソーシアムでは、この機能はWeb地図サービスにおいて必須と考え、SVG Map Profileとして拡張することにしました。

拡張する属性 : figure-visibility
 図形要素に対し、表示縮尺に応じた表示・非表示制御を行うためのパラメータを設定する属性
 対象となる親要素、Basic Shapes, Path, Text, <use>, <g>, <image>, <animation>

書式 : figure-visibility="[最小縮尺],[最大縮尺]"
 表示縮尺が[最小縮尺]から[最大縮尺] の間にあるとき、その図形が表示
 #表示縮尺の定義:
  100×(ある図形の画面の座標系での長さ/その図形のSVGコンテンツ座標系での長さ)[%]

名前空間 : SVG Map Profileとして拡張する仕様は、Namespaces in XML仕様を用いて、SVGデータに埋め込みます。
 SVG Map ProfileのためのネームスペースURL : http://purl.org/svgmap/profile
 推奨する接頭語 : go

例:
 <svg ... xmlns:go="http://purl.org/svgmap/profile">
  ....
  <circle cy="100" cy="100" go:figure-visibility="100,200"/>
 </svg>
 等倍から2倍表示の間はcircle図形が表示される
Figvis

表示倍率に応じて動的に地図を読み込むシステム

タイリングされた地図のコンテナで記載したビューアの実装要求仕様2を本拡張機能に基づき拡張し、表示倍率に応じて動的に地図データを読み込むメカニズムを実現します。

ビューアの実装要求仕様
 
<image>(または<animation>)要素に本属性を設置した場合、縮尺に応じて動的に地図データを取得する地図サービスを構築できるものとします。
該当する<image>要素が表示すべき倍率範囲に入った場合に、その<image>要素が参照しているデータを動的に取得するロジックを少なくとも実装していなければならないこととします。

例: Tiny SVG Base Map Content で紹介されている世界地図から電子国土データまでをフリーズーム&フリースクロールできる地図データ(http://www.svg-map.org/svg/basemaps/worldMapZ.svg)を参照ください。

goSVG技術解説書

gコンテンツ流通推進協議会より、goSVG技術解説書が公開されました。

goSVGは、SVG Mapプロファイルの原型となっているもので、いくつかの違いはあるものの、この解説書は多くの有用な情報を提供するものです。

goSVG技術解説書とSVG Mapプロファイルの主な違い

タイリングされた地図のコンテナの例

<image>によるSVGのインポートに対応していないビューアがありますので、ラスターデータのタイルをインポートしてタイリングするコンテナSVGデータを タイリングされた地図データのサンプルとして投稿します。

Firefoxでは、地理座標は認識しませんが、タイリングされた地図を見ることができます。

orthocontainer2.svgをダウンロード  (銀座周辺です)

このデータは、国土交通省のオルソ化空中写真ダウンロードシステムが提供するWMSインターフェースのURLを用いて、オルソ写真データをインポートし、タイリングしています。

タイリングされた地図データ

インターネット上の地図サービスでは、サーバ上のデータベースで端末の表示領域に応じた地図を動的に生成したり、クライアント上のECMA Scriptプログラムによって、タイル分割された地図を組み合わせたりして、自在にスクロールできる地図提供が近年流行しています。

しかし、サーバ上でデータベースを運用するのはコストがかかりますし、ECMA Scriptによるタイル合成では、クライアント上にそのサービス専用のプログラムをロードしますので、例えば、サービスAとサービスBを重ね合わせて(マッシュアップして)使う といったことを行おうとすると、かなりのプログラム知識が必要になります。 スクロール自在な地図が単なる地図ファイルの配信と標準のビューアだけで実現できれば、これらの問題の多くを解消できるでしょう。

そこで、SVG Mapコンソーシアムでは、SVG形式のタイル分割された単なる地図ファイルを用いて、自在に地図のスクロール表示を行う仕組みを SVG Mapプロファイルとして規定します。

この仕組みは、SVGの基本仕様を応用して実現されます。その方法を以下に説明します。

タイリングされた地図データ

個々の地図のタイルのファイルは、図のようにそれらを纏める(タイリングする)SVGファイルによって、一枚の地図に合成されることにします。このように、他のファイルをインポートするSVGファイルのことをコンテナSVGファイルと呼ぶことにします。

Tile2_3

ここで、ファイルをインポートする仕様は、SVGが元々持っている、<image>(またはSVG1.2では<animation>)要素によって実現できます。コンテナSVGファイルの例を次に示します。

Container.svg
<svg ... viewBox="20 110 120 85">
<metadata ... />
<image   x="0"   y="0" width="100" height="70" xlink:href="0_0.svg"/>
<image x="100"   y="0" width="100" height="70" xlink:href="1_0.svg"/>
<image x="200"   y="0" width="100" height="70" xlink:href="2_0.svg"/>
<image   x="0"  y="70" width="100" height="70" xlink:href="0_1.svg"/>
<image x="100"  y="70" width="100" height="70" xlink:href="1_1.svg"/>
<image x="200"  y="70" width="100" height="70" xlink:href="2_1.svg"/>
<image   x="0" y="140" width="100" height="70" xlink:href="0_2.svg"/>
<image x="100" y="140" width="100" height="70" xlink:href="1_2.svg"/>
<image x="200" y="140" width="100" height="70" xlink:href="2_2.svg"/>
</svg>

SVG仕様によれば、このような記述によって、地図タイルを張り合わせて(タイリングして)表示することが可能です。すなわち、W3Cが規定したオリジナルのSVG仕様の範囲で、タイリングされた地図の表示が可能です。(これは仕様上の話で、実際に可能かどうかはビューアの実装に依存します。例えば、FirefoxのSVGビューアでは今のところまだ<image>要素ではsvgの参照ができませんので、SVGのタイルの表示はできません。(タイルがjpeg形式であればできるようです))

参考:今後ご説明する、SVG Mapの主要な相互運用性を提供するハイパーレイヤリング機能でも、ファイルのインポート・コンテナSVGファイルは重要な要素です。タイリングでは、インポートしたデータを並べて表示しますが、レイヤリングは、データを重ねます。複数のデータをインポートして表示することに変わりはありません。

ビューアの実装要求仕様

さて、ここでSVG Mapプロファイルとしての新たな ビューア側の仕様を規定します。

要求仕様1: まず大前提の条件として、SVG Mapプロファイル準拠のビューアは、<image>要素によって、外部のSVGファイルのインポート表示ができなければなりません。

更に、クライアントのSVG Mapビューアは、上記のコンテナSVGデータに対応したロジックをもっている必要があります。そのロジックとは、以下のようなものです。

先のようなコンテナSVGをビューアで表示した場合、何の工夫もされていないSVGビューアでは、image要素が参照している全てのタイルデータをダウンロードしようとしてしまうでしょう。上の例ではまだ9個しかないので、ビューアの動作に問題は出ないかもしれません。しかし、例えば100x100にタイル分割されたデータを表示しようとした場合、問題が起きるかもしれません。

要求仕様2: そこで、SVG Map profileに準拠したビューアは、<image>要素の領域(w,y,width,heightで指定されている)がビューアのビューボックスに入ったときに、その<image>要素が参照しているデータを動的に取得するロジックを少なくとも実装していなければならないこととします。

その仕組みを下の図で説明します。

タイリングされた地図の表示ロジックの説明図 (swfアニメーションです。右クリックで"新しいウィンドを開く"とすると良いでしょう。)

緑色のタイルがロードされていなければならないタイルデータです。
最初は、コンテナのviewBox="20 110 120 85" なので、左下の4枚(0_1.svg, 1_1.svg, 0_2.svg, 1_2.svg)が取得されます。 ここで、利用者が右上の方向にスクロール操作を行ったとします。すると、ビューアのビューボックスが移動していき、次々と(0_0.svg,1_0.svg)、(2_0.svg,2_1.svg)がロードされます。ここで、黄色のタイルは、一旦ロードされたものの、viewBoxから外れたために、不要となったデータです。このようなデータをメモリの許す限り常に保持し続けるか、すぐに捨て去るのかといった処理の工夫は、ビューアの実装に依存します。

ここで規定した仕様では、例えば、全部のタイルを表示してしまうような広いエリアの表示を行おうとすれば、結局全てのタイルの読み込みが始まってしまうでしょう。次回以降では、拡大・縮小表示を可能にするプロファイルの説明を予定しています。

座標参照系のPURL

地理的な座標による空間参照 のページを更新しましたとおり、座標参照系のURIを確固としたものに改訂しました。  それは、http://purl.org/crs/84 です。

SVG MapではWGS 84を基にした座標参照系を共通の座標参照系とすることで、シンプルで広汎な相互運用性を得ようと考えています。 この座標参照系は、OGCのWMSでは"CRS:84"と呼ばれています。

一方、SVG(1.1以降)の仕様では、そのグラフィックス(地図)が使用している座標参照系を、コンテンツ自身にメタデータとして記述することになっています。したがって、先の"共通の座標参照系を使っている"ということを 各コンテンツに記述すれば良いことになります。SVG(1.1以降)の仕様では、それはRDF (RDF/XML)によって記述・言明されなければなりません。(参照) 

RDFで、"共通の座標参照系"を言明するには、それがURIとして識別できなければなりません。そのため、、"共通の座標参照系"である"CRS:84"座標参照系のための確固としたURIは、とても重要です。

WMSでの名称"CRS:84"は、URIとしては不適切です。そこでOGCは、独自にURNによる座標参照系識別子を提唱しているようですが、以下の問題がありました。

  • (NID:ogc)はURNとして正式に登録されていない(2007-04-27 現在)(参照
  • シンプルな仕様書へのアクセスがURNではできない

一方、PURL(Persistent Uniform Resource Locator)は、永続的なURL(URI)の保証を目的に作られたものです。詳しくは、purlのホームページwikipedia:purlをご覧ください。 日本語の資料はあまり多くありません。PURLは基本的にWWWのためのURLなので、WWWブラウザで簡単にアクセスすることができます。

PURLはセマンティックWebに関係する仕様のネームスペースとして しばしば用いられており、有名なところではDublin CoreRSS1.0などがPURLを用いています。

そこで、座標参照系のためのドメインをPURLに登録しました。
http://purl.org/crs  です。

そして、CRS:84のための、PURLを登録しました。
http://purl.org/crs/84  です。

今後、SVG Mapコンソーシアムでは、http://purl.org/crs/84 を 共通の座標参照系として推奨します。

地理的な座標による空間参照

SVG Mapプロファイル 1.0(案)

SVG Mapプロファイル 1.0において最も重要な情報は、SVGデータの座標を地理座標と関連付けるための情報です。それは、座標参照系(Coordinate Reference System)メタデータとして記述されます。

SVG Mapプロファイル1.0における座標参照系メタデータの記述規則はSVG1.1仕様(Geographic Coordinate Systems)に基づいていますが、小型コンピュータへの実装容易性と同時に、仕様の曖昧さを解消するために、新たな限定を行うプロファイルを定義します。
SVG Mapプロファイル1.0のデータは必ず座標参照系メタデータを持たなければなりません。それは、以下のRDF/XMLによる言明によって記述されなければなりません。

  • 座標参照系プロパティ
    crs:CoordinateReferenceSystem
    このSVGコンテンツが用いる空間参照系を言明します。
    定義域:SVGコンテンツ
    値域:CRS型のインスタンス

    このプロパティの名前空間:
    xmlns:crs="http://opengis.org/xmldtds/transformations.dtd"
    この語彙はOGCが過去に勧告した"Recommended Definition Data for Coordinate Reference Systems and Coordinate Transformations"から引用されたものです。

  • CRS型のインスタンス
    以下のCRS型のインスタンスのみを推奨します。
    urn:ogc:def:crs:OGC:1.3:CRS84
    http://purl.org/crs/84       (2007.5.9更新)

    このリソースは、一般にWGS-84と呼ばれるもの、ただし第一パラメータ(X)が経度、第二パラメータ(Y)が緯度 単位はそれぞれ"度"の2次元座標系を持つ地球の座標参照系です。この座標参照系は、OGCWMS1.3.0のために定義した座標参照系"CRS:84"(Annex B3)と等価です。

    また、上記のURN表記方法は 同じくOGCの"URNs of definitions in ogc namespace"に記述されているものです。 (2007.5.9削除)
    .
    注1:現在のところ、URNのNIDとして"ogc"は登録されていません。したがって、ogcの仕様を元に規定した、urn表現による空間参照系には、正当性の面で問題がありました。そこで、SVG Mapコンソーシアムでは、purl(persistent URL)を用いることにしました。そして、CRS:84座標参照系のためのURL(URI)として、http://purl.org/crs/84 を登録しました。現在のところ、これが唯一の推奨する座標参照系です。(2007.5.9更新)
    .
    注2:同じWGS 84空間参照系であるEPSG:4326は第一パラメータ(X)が緯度、第二パラメータ(Y)が経度であり、SVG Mapが使用するCRS:84とはパラメータの順番が逆です。
    .
    注3:purlはwebブラウザでアクセス可能なURIです。CRS:84のためのドキュメントが同URL(http://purl.org/crs/84)から取得できます。(2007.5.9更新)
    .
     このCRSの限定は、CRSを一つにすることにより、利用者端末への実装を容易にしつつ、相互運用性を向上することができるという利点によるものです。例えば複数の地図の重ね合わせを行うとき、空間参照系の違いを事実上考慮する必要がなくなります。また、ここで限定したWGS-84座標系は、インターネット上の大多数の地理情報で用いられています。さらに、多くの携帯端末が実装しつつあるGPSが扱うネイティブの空間参照系でもあります。したがって、大多数のユースケースでは、この限定による不都合は起きないでしょう。
    .
  • SVG座標変換プロパティ
    svg:transform
    SVGコンテンツの座標値と空間参照系で示される座標値との間の変換式を与えます。
    定義域: CRS型のインスタンス
    値域: SVG transform属性で使用できる文字列(アフィン変換パラメータとして一般化できる)

    座標変換はSVGのレンダリングシステムに内蔵されている一次のアフィン変換のみを許容します。

    変換式は以下の通りです。
     SVG_X:SVGデータのX座標
     SVG_Y:SVGデータのY座標
     Geo_X:空間座標の第一パラメータ CRS型のインスタンスの制約により、それは経度です
     Geo_Y:空間座標の第二パラメータ CRS型のインスタンスの制約により、それは緯度です

     a , b , c , d , e , f = SVG transform(a,b,c,d,e,f)パラメータの該当値

     SVG_X = a * Geo_X + c * Geo_Y + e
     SVG_Y = b * Geo_X + d * Geo_Y + f

    このプロパティが言明されていない場合は、その値がmatrix(1,0,0,1,0,0)であるとみなします。
    .
  • SVG Mapの図法
     SVG座標変換プロパティが一次のアフィン変換のみであることから、SVG Mapで使用できる図法は正距円筒図法(及びその標準緯線を赤道に取った派生形であるPlate Caree)に限定されます。なお、更に派生形としてアフィン変換の非対角成分が"0"でない図法(正距円筒図法を回転させた図法)を用いることも可能です。
     この限定は、多くのユースケースでは実用的な図法を提供しますが、高緯度地域の地図などにおいて不都合な場合がありえます。しかしながら、SVGのレンダリングシステムにあらかじめ内蔵されている機能を流用でき、しかも単純な一次変換であるので、利用者端末への実装を容易にし、スケーラビリティ(特に小型端末への)を向上させるでしょう。
    .
  • サンプル
    <?xml version="1.0" encoding="UTF-8"?>
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <metadata>
      <rdf:RDF
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:crs="http://opengis.org/xmldtds/transformations.dtd"
       xmlns:svg="http://www.w3.org/2000/svg">
       <rdf:Description>
        <crs:CoordinateReferenceSystem
         rdf:resource="http://purl.org/crs/84"
         svg:transform="matrix(15.3631,0.0,0.0,-18.6994,-1889.2916,849.9202)"/>
       </rdf:Description>
      </rdf:RDF>
    </metadata>
    <circle cx="258.1401" cy="185.1558" r="10.0" stroke="none" fill="green"/> </g>
    </svg>

    この例で、空間参照系のメタデータは以下のようなグラフで表現されます。
    <This SVG Document> crs:CoordinateReferenceSystem <http://purl.org/crs/84>.
    <http://purl.org/crs/84> svg:transform "matrix(15.3631,0.0,0.0,-18.6994,-1889.2916,849.9202)".

    SVG座標変換プロパティのパラメータは以下の通りです。
    a=15.3631
    b=0.0
    c=0.0
    d=-18.6994
    e=-1889.2916
    f=849.9202

    ここで、<circle>図形の中心のSVG座標(258.1401,185.1558)を地理座標に換算すると以下になります。
    258.1401 =  15.3631 * Geo_X - 1889.2916
    185.1558 = -18.6994 * Geo_Y + 849.9202

    Geo_X(経度) = 139.7694°
    Geo_Y(緯度) =  35.5500°

SVG Map Profile 1.0 概要

SVG Mapプロファイル 1.0(案) 2007.12.19更新

○概要:
この仕様書は、SVG Mapプロファイル1.0を記述します。

SVG Mapプロファイルは別に掲げる要求事項を満たす地図サービスを実現するプロファイルです。そのため、SVG Mapプロファイルは、SVG1.1Tiny仕様に基づいていますが、地図サービスへの適用性を高めるために以下の限定と拡張を行っています。

検索

注目エントリー

2008年7月

    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

最近のトラックバック