AnsweredAssumed Answered

Can Esri maps create a legend without using a URL

Question asked by forcefromabove on Dec 6, 2017

(Reference 1) When looking at legends for esri maps, the only thing that is required is the reference to the map. When I tried that it said "no legend" in the upper right hand corner, which is fair enough. When I tried to insert information, it seemed the only way to do that was with the layerInfos (object[]) that requires FeatureLayer (Reference 2). I tried using a InfoTemplate, but it didn't seem to work (possibly my fault, I am new to Esri maps).

 

For Layer/FeatureLayer (Reference 3 & 4) it appears that it requires a URL to function, or at least some connection to a external database for information related to that layer. I do not have a URL for this, I am just looking for "this blue dot means this, red dots mean this" etc.

 

My question is what is the best way to make a legend while keeping it internal? I feels like the best thing to do is ignore legends entirely and just do a visual InfoTemplate that is stuck to the upper right hand corner, but that seems like a unnecessary work around.

 

Reference 1:

Legend | API Reference | ArcGIS API for JavaScript 3.22 

Reference 2:

Legend | API Reference | ArcGIS API for JavaScript 3.22 

Reference 3:

Layer | API Reference | ArcGIS API for JavaScript 3.22 

Reference 4:

FeatureLayer | API Reference | ArcGIS API for JavaScript 4.5 

Outcomes