Hello -
I am trying to use an external service (https://onemap.cdc.gov/onemapservices/rest/services/EJI/EJI_2024_Data_Service/MapServer/0) in my ArcGIS Online Dashboard data expression, but don't seem to be setting it up right. Can someone tell me where I am going wrong?
// Identifies the portal.
var port = Portal('https://onemap.cdc.gov/onemapservices/rest/services/EJI/EJI_2024_Data_Service/MapServer');
//Pulls in the map image service and limits it to the fields required and filters the records to those in Ohio and relevant counties.
var fs = filter(FeatureSetByPortalItem(port, 0,
['GEOID', 'RPL_EJI_CBM', 'RPL_EBM', 'RPL_CBM', 'RPL_SVM', 'RPL_HVM', 'EPL_OZONE', 'EPL_PM', 'EPL_DSLPM', 'EPL_TOTCR', 'EPL_NPL', 'EPL_TRI', 'EPL_TSD', 'EPL_RMP', 'EPL_LEAD', 'EPL_COAL', 'EPL_PARK', 'EPL_HOUAGE', 'EPL_WLKIND', 'EPL_ROAD', 'EPL_RAIL', 'EPL_AIRPRT', 'EPL_IMPWTR', 'EPL_NEHD', 'EPL_SMOKE', 'EPL_BURN', 'EPL_GRGT', 'EPL_RFLD', 'EPL_CFLD', 'EPL_TRND', 'EPL_HRCN', 'EPL_SWND', 'EPL_MINRTY', 'EPL_POV200', 'EPL_NOHSDP', 'EPL_UNINSUR', 'EPL_NOINT', 'EPL_AGE65', 'EPL_AGE17', 'EPL_DISABL', 'EPL_LIMENG', 'EPL_GROUPQ', 'EPL_MOBILE', 'EPL_CHD', 'EPL_ASTHMA', 'EPL_CANCER', 'EPL_DIABETES', 'EPL_MHLTH'],
false),
"(STATEABBR='OH' AND (COUNTY IN('LAKE COUNTY', 'CUYAHOGA COUNTY', 'SUMMIT COUNTY', 'LORAIN COUNTY', 'MEDINA COUNTY', 'GEAUGA COUNTY')))"
);
Thanks!
I think you have the portal reference set up incorrectly - here's the pattern I am using for a case where I am using a portal item like you are attempting - you have to tell it what portal (essentially the website) you are getting data from, the next line for fs_beds gives the item number of the specific feature layer or table you are trying to use. I haven't tried this by referencing a rest service directly so I'm not sure if that will work. One thing you can do is create an item in your AGOL that references that REST service you are wanting to use, then use the item as I've done below in your Arcade script. Hopefully someone better at Arcade than I will chime in!
var portal_agol = Portal("https://****.maps.arcgis.com/") // note, the **** is the name of the AGOL org
var fs_beds = FeatureSetByPortalItem(portal_agol, '4ebc62fe425c42ad909b1f30029ded55',['*'])
@clt_cabq Thanks for your response. I think it is related to the rest service - I am not sure how to set that up to pull in the data. Unfortunately, creating an item in our AGOL is not the preferred option.
I have updated the first part of the code to the below (there are no errors showing up in this section or the rest of the code, I just get "Test execution error: Unknown Error. Verify test data." when I try to run it).
// Identifies the portal.
var port = Portal('https://onemap.cdc.gov/onemapservices/rest/services/EJI/EJI_2024_Data_Service/MapServer');
//Pulls in the map image service and limits it to the fields required and filters the records to those in Ohio and relevant counties.
var fs = filter(FeatureSetByPortalItem(port, 'c38778176a6b4a65940ffe77c192eded', 0,
['GEOID', 'STATEABBR', 'COUNTY', 'RPL_EJI_CBM', 'RPL_EBM', 'RPL_CBM', 'RPL_SVM', 'RPL_HVM', 'EPL_OZONE', 'EPL_PM', 'EPL_DSLPM', 'EPL_TOTCR', 'EPL_NPL', 'EPL_TRI', 'EPL_TSD', 'EPL_RMP', 'EPL_LEAD', 'EPL_COAL', 'EPL_PARK', 'EPL_HOUAGE', 'EPL_WLKIND', 'EPL_ROAD', 'EPL_RAIL', 'EPL_AIRPRT', 'EPL_IMPWTR', 'EPL_NEHD', 'EPL_SMOKE', 'EPL_BURN', 'EPL_GRGT', 'EPL_RFLD', 'EPL_CFLD', 'EPL_TRND', 'EPL_HRCN', 'EPL_SWND', 'EPL_MINRTY', 'EPL_POV200', 'EPL_NOHSDP', 'EPL_UNINSUR', 'EPL_NOINT', 'EPL_AGE65', 'EPL_AGE17', 'EPL_DISABL', 'EPL_LIMENG', 'EPL_GROUPQ', 'EPL_MOBILE', 'EPL_CHD', 'EPL_ASTHMA', 'EPL_CANCER', 'EPL_DIABETES', 'EPL_MHLTH'],
false), "(STATEABBR='OH' AND (COUNTY='LAKE COUNTY' OR COUNTY='CUYAHOGA COUNTY' OR COUNTY='SUMMIT COUNTY' OR COUNTY='LORAIN COUNTY' OR COUNTY='MEDINA' OR COUNTY= 'GEAUGA COUNTY'))"
);
I suspect that you can't use the portal function to return a feature set from a REST endpoint like this - the Arcade documentation suggest that is used only for AGOL and Enterprise Portals. That could just be my limited knowledge of Arcade though.
Can you just add the layer into your map from its URL and work with it from there?
@clt_cabq I expect the same. It doesn't look like you can write a data expression using a layer from a map unfortunately. I want to use the data expression to filter the field list down so it has a better response time. The layer is quite large both field number and record number (I did filter the records in the map) so the dashboard is running quite slow. I did try pulling it into our AGO and the data expression works and the dashboard has a much better response time.