AnsweredAssumed Answered

Symbol offset nor working correct when using SizeInfo in renderer

Question asked by nexiga_bosbach on Jan 31, 2018

Hi everyone,

 

in my application I'm displaying points with a pin symbol. This symbol is 18px in size, so I'm using an offset of 9px on the y axis, so the tip of my pin is exactly on the faeture coordinates.

This is all working fine, but when I add a sizeInfo to the renderer the offset isn't scaling with the icon size.

As an example based on the values of a feature, the symbol gets scaled to 36px, but the offset remains 9px and not 16px as needed.

So the tip of my scaled pins doesn't hit the coordinates of my feature.

Does anybody know how to fix this issue?

 

Some sample code:

 

 

var symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_PATH, 18,
    new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
        new Color([255,0,0,1]), 8),
    new Color([0,255,0]));
symbol.setOffset(0,9);
symbol.setPath("M 182.9 551.7 c 0 0.1 0.2 0.3 0.2 0.3 S 358.3 283 358.3 194.6 c 0 -130.1 -88.8 -186.7 -175.4 -186.9 C 96.3 7.9 7.5 64.5 7.5 194.6 c 0 88.4 175.3 357.4 175.3 357.4 S 182.9 551.7 182.9 551.7 Z M 122.2 187.2 c 0 -33.6 27.2 -60.8 60.8 -60.8 c 33.6 0 60.8 27.2 60.8 60.8 S 216.5 248 182.9 248 C 149.4 248 122.2 220.8 122.2 187.2 Z");
var renderer = new SimpleRenderer(symbol);

if(this.symbolValueSizeSelect.value != null){
    var sizeMinMax = this.getMinMaxFromField(this.symbolValueSizeSelect.value);
    visualVariables.push({
        type: "sizeInfo",
        field: this.symbolValueSizeSelect.value,
        minSize: 18,
        maxSize: 50,
        minDataValue: sizeMinMax.min,
        maxDataValue: sizeMinMax.max
    });
}

if(this.symbolValueColorSelect.value != null || this.symbolValueSizeSelect.value != null){
    renderer.setVisualVariables(visualVariables);
}

 

best regards,

 

Sebastian

Outcomes