0

How to set the the following service api to the state boundary on the map.

https://esri.maps.arcgis.com/home/item.html?id=045485554d804e47b7972e49adacb4b8

Because I call the service url in the angular but the map keep showing the country boundary instead of the state boundary. Anyone can help me to solve this problem?

This is what I trying to do

enter image description here

This is what I get

enter image description here

This is the code: enter image description here

I guess it is something related to the layers attribute in the picture below, I just don't know how to choose the attribute there: enter image description here

kiku
  • 147
  • 1
  • 10

1 Answers1

0

That feature service has three layers. You can specify which one to use in the "url" parameter. If you don't point to a specific one, it will default to the first one - which in this case is the "country" layer - "0".

In the URL to the FeatureLayer, change the ending from FeatureLayer to FeatureLayer/1 to display the Malaysia Negeri Boundaries.

You'll probably also want to set the transparency on that layer and/or change the default renderer that layer has.

https://www.arcgis.com/home/item.html?id=b7fda90324624e3b971fe98810be4091

Bjorn Svensson
  • 815
  • 8
  • 21
  • Ok,i get it already. Just to make it more clear on here. You can add an attribute `layerId` that is under the `FeatureLayer` constructor to declare which layer you actually want in your scenario. – kiku Nov 02 '21 at 01:18
  • Yes @kiku, you can either specify it in the `layerId` property OR as part of the URL. Doing it in the URL is more backward compatible with older API version. Either way will work. – Bjorn Svensson Nov 02 '21 at 16:15
  • by the way, you did mention that also can change the default renderer. Do you have the link to the documentation about the renderer because I couldn't find the documentation @Bjorn – kiku Nov 03 '21 at 03:06
  • @kiku - you might find these useful starts: https://developers.arcgis.com/javascript/latest/visualization/ https://developers.arcgis.com/javascript/latest/style-a-feature-layer/ – Bjorn Svensson Nov 03 '21 at 22:00