AnsweredAssumed Answered

javascript map periodically fails to load

Question asked by ssdema on Jul 30, 2014
Latest reply on Jul 30, 2014 by ssdema

I am using along with JavaScript to develop a webpage that will display a map,


Basically, I am loading an image service and a map service, selecting a feature and zooming to that feature.  The code works about 90% of the time. When it does fail, it will load the map service and zoom to the proper extent, but it DOES NOT load the image service or select a feature.


It appears the instigator either the query or the or the feature selection - if I remove the call to doMaps(), the code never fails.

Does anyone have any experience in this area?


I have attached two images as examples.  This is the code I am using:          


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<head >

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">


    <script src="" type="text/javascript"></script>


       var MN, ParcelMap, sfs, queryTask;

       var featurelayer;


        function (Map, on, parser, ArcGISDynamicMapServiceLayer, ArcGISImageServiceLayer, SimpleRenderer, connect, dom, query, Graphic, FeatureLayer) {




            queryTask = new esri.tasks.QueryTask("http://MapServer/2");

            MN = "5"

            //define maps

            ParcelMap = new esri.Map("ParcelMap");


            var layer1 = new esri.layers.ArcGISImageServiceLayer("http://ImageServer");


            var layer2 = new esri.layers.ArcGISDynamicMapServiceLayer("http:///MapServer");



            ParcelMap.on("load", doMaps());


            function doMaps() {

                sfs = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 255, 255]), 2));

                //create selection layer

                featureLayer = new esri.layers.FeatureLayer("http://MapServer/2", {

                    mode: esri.layers.FeatureLayer.MODE_SELECTION




                //add selection layer to map


                //set up query

                query = new esri.tasks.Query();

                query.returnGeometry = true;

                query.where = "MAP_NO = '" + MN + "'";


                //select parcel

                featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {

                    if (features.length == 0) {

                        alert("No Parcel Found");


                    else {

                        //zoom to the selected feature

                        parcelExtent = features[0].geometry.getExtent().expand(1.5);








<body class="tundra">

    <form id="form1" runat="server">

        <div id="ParcelMap" style="width:400px; height:400px;runat="server"></div>