-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move svg:transform mapping to its own spec
- Loading branch information
1 parent
2129b7c
commit 637ae49
Showing
3 changed files
with
1,006 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,325 @@ | ||
<h1>svg:transform for mapping</h1> | ||
<pre class='metadata'> | ||
Level: 1 | ||
Status: ED | ||
ED: http://dev.w3.org/fxtf/motion-1/ | ||
Shortname: transform-mapping | ||
Group: svg | ||
Editor: Satoru Takagi, KDDI Corporation, sa-takagi@kddi.com | ||
Abstract: This specification gives guidance how the SVG transform attribute in the SVG namespace can be used in other context than SVG. | ||
</pre> | ||
<pre class=link-defaults> | ||
spec:svg2; type:element; text:svg | ||
spec:css-transforms-1; type:property; text:transform | ||
spec:css-transforms-1; type:type; text:<transform-list> | ||
</pre> | ||
|
||
<h2 id="GeographicCoordinates">Geographic coordinate systems</h2> | ||
|
||
In order to allow interoperability between SVG content generators | ||
and user agents dealing with maps encoded in SVG, the use of a common | ||
metadata definition for describing the coordinate system used to | ||
generate SVG documents is encouraged. | ||
|
||
Such metadata must be added under the <a element>metadata</a> element of | ||
the topmost <a element>svg</a> element describing the map, consisting of an | ||
RDF description of the Coordinate Reference System definition used to | ||
generate the SVG map [[RDF-PRIMER]]. Note that | ||
the presence of this metadata does not affect the rendering of the SVG | ||
in any way; it merely provides added semantic value for applications | ||
that make use of combined maps. | ||
|
||
The definition must be conformant to the XML grammar described in | ||
<a href="http://portal.opengeospatial.org/files/?artifact_id=20509"><cite>GML 3.2.1</cite></a>, | ||
an OpenGIS Standard for encoding common CRS data types in XML | ||
[<a href='refs.html#ref-GML'>GML</a>]. In order to correctly map | ||
the 2-dimensional data used by SVG, the CRS must be of subtype | ||
<strong>ProjectedCRS</strong> or <strong>Geographic2dCRS</strong>. The | ||
first axis of the described CRS maps the SVG <var>x</var>-axis and the | ||
second axis maps the SVG <var>y</var>-axis. | ||
|
||
The main purpose of such metadata is to indicate to the user agent | ||
that two or more SVG documents can be overlayed or merged into a single | ||
document. Obviously, if two maps reference the same Coordinate Reference | ||
System definition and have the same SVG 'transform' property | ||
value then they can be overlayed without reprojecting the data. If | ||
the maps reference different Coordinate Reference Systems and/or have | ||
different SVG 'transform' property values, then a specialized | ||
cartographic user agent may choose to transform the coordinate data to | ||
overlay the data. However, typical SVG user agents are not required | ||
to perform these types of transformations, or even recognize the | ||
metadata. It is described in this specification so that the connection | ||
between geographic coordinate systems and the SVG coordinate system is | ||
clear. | ||
|
||
<h2 id="SVGGlobalTransformAttribute">The <span class="attr-name">'svg:transform'</span> attribute</h2> | ||
|
||
<div class="adef-list"> | ||
<p><em>Attribute definition:</em></p> | ||
<dl> | ||
<dt id="SVGGlobalTransformAttributeDefinition"><dfn>svg:transform</dfn> = <<transform-list>> | ''transform/none''</dt> | ||
<dd> | ||
<dl> | ||
<dt><<transform-list>></dt> | ||
<dd> | ||
<p>Specifies the affine transformation that has been | ||
applied to the map data. The syntax is identical to | ||
that described for the 'transform' property.</p> | ||
</dd> | ||
|
||
<dt><span class="attr-value">none</span></dt> | ||
<dd> | ||
<p>Specifies that no supplemental affine transformation has been | ||
applied to the map data. Using this value has the same meaning as | ||
specifying the identity matrix, which in turn is just the same as | ||
not specifying the <a>svg:transform</a> the attribute at all.</p> | ||
</dd> | ||
</dl> | ||
<p class="anim-target">Animatable: no.</p> | ||
</dd> | ||
</dl> | ||
</div> | ||
|
||
This attribute describes an optional additional affine | ||
transformation that may have been applied during this | ||
mapping. This attribute may be added to the OpenGIS | ||
<em>CoordinateReferenceSystem</em> element. Note | ||
that, unlike the 'transform' property, it does not indicate that | ||
a transformation is to <em>be applied</em> to the data within the file. | ||
Instead, it simply describes the transformation that <em>was already | ||
applied</em> to the data when being encoded in SVG. | ||
|
||
There are three typical uses for the <a>svg:transform</a> | ||
global attribute. These are described below and used in the examples. | ||
|
||
<ul> | ||
<li>Most ProjectedCRS have the north direction represented by | ||
positive values of the second axis and conversely SVG has a | ||
<var>y</var>-down coordinate system. That's why, in order to follow the | ||
usual way to represent a map with the north at its top, it is | ||
recommended for that kind of ProjectedCRS to use the | ||
<a>svg:transform</a> | ||
global attribute with a ''scale(1, -1)'' value as in the | ||
third example below.</li> | ||
|
||
<li>Most Geographic2dCRS have the latitude as their first | ||
axis rather than the longitude, which means that the | ||
south-north axis would be represented by the <var>x</var>-axis in SVG | ||
instead of the usual <var>y</var>-axis. That's why, in order to follow | ||
the usual way to represent a map with the north at its top, | ||
it is recommended for that kind of Geographic2dCRS to use the | ||
<a>svg:transform'</a> | ||
global attribute with a ''rotate(-90)'' value as in the | ||
first example (while also adding the ''scale(1, -1)'' as for | ||
ProjectedCRS).</li> | ||
|
||
<li>In addition, when converting for profiles which place | ||
restrictions on precision of real number values, it may be | ||
useful to add an additional scaling factor to retain good | ||
precision for a specific area. When generating an SVG | ||
document from WGS84 geographic coordinates (EPGS 4326), we | ||
recommend the use of an additional 100 times scaling factor | ||
corresponding to an <a>svg:transform</a> | ||
global attribute with a ''rotate(-90) scale(100)'' | ||
value (shown in the second example). | ||
Different scaling values may be required depending on the | ||
particular CRS.</li> | ||
</ul> | ||
|
||
Below is a simple example of the coordinate metadata, which | ||
describes the coordinate system used by the document via a | ||
URI. | ||
|
||
<div class="example"> | ||
<pre><code class=html> | ||
<?xml version="1.0"?> | ||
<svg xmlns="http://www.w3.org/2000/svg" | ||
width="100" height="100" viewBox="0 0 1000 1000"> | ||
|
||
<desc>An example that references coordinate data.</desc> | ||
|
||
<metadata> | ||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:crs="http://www.ogc.org/crs" | ||
xmlns:svg="http://www.w3.org/2000/svg"> | ||
<rdf:Description rdf:about=""> | ||
<!-- The Coordinate Reference System is described | ||
through a URI. --> | ||
<crs:CoordinateReferenceSystem | ||
svg:transform="rotate(-90)" | ||
rdf:resource="http://www.example.org/srs/epsg.xml#4326"/> | ||
</rdf:Description> | ||
</rdf:RDF> | ||
</metadata> | ||
|
||
<!-- The actual map content --> | ||
</svg> | ||
</code></pre> | ||
</div> | ||
|
||
The second example uses a well-known identifier to describe | ||
the coordinate system. Note that the coordinates used in the | ||
document have had the supplied transform applied. | ||
|
||
<div class="example"> | ||
<pre><code class=html> | ||
<?xml version="1.0"?> | ||
<svg xmlns="http://www.w3.org/2000/svg" | ||
width="100" height="100" viewBox="0 0 1000 1000"> | ||
|
||
<desc>Example using a well known coordinate system.</desc> | ||
|
||
<metadata> | ||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:crs="http://www.ogc.org/crs" | ||
xmlns:svg="http://www.w3.org/2000/svg"> | ||
<rdf:Description rdf:about=""> | ||
<!-- In case of a well-known Coordinate Reference System | ||
an 'Identifier' is enough to describe the CRS --> | ||
<crs:CoordinateReferenceSystem svg:transform="rotate(-90) scale(100, 100)"> | ||
<crs:Identifier> | ||
<crs:code>4326</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
</crs:CoordinateReferenceSystem> | ||
</rdf:Description> | ||
</rdf:RDF> | ||
</metadata> | ||
|
||
<!-- The actual map content --> | ||
</svg> | ||
</code></pre> | ||
</div> | ||
|
||
The third example defines the coordinate system completely | ||
within the SVG document. | ||
|
||
<div class="example"> | ||
<pre><code class=html> | ||
<?xml version="1.0"?> | ||
<svg xmlns="http://www.w3.org/2000/svg" | ||
width="100" height="100" viewBox="0 0 1000 1000"> | ||
|
||
<desc>Coordinate metadata defined within the SVG document</desc> | ||
|
||
<metadata> | ||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:crs="http://www.ogc.org/crs" | ||
xmlns:svg="http://www.w3.org/2000/svg"> | ||
<rdf:Description rdf:about=""> | ||
<!-- For other CRS it should be entirely defined --> | ||
<crs:CoordinateReferenceSystem svg:transform="scale(1,-1)"> | ||
<crs:NameSet> | ||
<crs:name>Mercator projection of WGS84</crs:name> | ||
</crs:NameSet> | ||
<crs:ProjectedCRS> | ||
<!-- The actual definition of the CRS --> | ||
<crs:CartesianCoordinateSystem> | ||
<crs:dimension>2</crs:dimension> | ||
<crs:CoordinateAxis> | ||
<crs:axisDirection>north</crs:axisDirection> | ||
<crs:AngularUnit> | ||
<crs:Identifier> | ||
<crs:code>9108</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
</crs:AngularUnit> | ||
</crs:CoordinateAxis> | ||
<crs:CoordinateAxis> | ||
<crs:axisDirection>east</crs:axisDirection> | ||
<crs:AngularUnit> | ||
<crs:Identifier> | ||
<crs:code>9108</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
</crs:AngularUnit> | ||
</crs:CoordinateAxis> | ||
</crs:CartesianCoordinateSystem> | ||
<crs:CoordinateReferenceSystem> | ||
<!-- the reference system of that projected system is | ||
WGS84 which is EPSG 4326 in EPSG codeSpace --> | ||
<crs:NameSet> | ||
<crs:name>WGS 84</crs:name> | ||
</crs:NameSet> | ||
<crs:Identifier> | ||
<crs:code>4326</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
</crs:CoordinateReferenceSystem> | ||
<crs:CoordinateTransformationDefinition> | ||
<crs:sourceDimensions>2</crs:sourceDimensions> | ||
<crs:targetDimensions>2</crs:targetDimensions> | ||
<crs:ParameterizedTransformation> | ||
<crs:TransformationMethod> | ||
<!-- the projection is a Mercator projection which is | ||
EPSG 9805 in EPSG codeSpace --> | ||
<crs:NameSet> | ||
<crs:name>Mercator</crs:name> | ||
</crs:NameSet> | ||
<crs:Identifier> | ||
<crs:code>9805</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
<crs:description>Mercator (2SP)</crs:description> | ||
</crs:TransformationMethod> | ||
<crs:Parameter> | ||
<crs:NameSet> | ||
<crs:name>Latitude of 1st standart parallel</crs:name> | ||
</crs:NameSet> | ||
<crs:Identifier> | ||
<crs:code>8823</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
<crs:value>0</crs:value> | ||
</crs:Parameter> | ||
<crs:Parameter> | ||
<crs:NameSet> | ||
<crs:name>Longitude of natural origin</crs:name> | ||
</crs:NameSet> | ||
<crs:Identifier> | ||
<crs:code>8802</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
<crs:value>0</crs:value> | ||
</crs:Parameter> | ||
<crs:Parameter> | ||
<crs:NameSet> | ||
<crs:name>False Easting</crs:name> | ||
</crs:NameSet> | ||
<crs:Identifier> | ||
<crs:code>8806</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
<crs:value>0</crs:value> | ||
</crs:Parameter> | ||
<crs:Parameter> | ||
<crs:NameSet> | ||
<crs:name>False Northing</crs:name> | ||
</crs:NameSet> | ||
<crs:Identifier> | ||
<crs:code>8807</crs:code> | ||
<crs:codeSpace>EPSG</crs:codeSpace> | ||
<crs:edition>5.2</crs:edition> | ||
</crs:Identifier> | ||
<crs:value>0</crs:value> | ||
</crs:Parameter> | ||
</crs:ParameterizedTransformation> | ||
</crs:CoordinateTransformationDefinition> | ||
</crs:ProjectedCRS> | ||
</crs:CoordinateReferenceSystem> | ||
</rdf:Description> | ||
</rdf:RDF> | ||
</metadata> | ||
|
||
<!-- the actual map content --> | ||
</svg> | ||
</code></pre> | ||
</div> |
Oops, something went wrong.