Select to view content in your preferred language

Manage results from multiple queries sandbox example setup

1552
10
03-18-2018 01:04 PM
MaddyKelley
Deactivated User

Manage results from multiple queries | ArcGIS API for JavaScript 3.23 

I am interested in modifying the API javascript example above. I am confused on the maps and data the example is referencing. I have an ArcOnline map ready to go with shared polygon data. When I try to change the referenced map and data below the app breaks. I think I might be using the wrong formats. My map and data aren't 'Map Servers'. 

Any help would be appreciated

Sandbox example:

My web map:

http://dugis.maps.arcgis.com/home/webmap/viewer.html?webmap=e350b9fa73314f78b356aef06fc6308d 

0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus

Maddy,

   The web map link you shared in this thread is not public so I can not view the layers you are using in that web map. The fact that your layer are likely FeatureServer service vs MapServer services like the sample is not going to be an issue. Are the services you are using in your web map shared publicly?

0 Kudos
MaddyKelley
Deactivated User

Hmm, maybe that is part of the problem? When I check the map and the two layers it contains, all items say they are shared. See below.

Any recommendations?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Maddy,

   So the layers are public but the web map seems like it is not so I can not look at the web map to get to the layer urls.

0 Kudos
MaddyKelley
Deactivated User

Thanks Robert for all your help. I again checked the map and it shows the same thing as above- shared with Everyone (public).

I'll try searching other places on GeoNet for a solution.

Best!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

OK, it seems that your whole org is not public and that is why I am getting challenged to log in when trying to access your web map.

0 Kudos
MaddyKelley
Deactivated User

Ah! I figured it out. Here is the correct URL for the map.

https://www.arcgis.com/home/webmap/viewer.html?webmap=8e5f8705d24943eebc1c18ff18d1dc55&extent=-105.5... 

But the problem remains after I use these new URLs. At this point, I am not accepting the query function to work (more changes still needed). But shouldn't the map load?

/////////////////////////////////////////////////////////////

// Modified MMK now my map
app.map = new Map("map");
var basemap = new ArcGISDynamicMapServiceLayer("https://www.arcgis.com/home/webmap/viewer.html?webmap=8e5f8705d24943eebc1c18ff18d1dc55&extent=-105.5...");
app.map.addLayer(basemap);

// query task and query for parcels
//modified my MMK now BOCO building footprint polygons
app.qtParcels = new QueryTask("https://services1.arcgis.com/44C95LOqZjbh8Row/arcgis/rest/services/BuildingRelateDepth/FeatureServer...");
app.qParcels = new Query();

// query task and query for landuse
//modified by MMK now table for attribute query
app.qtBuildings = new QueryTask("https://services1.arcgis.com/44C95LOqZjbh8Row/arcgis/rest/services/BuildingRelateDepth/FeatureServer...");
app.qBuildings = new Query();

///////////////////////////////////////////////////////////

My continuous thanks!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Maddy,

   Do you not have a parcel polygon layer to use in this sample? It looks like one of your urls is building footprints but the other is just a related table. As Munachiso is stating in their response you can not use a web map url as the url for a ArcGISDynamicMapServiceLayer.

0 Kudos
MunachisoOgbuchiekwe
Regular Contributor

Hello Maddy, 

I would use this example instead (https://developers.arcgis.com/javascript/3/jssamples/ags_createwebmapid.html). Looking at your past responses, it seems you are trying to load in a webmap using a ArcGISDynamicMapServiceLayer class which will not work. If you want to load a webmap from Arcgis online then you would use arcgisUtils.createMap().  Then you can add any layers you want to the web map. 

0 Kudos
MaddyKelley
Deactivated User

Thanks, Munachiso and Robert. So I guess maybe I explain the larger project since it seems the example I am basing everythign off of might not be the best fit. I am try to develop a simple web app that calculates cost based off a polygon layer and hosted table. Once a user selects their building, the polygons attributes are should select (query) the appropriate $%. The design flow is:

  1. Configure a basic map view with layers with a table in the bottom right. 
    1. The table should have two buttons: get the percentage (query); calculation (simple a * b function)
  2. When a user clicks a polygon
    1. Onclick action on the map: get the selected feature with the sample query example
    2. get the selected feature and the attributes of the features
      1. Polygon: attribute A, attribute B
  3. Function for “percentage”: need to click the button---query operations give attriubte C(from table)
    1. on(dom.byId("execute"), "click", execute)?
    2. Function for calculation
      1. attriubte A* C

This is why I was interested in modifying:

Manage results from multiple queries | ArcGIS API for JavaScript 3.23 

But I will try working with a simpler example first.

ArcGIS API for JavaScript Sandbox  

Thanks again! I would welcome any additional advice,

0 Kudos