Getting a string.substitute could not find key "layername" in template error when trying to initalize CreateDriveTimeAreas

821
2
04-10-2017 06:37 AM
JoePiasente
New Contributor

I am trying to create drive time areas for a point.  When I call the routine that calls the code I get the following error:

string.substitute could not find key "layername" in template.  I am following the scarce documentation for this so this is what I am doing

var params =
{
id: "analysisTool",
inputLayer: myLayer,
portalUrl: "https://www.arcgis.com",
showHelp: false,
map: map,

}

 var analysisTool = new CreateDriveTimeAreas(params, "driveTimesDiv");

The code breaks when it calls the instantiation of the CreateDriveTimesAreas.

Can anyone please tell me what I am doing wrong here?

0 Kudos
2 Replies
WilliamHynes
New Contributor

Joe Piasente‌ I as well am stuck with the similar issue. I tried creating a new FeatureLayer from URL with additional options but did not succeed. Were you able to find any solution or further reference for above error?

0 Kudos
MattNicol
New Contributor III

If you add a "name" property to your input layer, you'll work around there.  In the CreateDriveTimeAreas code, "layername" is set to your inputLayer.name.  Layers from ArcGIS Online have this.  Layers created from instantiating your own FeatureLayer do not.

Basically, add:

myLayer.name = "Some name";

Unfortunately, in my own case, I still could not get CreateDriveTimeAreas to work, but the step above did get rid of that "layername" error message for me.

0 Kudos