<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 12px;" lang="x-western">Hi,
<br>
<br>
I'm trying to apply a SVG external graphic to a points layer. What
I need is that the graphic size will be scale dependant and not
preserve the aspect ratio.
<br>
<br>
What I've found is whatever graphicHeight and graphicWidth I set
to the externalGraphic, the SVG is rendered preserving the aspect
ratio... If I use png the graphic is drawn correctly.
<br>
<br>
The style definition I'm using is very simple:
<br>
<br>
var style = new
OpenLayers.Style(OpenLayers.Util.applyDefaults({
<br>
graphicWidth: 100 ,
<br>
graphicHeight: 600 ,
<br>
externalGraphic: 'img/petrolero.svg',
<br>
fill: false,
<br>
stroke: false,
<br>
pointRadius: 0,
<br>
rotation: "${rotation}",
<br>
fillOpacity: 1
<br>
}, OpenLayers.Feature.Vector.style["default"]));
<br>
<br>
var styleMap = new OpenLayers.StyleMap({"default": style,
"select": style});
<br>
<br>
<br>
layer = new OpenLayers.Layer.Vector('Points', {
<br>
styleMap: styleMap
<br>
});
<br>
<br>
<br>
Anyway, I've published an example [1] of what's happening. The
green boats are PNG being scaled correctly, the brown ones are SVG
not being scaled correctly as they preserve the aspect ratio, both
have the same graphicHeight and graphicWidth. Sometimes when the
layer is loaded the SVG is drawn correctly but when a zoom is
applied then happens the aspect ratio issue...
<br>
<br>
Am I missing something? Is there a way to use SVG in the way I
need?
<br>
<br>
Best regards.
<br>
<br>
[1] <a class="moz-txt-link-freetext"
href="http://gis.prodevelop.es/openlayers/svg.html">http://gis.prodevelop.es/openlayers/svg.html</a>
<br>
</div>
</body>
</html>