[Talk-de] Osmarenders eingebaute pattern anpassen

André Riedel riedel.andre at gmail.com
Di Feb 2 07:43:48 UTC 2010


Hier mal am Beispiel für Photovoltaic-Kraftwerke:

symbols/power_photovoltaic.svg

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:ev="http://www.w3.org/2001/xml-events" version="1.1"
baseProfile="full"
   width="16" height="16">
 <g transform="matrix(1,0,-0.26,1,0.15,0)">
  <rect x="3.4" y="3.4" width="13" height="8.9"
style="fill:#ffffff;stroke:#000000;stroke-width:0.4"/>
  <g style="stroke-width:0;fill:#000084" >
   <rect x="3.9" y="8" width="3.8" height="3.8" />
   <rect x="8" y="8" width="3.8" height="3.8" />
   <rect x="12.1" y="8" width="3.8" height="3.8" />
   <rect x="3.9" y="3.9" width="3.8" height="3.8" />
   <rect x="8" y="3.9" width="3.8" height="3.8" />
   <rect x="12.1" y="3.9" width="3.8" height="3.8" />
  </g>
 </g>
 <path d="M 2.72 0.34 L 2.97 2.59 L 1.38 2.13 L 2.44 3.25 L 0.38 3.98
L 2.59 4.38 L 1.59 5.72 L 3.13 5.03 L 3.16 7.22 L 4.25 5.34 L 5.22
6.63 L 5.03 5 L 7.22 5.66 L 5.72 4.06 L 7.25 3.59 L 5.59 3.28 L 6.97
1.41 L 4.88 2.34 L 4.88 0.78 L 4.09 2.13 L 2.72 0.34 z"
style="fill:#ffff00;stroke:#000000;stroke-width:0.1" />
</svg>

Gleiches Symbol als Füllung in osm-map-features-z17.xml

<svg:pattern id="power-photovoltaic-pattern" x="0" y="0" width="16"
height="16" patternUnits="userSpaceOnUse"
patternTransform="scale(0.107)">
<!-- power_photovoltaic.svg -->
<svg:g transform="matrix(1,0,-0.26,1,0.15,0)">
    <svg:rect x="3.4" y="3.4" width="13" height="8.9"
style="fill:#ffffff;stroke:#000000;stroke-width:0.4"/>
    <svg:g style="stroke-width:0;fill:#000084" >
      <svg:rect x="3.9" y="8" width="3.8" height="3.8" />
      <svg:rect x="8" y="8" width="3.8" height="3.8" />
      <svg:rect x="12.1" y="8" width="3.8" height="3.8" />
      <svg:rect x="3.9" y="3.9" width="3.8" height="3.8" />
      <svg:rect x="8" y="3.9" width="3.8" height="3.8" />
      <svg:rect x="12.1" y="3.9" width="3.8" height="3.8" />
    </svg:g>
  </svg:g>
  <svg:path d="M 2.72 0.34 L 2.97 2.59 L 1.38 2.13 L 2.44 3.25 L 0.38
3.98 L 2.59 4.38 L 1.59 5.72 L 3.13 5.03 L 3.16 7.22 L 4.25 5.34 L
5.22 6.63 L 5.03 5 L 7.22 5.66 L 5.72 4.06 L 7.25 3.59 L 5.59 3.28 L
6.97 1.41 L 4.88 2.34 L 4.88 0.78 L 4.09 2.13 L 2.72 0.34 z"
style="fill:#ffff00;stroke:#000000;stroke-width:0.1" />
</svg:pattern>

Wie du siehst, muss jeder SVG-Befehl mit "svg:" ergänzt werden. Um die
gleiche Darstellungsgröße der Symbole mit der Füllung zu erreichen,
muss der Wert [1] dem Wert [2] im Kopf der Style-Datei entsprechen:

[1] <svg:pattern patternTransform="scale(0.107)">

[2] symbolScale="0.107"

Wenn man [2] als Variable in [1] eingeben könnte wäre das schön,
genauso wie, wenn man eine Füllung aus einer SVG-Datei laden könnte.
Ob dies geht, weiß ich leider nicht:-(

Ciao André




Mehr Informationen über die Mailingliste Talk-de