Unable to make "navigate map journal sections using main stage map" customization work.

259
2
Jump to solution
10-29-2018 11:58 AM
New Contributor

Hi,

My intent was to create a map journal with links from a main map to the sections of the journal, I'm pretty new to storymaps and javascript so I'm sure I made some mistakes.  I followed Cooper Thomas's tutorial - https://developerscorner.storymaps.arcgis.com/navigate-map-journal-sections-using-the-mainstage-map-... .   I have used a map with a singe feature layer to navigate to a few sections in the sidebar in the map journal.  When run on local test server it doesn't navigate to the section.  Here is the custom-scripts.js file- (copied from the tutorial)

define(["dojo/topic"], function(topic) {
/*
* Custom Javascript to be executed while the application is initializing goes here
*/
// The application is ready
topic.subscribe("tpl-ready", function(){
/*
* Custom Javascript to be executed when the application is ready goes here
*/
});
var WEBMAP_ID = "11a773702bd14ab2a2a78ea25ad00536",
LAYER_ID = "csv_755";
var clickHandlerIsSetup = false;
topic.subscribe("story-loaded-map", function(result){
if ( result.id == WEBMAP_ID && ! clickHandlerIsSetup ) {
var map = app.maps[result.id].response.map,
layer = map.getLayer(LAYER_ID);
if ( layer ) {
layer.on("click", function(e){
var index = e.graphic.attributes["StoryIndex"];
topic.publish("story-navigate-section", index);
});
}
}
});
});

 the appid is - dffdedb3027143c5b9394bb7881d201

Is there a problem with the layer?  I uploaded a csv file to create the layer in the online mapviewer.

Thank you

Craig Smith

Reply
0 Kudos
1 Solution

Accepted Solutions
New Contributor

Thank you for getting back to me Cooper,

It worked! Thank you so much, I'm glad it was an easy fix. I really

appreciate your tutorials on medium and the geonet resources for

storymaps. We'll be using our storymap in conjunction with WYES in New

Orleans to give teachers and students some exposure and resources about the

Mississippi River.

again, thank you!!!

Craig Smith

View solution in original post

2 Replies
New Contributor III

Hey Craig, 

Thanks for the note. I've conferred with our developers, and we think we've identified the cause of the issue: when users upload CSVs to their maps via online web map viewer, the ArcGIS JavaScript API automatically appends _0 to the layer ID. So, in custom-scripts.js, you should reference csv_755_0 instead of csv_755 for the layer ID.

Give this a try, and let us know if it works! I'll make a note to update the tutorial accordingly. 

New Contributor

Thank you for getting back to me Cooper,

It worked! Thank you so much, I'm glad it was an easy fix. I really

appreciate your tutorials on medium and the geonet resources for

storymaps. We'll be using our storymap in conjunction with WYES in New

Orleans to give teachers and students some exposure and resources about the

Mississippi River.

again, thank you!!!

Craig Smith

View solution in original post