Demographic Layer question.

3626
14
05-14-2015 05:17 AM
DanielMclaglen1
New Contributor II

Hi

I have a situation where I want to add an Esri created demograhics layer to my map via jScript and I am not sure on how best to do this or which objects to use (Feature layer, ArcGISDynamicMapServiceLayer or an other).

I can get the "base layer" to load using the following code

var demographicsLayerURL = "https://demographics5.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2015/MapServer";

var demographicsLayer = new ArcGISDynamicMapServiceLayer(demographicsLayerURL);

mapresponse.addLayer(demographicsLayer);

This works to load the "base layer" but what I am trying to do is load it as a layer showing "Unemployment figures". When I look at the URL for the Unemployment figures it looks like this

"https://demographics5.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2015/MapServer​?ts=[SOMEID]"

In effect I simply want to add the below layer to my map in jScript.

http://www.arcgis.com/home/item.html?id=3c7feb94f97c47929292698b3544f07e

Apologies if this is not clear.

Ta,

D

0 Kudos
14 Replies
TimWitt2
MVP Alum

Daniel,

I would just add this specific layer as a feature layer. Which makes it available for click events and such.

FeatureLayer | API Reference | ArcGIS API for JavaScript

Tim

0 Kudos
DanielMclaglen1
New Contributor II

Hi Tim

Yup I thought feaure layer might be the ticket however how do I figure out what the URL is?

I have tried the URL with the appended query string of ?ts=[SOMEID] but with no joy.

Also tried using this as the URL : http://www.arcgis.com/home/item.html?id=3c7feb94f97c47929292698b3544f07e

Thanks for taking the time to respond.

D

TimWitt2
MVP Alum

On what level do you want to show this data, block/county/state?

0 Kudos
DanielMclaglen1
New Contributor II

Any will do at this stage as just want to show it as a POC.

Realised I had the wrong item in the original post and this is the actual one : http://www.arcgis.com/home/item.html?id=47854b8eccbf40e1a324dbebc83ba9d4

Pretty similar layer to the other one.

0 Kudos
DanielMclaglen1
New Contributor II

Ok ok I see but where on earth are you look to get the additional ID's from?

Are you looking in here : https://demographics5.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2015/Mapserver

When I click on things in here I get infinite loop re-directs.

How would also know that UNEMPRT_CY is the unemployment rate field (at the moment I can't even see where this is and how you map that back to and ID).

Ta,

D

0 Kudos
TimWitt2
MVP Alum

Here is the list of all layers:

http://demographics5.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2015/MapServer?...

When you click on one of the layers just use control + f and type in unemploy to find the field you need.

Tim

DanielMclaglen1
New Contributor II

Hi Tim

Right ok now explains why I can't find it as when I goto that link my browser just goes into infinite loop redirects so that page never opens for me.

I have tried both Chrome and IE and on multiple machines. What happens is it redirects to login page, I login and then into the infinite loop redirects.

No idea why this happens.

Ta,

D

0 Kudos
TimWitt2
MVP Alum

You need an organizational or developer account to access this data. You wont be able to use it with a free ArcGIS Online account.

0 Kudos