Open rossthedevigner opened 9 years ago
The idea is that ArcGIS Online does not allow you to insert the link that Map Journal require but if you are able to create your data outside of ArcGIS Online like for example in a CSV and insert to the webmap, those links will work. One way to do it is to have one attribute of the layer that contains those links and then to configure the popup to use that attribute.
Please see this thread for more https://geonet.esri.com/thread/118904 Note this works well for points geometry, we are using it all the time, but we don't have experience doing it for line and polygon and that user hasn't been able to do it.
I read through the forum post and it provided some good insight. Is there a sample CSV in creating those links? Can you create links on the actual marker and not within the popup for the marker (like in the Bee Story).
Great. Yes you can access the CSV here (a bit buried in the post) https://gist.githubusercontent.com/glazou/72900f70e6192bdb9dac/raw/5eae0bee65e197a055c4f7484bf27c4332324520/MapJournal-popup-section-nav.csv
Make the navigation by clicking the markers require to customize Map Journal.
I was able to successfully use the sample CSV to create the link from within the popup. I assume to be able to recreate the map point behavior links from the Bee Story, it would take a bit more customization to the app itself?
Great. Yes directly clicking on the map marker would require to download, customize the application and host it yourself.
An updated procedure to do this is documented here https://github.com/Esri/map-journal-storytelling-template-js#link-between-sections
I'm a complete newbie with this app: trying also to implement the ability to navigate from the map back to a story section. I created an attribute in my webmap feature that has the code as shown in your sample CSV file as above. In the storymap popup, it shows as a hyperlinked phrase, but clicking on it does not advance to the section. I think after Mar 2015, this functionality was replaced by adding code to the index.html file of the sourcecode? However, I'm having trouble deciphering where to get my layer ID to add the click handler on the map feature. I have the webmap_ID. Your help explains:
/ Configure the webmap id and layer id
// To get the layer id, just configure the webmap and run the application,
// all the layer ids of your webmap will be printed in the console
Please elaborate on "configure the webmap and run the application". Do you mean run the mapstory after configuring the webmap it uses? or run the webmap?!
Can you explain where the 'console' is? Is this something i get from ArcGISOnline, or the java console? I have tried entering various iterations of the layer name and am not being successful. My webmap is a point layer.
I will try to help you but as you notice this unfortunately require developer skills as the procedure with CSV is not supported anymore :/
The steps are:
Good luck, let us know how it goes :)
Thank you! Yes, I have previously downloaded the application sourcecode, deployed it on a webserver, and obtained the application ID. I built the initial story map using the builder, but when I realized I wanted to add this customization I downloaded the sourcecode.
So, I do already have my Application ID and my webmap ID, and I have cut/paste the entire bit of code into the index.html file, inserting those two pieces. Still cannot seem to find the layer_id’s though, even when looking at the console achieved by pressing F12 while looking at the home section of my storymap.
Perhaps if you look at the app it would help? Unfortunately right now though, it is not publically shared as it is in development still…
Below is the webmap_id of my webmap which I have included in the index.html file . But in the console I cannot find anything that looks like layer_ids? I commented out the layer_id line for now since I didn’t know what to put in there…
Set up a click handler on the feature of the map to navigate the story */
// Configure the webmap id and layer id
// To get the layer id, just configure the webmap and run the application,
// all the layer ids of your webmap will be printed in the console
var WEBMAP_ID = "eff825ecea244997826d0de595fbbdd2",
//LAYER_ID = "featureServer_0";
I’m not sure if this will be useful, but attached is a screen cap of what I see in the console when viewing the app and again, I don’t see anything that looks like layers referenced, though it does show the appID and the webmap_ids… There seem to be lots of error messages!
Thanks for trying to help!
Cool you should almost be there, is your map displaying in the app?
This error may indicate that one of the map layer is not accessible.
Your issue may just be that you have commented LAYER_ID. Does it works if you don't comment it?
The layer ids should be displayed just before or after the second error.
Int he code if you can modify that line
console.log(map.graphicsLayerIds);
by
console.log('layers id', map.graphicsLayerIds);
it will help you see if that line is printed...
Yes, the webmap is displaying in the main panel, and I can see the layers, and click on the features to see the popups I have configured. Previously, I didn’t comment out the layer_id line, and it still wasn’t working. It had the value in it that was in your sample code. What should I put in there if I don’t have the correct layer name yet?! I tried editing the console.log line as shown, and see no difference when looking again… So the error: “item does not exist or is inaccessible” which comes after where the webmapId is printed, do you think that is referring to the missing layer_id? Perhaps it has something to do w/ my sharing permissions of the webmap; it is restricted to my_content and a group within my organizations account…
From: glazou [mailto:notifications@github.com] Sent: Tuesday, June 23, 2015 5:26 PM To: Esri/map-journal-storytelling-template-js Cc: Rollins, Megan (DCR) Subject: Re: [map-journal-storytelling-template-js] Map point section links (#23)
Cool you should almost be there, is your map displaying in the app?
This error may indicate that one of the map layer is not accessible.
Your issue may just be that you have commented LAYER_ID. Does it works if you don't comment it?
The layer ids should be displayed just before or after the second error.
Int he code if you can modify that line console.log(map.graphicsLayerIds); by console.log('layers id', map.graphicsLayerIds);
it will help you see if that line is printed...
— Reply to this email directly or view it on GitHubhttps://github.com/Esri/map-journal-storytelling-template-js/issues/23#issuecomment-114646053.
I think I found your issue, the documentation is not clear enough and you must have pasted the code at a wrong place, this is how it should looks like
i.e. from the sample of code the following is already present in index.html
require(["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
*/
});
Seems like we may be close! This is what my index.html file looks like, but still no good!
<script type="text/javascript">
require(["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
*/
});
/*
Set up a click handler on the feature of the map to navigate the story */
// Configure the webmap id and layer id // To get the layer id, just configure the webmap and run the application, // all the layer ids of your webmap will be printed in the console var WEBMAP_ID = "eff825ecea244997826d0de595fbbdd2", LAYER_ID = "featureServer_0";
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);
console.log('layers id', map.graphicsLayerIds);
if ( layer ) {
layer.on("mouse-over", function(e){
map.setMapCursor("pointer");
map.infoWindow.setContent("<b>"+e.graphic.attributes.name.split(",")[0]+"</b><br/><i>Click to zoom</i>");
map.infoWindow.show(e.graphic.geometry);
});
layer.on("mouse-out", function(e){
map.setMapCursor("default");
map.infoWindow.hide();
});
layer.on("click", function(e){
var index = e.graphic.attributes["__OBJECTID"];
topic.publish("story-navigate-section", index);
});
}
clickHandlerIsSetup = true;
}
}); });
I've created a map with points in ArcGIS online, but I'm unable to link to different sections from that map. I see this in the Readme, but I'm not clear what this means:
What does "layer attributes" refer to?
I'm trying to duplicate the same section linking as seen here: http://storymaps.esri.com/stories/2014/bee-tour/
Thanks.