Unfortunately, the documentation is a bit misleading in this case. There is no explicitly set default width and height for PictureMarkerSymbols. The values *should be* the actual width and height of the image being used.I will bring this up with the documentation folks. In the meantime, it would be best if your symbols all used the same dimensions.If you absolutely cannot figure any other solution, you can use javascript to calculate the dimensions of the image after it is loaded into memory.
map.on("click", function(evt){
// Remove old Graphics
myGraphicsLayer.graphics.forEach(function(g){
if(g.visible === true)
myGraphicsLayer.remove(g);
});
var symbol, point, graphic;
var img = new Image();
img.src = '../../uihlein/test/images/star.png';
img.onload = function() {
symbol = new PictureMarkerSymbol('../../uihlein/test/images/star.png', this.width, this.height);
point = new Point(evt.mapPoint.getLongitude(), evt.mapPoint.getLatitude());
graphic = new Graphic(point, symbol);
myGraphicsLayer.add(graphic);
map.infoWindow.show(point);
}
});
This is not the best solution (it took two minutes to write and is more of a proof of concept).I strongly encourage you to seek out alternative solutions.