<?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: use  variable for distance in esri leaflet nearby?? in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1005277#M105</link>
    <description>&lt;P&gt;Thanks Gavin. I had to make it a global variable and use parseFloat to convert from string to integer. I have another question though about how to use onEachFeature to get the attribute for all features when using query.run. I will post it later.&lt;/P&gt;</description>
    <pubDate>Sat, 28 Nov 2020 07:50:37 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-11-28T07:50:37Z</dc:date>
    <item>
      <title>use  variable for distance in esri leaflet nearby??</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1003736#M103</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;How can I use a variable when using the nearby method on a query layer so the user can select the distance in a dropdown or is this not possible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a snippet of what I have:&lt;/P&gt;
&lt;P&gt;HTML&lt;/P&gt;
&lt;P&gt;&amp;lt;select id="buffer" name="buffer"&amp;gt;&lt;BR /&gt;&amp;lt;option value="60.96"&amp;gt;200 feet&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option value="152.4"&amp;gt;500 feet&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option value="213.36"&amp;gt;700 feet&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option value="304.8"&amp;gt;1000 feet&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/select&amp;gt;&lt;/P&gt;
&lt;P&gt;JAVASCRIPT&lt;/P&gt;
&lt;P&gt;var distance = document.getElementById("buffer").value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function myFunction() {&lt;BR /&gt;if ((document.getElementById("pm1").checked == true) &amp;amp;&amp;amp; (document.getElementById("tm1").checked == true)&amp;amp;&amp;amp; (document.getElementById("sr1").checked == true)){&lt;BR /&gt;pmquery.nearby(latlng, distance);&lt;BR /&gt;&lt;BR /&gt;pmquery.run(function (error, featureCollection, response) {&lt;BR /&gt;if (error) {&lt;BR /&gt;console.log(error);&lt;BR /&gt;return;&lt;BR /&gt;}&lt;BR /&gt;L.geoJSON(featureCollection).addTo(map);&lt;BR /&gt;console.log('Found ' + featureCollection.features.length + ' features');&lt;BR /&gt;map.fitBounds(L.geoJSON(featureCollection).getBounds());&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 20:18:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1003736#M103</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-08-25T20:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: use  variable for distance in esri leaflet nearby??</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1003963#M104</link>
      <description>&lt;P&gt;Yes that code looks like it should work. Make sure you check if your "distance" variable is actually defined within your function. You can use console.log to see if the value is defined. As a quick attempt, you could also move the line&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var distance = document.getElementById("buffer").value;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;within your function "myFunction"&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 14:46:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1003963#M104</guid>
      <dc:creator>GavinRehkemper</dc:creator>
      <dc:date>2020-11-23T14:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: use  variable for distance in esri leaflet nearby??</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1005277#M105</link>
      <description>&lt;P&gt;Thanks Gavin. I had to make it a global variable and use parseFloat to convert from string to integer. I have another question though about how to use onEachFeature to get the attribute for all features when using query.run. I will post it later.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 07:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/use-variable-for-distance-in-esri-leaflet-nearby/m-p/1005277#M105</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-11-28T07:50:37Z</dc:date>
    </item>
  </channel>
</rss>

