<?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: ArcGIS JS irregularly initiating search and more in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558763#M52124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes! Actually, there was one bug - Geocoder was being instantiated too early for some reason. But, I found the issue - the Geocoder class was occasionally being overwritten by an instance of Fastclick, so I removed the Fastclick library and it worked like a charm. Very weird!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Apr 2015 21:30:51 GMT</pubDate>
    <dc:creator>WilliamRiley</dc:creator>
    <dc:date>2015-04-30T21:30:51Z</dc:date>
    <item>
      <title>ArcGIS JS irregularly initiating search and more</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558761#M52122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello! I'm having a big time issue with the ARCgis Javascript. &lt;SPAN style="line-height: 1.5;"&gt;For some reason, occasionally when I refresh the page, the map will not instantiate the Geocoder element or hide the layers after the defferred map is instantiated. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Here's the code: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;require([
&amp;nbsp; "dojo/parser", "dojo/ready", "dojo/dom-construct", "esri/config", "dojo/_base/connect",
&amp;nbsp; "esri/Color", "dijit/layout/ContentPane", "esri/dijit/Geocoder",
&amp;nbsp; "dojo/dom", "esri/map", "esri/urlUtils", "esri/arcgis/utils",
&amp;nbsp; "esri/tasks/query", "esri/tasks/QueryTask", "esri/tasks/Geoprocessor", "esri/tasks/FeatureSet",
&amp;nbsp; "esri/geometry/webMercatorUtils", "esri/geometry/Point", "esri/graphic","esri/geometry/Extent",
&amp;nbsp; "esri/dijit/Legend", "esri/dijit/Scalebar", "dijit/TooltipDialog",
&amp;nbsp; "esri/dijit/Popup", "esri/dijit/PopupTemplate", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/PictureMarkerSymbol",
&amp;nbsp; "dojo/domReady!"
&amp;nbsp; ], function (
&amp;nbsp; parser, ready, domConstruct, esriConfig, connect,
&amp;nbsp; Color, ContentPane, Geocoder,
&amp;nbsp; dom, Map, urlUtils, arcgisUtils,
&amp;nbsp; Query, QueryTask, Geoprocessor, FeatureSet,
&amp;nbsp; webMercatorUtils, Point, Graphic, Extent,
&amp;nbsp; Legend, Scalebar, TooltipDialog,
&amp;nbsp; Popup, PopupTemplate, SimpleMarkerSymbol, PictureMarkerSymbol
&amp;nbsp; ) {
&amp;nbsp; ready(function() {


&amp;nbsp; window.Point = Point;
&amp;nbsp; window.webMercatorUtils = webMercatorUtils;
&amp;nbsp; window.Graphic = Graphic;


&amp;nbsp; esriConfig.defaults.map.panDuration = 1;
&amp;nbsp; esriConfig.defaults.map.panRate = 1;
&amp;nbsp; esriConfig.defaults.map.zoomDuration = 100;
&amp;nbsp; esriConfig.defaults.map.zoomRate = 1;
&amp;nbsp; esriConfig.defaults.map.slider = {left: null, right: "30px", top: null, bottom:"30px", width: null, height: "200px" };


&amp;nbsp; parser.parse();


&lt;SPAN&gt;&amp;nbsp; window.ourQueryTask = new QueryTask("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://gis.dogis.org/arcgis/rest/services/Public_Works/Parking_Facilities/MapServer/1" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gis.dogis.org/arcgis/rest/services/Public_Works/Parking_Facilities/MapServer/1&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;
&amp;nbsp; window.ourQuery = new Query();
&amp;nbsp; window.ourQuery.returnGeometry = false;
&amp;nbsp; window.ourQuery.spatialRelationship = esri.tasks.Query.SPATIAL_REL_CONTAINS;
&amp;nbsp; window.ourQuery.outFields = ["*"];


&amp;nbsp; function mercator_to_lat_lon(mercX, mercY) {


&amp;nbsp; var rMajor = 6378137;
&amp;nbsp; var shift&amp;nbsp; = Math.PI * rMajor;
&amp;nbsp; var lon&amp;nbsp;&amp;nbsp;&amp;nbsp; = mercX / shift * 180.0;
&amp;nbsp; var lat&amp;nbsp;&amp;nbsp;&amp;nbsp; = mercY / shift * 180.0;
&amp;nbsp; lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0);


&amp;nbsp; return { 'Lon': lon, 'Lat': lat };
&amp;nbsp; }


&amp;nbsp; var defferredMap = arcgisUtils.createMap("8e298b55535548f4bcba1adf160111b5", "map", {
&amp;nbsp; mapOptions: {
&amp;nbsp; basemap: "topo",
&amp;nbsp; center: [-95.9406, 41.2600],
&amp;nbsp; minZoom: 15,
&amp;nbsp; smartNavigation: false,
&amp;nbsp; navigationMode: 'classic',
&amp;nbsp; zoom: 16,
&amp;nbsp; maxZoom: 18,
&amp;nbsp; slider: true,
&amp;nbsp; force3DTransforms: false,
&amp;nbsp; isScrollWheelZoom: false,
&amp;nbsp; isShiftDoubleClickZoom: true,
&amp;nbsp; isZoomSlider: true,
&amp;nbsp; isPan: false,
&amp;nbsp; showAttribution: false,
&amp;nbsp; displayGraphicsOnPan: true,
&amp;nbsp; logo: false,
&amp;nbsp; }
&amp;nbsp; });


&amp;nbsp; defferredMap.then(function(response) {


&amp;nbsp; window.map = response.map;


&amp;nbsp; map.disableMapNavigation();
&amp;nbsp; map.enableDoubleClickZoom();
&amp;nbsp; map.enablePan();


&amp;nbsp; var resizeTimer;


&amp;nbsp; var legendLayers = arcgisUtils.getLegendLayers(response);


&amp;nbsp; var legendDijit = new Legend({
&amp;nbsp; map: map,
&amp;nbsp; layerInfos: legendLayers
&amp;nbsp; },"legend");


&amp;nbsp; layers = legendLayers;


&amp;nbsp; var custom_geocoder = {
&amp;nbsp; placeholder: 'Filter by Venue',
&amp;nbsp; };


&amp;nbsp; var search_element = new Geocoder({
&amp;nbsp; arcgisGeocoder: custom_geocoder,
&amp;nbsp; autoComplete: true,
&amp;nbsp; map: map
&amp;nbsp; }, dom.byId("search"));


&amp;nbsp; search_element.startup();


&amp;nbsp; search_element.on("select", showLocation);


&amp;nbsp; function showLocation(evt) {
&amp;nbsp; map.graphics.clear();
&amp;nbsp; var point = evt.result.feature.geometry;
&amp;nbsp; var symbol = new PictureMarkerSymbol("&amp;lt;?php echo get_template_directory_uri(); ?&amp;gt;/assets/img/pin_all.svg", 32, 40)
&amp;nbsp; var graphic = new Graphic(point, symbol);
&amp;nbsp; map.graphics.add(graphic);
&amp;nbsp; };


&amp;nbsp; setTimeout(function() {
&amp;nbsp; $('.checkbox:first', '#onstreet').click();


&amp;nbsp; $('.find-me').on('click', function() {
&amp;nbsp; $(this).addClass('searching');
&amp;nbsp; if (navigator.geolocation) {
&amp;nbsp; if (typeof geocoder !== "undefined") {
&amp;nbsp; navigator.geolocation.getCurrentPosition(success_geo, errorFunction);
&amp;nbsp; } else {
&amp;nbsp; get_map_location();
&amp;nbsp; navigator.geolocation.getCurrentPosition(success_geo, errorFunction);
&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; });


&amp;nbsp; $(".esriPopupWrapper").bind("DOMSubtreeModified", window.update_our_popup);
&amp;nbsp; }, 3000)
&amp;nbsp; }, function (error) {
&amp;nbsp; alert("Error: ", error.code, " Message: ", error.message);
&amp;nbsp; defferredMap.cancel();
&amp;nbsp; });




&amp;nbsp; map.on("load", function(theMap) {
&amp;nbsp; $('#meters_all').click();
&amp;nbsp; });
});
});&lt;/PRE&gt;&lt;P&gt;Any ideas? I've completely rebuilt this 3 different times, really stuck here. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:07:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558761#M52122</guid>
      <dc:creator>WilliamRiley</dc:creator>
      <dc:date>2021-12-12T00:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS irregularly initiating search and more</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558762#M52123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't reproduce the issue with the code you provided. Here's a jsbin showing your code and the search displays each time I run the app. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsbin.com/vozadacaka/1/" style="line-height: 1.5;" title="http://jsbin.com/vozadacaka/1/"&gt;http://jsbin.com/vozadacaka/1&lt;/A&gt;&lt;SPAN style="line-height: 1.5;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;If you run your app with the developer console open are there any errors? &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 21:27:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558762#M52123</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-04-30T21:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS irregularly initiating search and more</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558763#M52124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes! Actually, there was one bug - Geocoder was being instantiated too early for some reason. But, I found the issue - the Geocoder class was occasionally being overwritten by an instance of Fastclick, so I removed the Fastclick library and it worked like a charm. Very weird!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 21:30:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-irregularly-initiating-search-and-more/m-p/558763#M52124</guid>
      <dc:creator>WilliamRiley</dc:creator>
      <dc:date>2015-04-30T21:30:51Z</dc:date>
    </item>
  </channel>
</rss>

