<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PictureMarkerSymbol default width and height in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132420#M12353</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That sounds much easier than my solution. I'm glad you found something better &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're satisfied, make sure you mark this thread as answered.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 May 2014 19:02:06 GMT</pubDate>
    <dc:creator>JonathanUihlein</dc:creator>
    <dc:date>2014-05-14T19:02:06Z</dc:date>
    <item>
      <title>PictureMarkerSymbol default width and height</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132417#M12350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm wondering how to create a PictureMarkerSymbol by using the default width and height of the image.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even in the documentation it says the default values are the actual dimensions of the image, but at the same time the width and height are required values to enter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/javascript/jsapi/picturemarkersymbol-amd.html" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/javascript/jsapi/picturemarkersymbol-amd.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried entering null or empty string but that just generates undefined javascript errors for width and height&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can't the API can read those values from the image source itself?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really would prefer &lt;/SPAN&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;SPAN&gt; having to enter a specific size myself since the image sources dimensions can vary quite a bit from symbol to symbol (by 1 to 5 pixels for width and/or height) and I don't want them to be distorted. On top of that the image sources might change from time to time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Btw I currently generate images PNG sources by doing batch exporting in Inkscape with a single SVG that contains all the symbols. The exporter does not allow to specify a constant size (e.g. 20px x 20px) for the resulting images, it takes the size of the object itself. Thus my question here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 18:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132417#M12350</guid>
      <dc:creator>YohanBienvenue</dc:creator>
      <dc:date>2014-05-14T18:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: PictureMarkerSymbol default width and height</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132418#M12351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Unfortunately, the documentation is a bit misleading in this case. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no explicitly set default width and height for PictureMarkerSymbols. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The values *should be* the actual width and height of the image being used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I will bring this up with the documentation folks. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the meantime, it would be best if your symbols all used the same dimensions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
map.on("click", function(evt){
&amp;nbsp; // Remove old Graphics
&amp;nbsp; myGraphicsLayer.graphics.forEach(function(g){
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(g.visible === true)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myGraphicsLayer.remove(g);
&amp;nbsp; });
&amp;nbsp; 
&amp;nbsp; var symbol, point, graphic;
&amp;nbsp; var img = new Image();

&amp;nbsp; img.src = '../../uihlein/test/images/star.png';

&amp;nbsp; img.onload = function() {

&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol = new PictureMarkerSymbol('../../uihlein/test/images/star.png', this.width, this.height);
&amp;nbsp;&amp;nbsp;&amp;nbsp; point = new Point(evt.mapPoint.getLongitude(), evt.mapPoint.getLatitude());
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic = new Graphic(point, symbol);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; myGraphicsLayer.add(graphic);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.show(point);&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; }

});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not the best solution (it took two minutes to write and is more of a proof of concept).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I strongly encourage you to seek out alternative solutions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:25:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132418#M12351</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2021-12-11T07:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: PictureMarkerSymbol default width and height</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132419#M12352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok thanks for this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's alright I actually found an alternative in the last few minutes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found another export plugin for Inkscape that works a bit differently then the one I was using. Instead of exporting the selected symbols in the image sprite to individual files, it exports all the layers as separate images, using the layer size as the image size.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I gave my SVG a dimension of 20x20 and put all the symbols on seperate layers. This results in 20x20 images with the symbol centerd into it. So now I can have PictureMarkerSymbol with fixed 20x20 size even though my sources size can vary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Inkscape plugin, called ILBAEv0.1, can be found here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://www.inkscapeforum.com/viewtopic.php?f=34&amp;amp;t=15847" rel="nofollow" target="_blank"&gt;http://www.inkscapeforum.com/viewtopic.php?f=34&amp;amp;t=15847&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 18:58:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132419#M12352</guid>
      <dc:creator>YohanBienvenue</dc:creator>
      <dc:date>2014-05-14T18:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: PictureMarkerSymbol default width and height</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132420#M12353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That sounds much easier than my solution. I'm glad you found something better &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're satisfied, make sure you mark this thread as answered.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 19:02:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/picturemarkersymbol-default-width-and-height/m-p/132420#M12353</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-05-14T19:02:06Z</dc:date>
    </item>
  </channel>
</rss>

