More Questions about Select Routes using Geocoded address and 1/4 Mile Buffer

3966
8
Jump to solution
03-18-2015 07:56 AM
JohnRitsko
New Contributor III

Robert,

  I do have a few other questions (3) about my complete code for this project and was wondering if you wouldn't mind a little further guidance.

One:

I have a home button command that I'm trying to get to clear out the results from the results div tag.  Here is what I have that doesn't seem to work with this particular application. It gives me an error finding the (results.rows).  Any ideas how to clear out this data?

Here is my goHome.js

//
Resets the Map to its initial state with no routes selected and accordian pane back to default

    function goHome(){

     

      // Acitivates the Legend Accordian Tab

      var container = dijit.byId("container");

      container.selectChild("legendPane", true);

     

      // This will remove old values in Routes Within 1/4 Mile Div Tag

      var results = document.getElementById("results");

      var rowCount = results.rows.length;

      for (var x=rowCount-1; x>0; x--)
{

       results.deleteRow(x);

      }

     

      // Removes Any simpleLineSymbols and Any simplePointSymbols

      map.graphics.clear();

     

      // Closes any open infoWindows

      map.infoWindow.hide();

     

      // Zoom to Map Extent

      map.setExtent(mapExtent);

     

      // Clears any address entered into Address Search Box

      document.getElementById("search_input").value="";

    }

TWO:

When creating my busRoutes layer, I don't want the map to allow users to click anywhere and it say (No Information).  I also tried to use the on mouse-over for this layer and can't seem to get it to work.  Any ideas on this one.

//
Creating the Template for Bus Route

          busRouteContent = ("Name", "<tr><td><a
href='${TRAN_GD_PDF}'
target='_blank'>${NAME}</a></tr></td>");

          busRouteTemplate = new esri.InfoTemplate; 

        
busRouteTemplate.setContent(busRouteContent);

          busRouteTemplate.setTitle("Bus
Route: ${ROUTE}");

          busRoutes = new ArcGISDynamicMapServiceLayer("http://gis.rtcsnv.com/arcgis/rest/services/Maps/PROD_ADA_CERT/MapServer",
{id:"Routes"}); 

          busRoutes.setInfoTemplates({ 

            2: { infoTemplate: busRouteTemplate

          });

          busRoutes.setVisibleLayers([2]); 

          busRoutes.on("mouse-over", function()
{

            map.setMapCursor("pointer");

          });

          busRoutes.on("mouse-out", function()
{

            map.setMapCursor("default");

          });

THREE:

In my Legend list this dynamic map service layers shows up using the application name and then its layer name.  How can I remove the application part from the layer name.  It currently shows up as: PROD_ADA_CERT RTC Bus Routes.  I only want it to say RTC Bus Routes.

         

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

John,

  One. The simplest way to clear the results div is to use a line like this

dojo.byId("results").innerHTML = '';

Two. As the layer is added as a dynamic map service layer and not a featurelayer you do not get mouse events like mouse over and mouse out. The click event actually launches a querytask under the hood of the API to see if they have clicked on your features.

Three. The easiest way if to add this to the css

.esriLegendLayerLabel
    {
        display: none;
    }

View solution in original post

8 Replies
RobertScheitlin__GISP
MVP Emeritus

John,

  One. The simplest way to clear the results div is to use a line like this

dojo.byId("results").innerHTML = '';

Two. As the layer is added as a dynamic map service layer and not a featurelayer you do not get mouse events like mouse over and mouse out. The click event actually launches a querytask under the hood of the API to see if they have clicked on your features.

Three. The easiest way if to add this to the css

.esriLegendLayerLabel
    {
        display: none;
    }
JohnRitsko
New Contributor III

Robert,

One: Perfect thank you.

Two: I removed the on.mouse events as they are no longer needed, Thank you.

Three: When I added this to my css it removed the RTC Bus Routes label portion and left the Application name: PROD_ADA_CERT instead.  I'm not quite sure how to fix this as I only want the layer name (RTC Bus Routes).  Is there a way for me to manually name it somehow?

Also, is there a way to remove the (No Information Available) popup when the user clicks around on the map?  I have the measurement tool added to this application and when a user is measuring distance to walk to a bus stop this popup (No Information Available) pops up every time they click on the map.

Thank you again for the continued help.  Your help is greatly appreciated.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

John,

   Three. Not that I am aware of.

Measure widget. When you activate the measure widget you need to use

map.setInfoWindowOnClick(false);

and when the measure widget is done turn it back on

map.setInfoWindowOnClick(true);

JohnRitsko
New Contributor III

Robert,

Regarding the measurement widget.  I simply have the following code below.  I'm not sure where I would go about adding the code you supplied above.  Again, thanks so much

var measurement = new Measurement({

     map: map

     }, dom.byId("measurementDiv"));

measurement.startup();

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

John,

  In that case it is a little more:

     var measurement = new Measurement({
       map: map
     }, dom.byId("measurementDiv"));
     aspect.after(measurement, 'setTool', lang.hitch(this, function() {
        if (measurement.activeTool) {
          this.map.setInfoWindowOnClick(false);
        } else {
          this.map.setInfoWindowOnClick(true);
        }
      }));
      measurement.startup();

and of course you will need to require dojo/aspect

JohnRitsko
New Contributor III

NEVERMIND, FIXED IT.

Had to add the "dojo/_base/lang", lang as well. Duh!!!!!!!!!!!!

Robert,

Didn't want to bug you but I added this to my code and it's not working out for me, tried for most of the day now to figure it out with no luck.  Also, when I added this I lost some functionality that I have with Layers that I have a checkbox associated with.  I did add the "dojo/aspect", aspect as well.

Also, the Measurement tool allows me to select all of the values and none of them actually work.

issue.jpg

//
If user wants to see Paratransit Service Area this checks the checkbox to see if they turn it on or off

          document.getElementById("checkBox0").onclick = function() {

            if (this.checked) {

              paraSvcArea.show();

            }

            else {

              paraSvcArea.hide();

            }

          };

          // If user wants to see Flexible Demand Response (FDR) Service Area this checks the checkbox to see if they turn it on or off

          document.getElementById("checkBox1").onclick = function() {

            if (this.checked) {

              fdrSvcArea.show();

            }

            else {

              fdrSvcArea.hide();

            }

          };

          // If user wants to see Silverstar Routes this checks the checkbox to see if they turn it on or off

          document.getElementById("checkBox2").onclick = function() {

            if (this.checked) {

              silverstar.show();

            }

            else {

              silverstar.hide();

            }

          };

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

John,

  Sorry I forgot about that.

0 Kudos
JohnRitsko
New Contributor III

Robert,

  No worries at all you have been beyond helpful.  I've got to start a new discussion soon on a few other questions that I have that perhaps I'll be able to once again thank you.

Thanks again for all the help, it's greatly appreciated.  Have a great day.

0 Kudos