How to find the actual webmap ID in the Story Map Series ?

546
2
04-30-2018 01:12 PM
OndřejBlažek
New Contributor

Hi,

I need to find the ID of the current web map that is displayed in the app. I need to save the ID in the new variable and work with it.
I need an application that changes the legend according to what the web map ID is.

Thanks for the anwers

0 Kudos
2 Replies
RupertEssinger
Frequent Contributor

You could search for the map by name in ArcGIS Online. Or if you or a colleague are the owner of the story map you could look in My Stories to easily find/launch the web map(s) that the story map references. When you browse your stories in My Stories, it will list out the content in each story, and also let you know if there are issues with it. Alternatively, to find the ID of the web map(s) or embedded app(s) in any story map you could open your web browser's console (for example, press F12 in Chrome on Windows), browse the story map, and then look for the IDs in the Console.

Rupert

0 Kudos
OndřejBlažek
New Contributor

I already know how to find the ID or rather the current bookmark of the application.
I have the task of changing the legend images according to the current bookmark (according to the current index):

File: src / app / storymaps / common / legend / Legend.html
I modified it as follows:

<div id="box_legenda" class="legendContainer mapControls">
    <div class="titleBtn">
        <span class="collapseBtn">
            <div class="glyphicon glyphicon-chevron-down"></div>
            <div class="glyphicon glyphicon-chevron-up"></div>
        </span>
        <%= title %>
    </div>

    <div class="content">
        <!-- <div class="legendDijitContainer"></div> -->
         <img id = "zmena_obr" class="legendDijitContainer" src="http://maps.fsv.cvut.cz/~blazek/app21/images/legenda A.png" alt="legenda" height="820" width="200"> 
        <% if ( isInBuilder ) { %>
            <div class="settingsGear glyphicon glyphicon-wrench"></div>
            <div class="settingsOverlay">
                <div class="settings-title"><%= settings %></div>
                <div class="settings-content">
                    <!-- Open by default -->
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" class="expandStartup" />
                            <%= openDefault %>
                        </label>
                    </div>
                </div>
            </div>
        <% } %>
    </div>
</div>

In the file: custom-script.js I have this code:

define(["dojo/topic"], function(topic) {
  /*
   * Custom Javascript to be executed while the application is initializing goes here sdfsdfsdfsdf
   */

  // The application is ready
  topic.subscribe("tpl-ready", function(){
    /*
     * Custom Javascript to be executed when the application is ready goes here
     */
    var elem0 = document.getElementById("box_legenda");
    elem0.addEventListener("click", function() {       
        //jak dostat ID aktuální webové mapy?????
        
        var id_zalozky = app.data.getCurrentEntryIndex();
        //var pole_id = app.data.getWebmaps();
        
        
        var id_mapy = id_zalozky;

        
        //pak porovnávat a měnit obrázky legendy (nastaveno pro plánované 3 mapy, aktuálně jsou 2)
        if (id_mapy == 0) {
                                        var elem1 = document.getElementById("zmena_obr");
                                        elem1.setAttribute("src","http://maps.fsv.cvut.cz/~blazek/app21/images/legenda A.png");
                                                           }
        if (id_mapy == 1) {
                                        var elem1 = document.getElementById("zmena_obr");
                                        elem1.setAttribute("src","http://maps.fsv.cvut.cz/~blazek/app21/images/legenda B.png");                 
                                                                }
       else {
                                        var elem1 = document.getElementById("zmena_obr");
                                        elem1.setAttribute("src","http://maps.fsv.cvut.cz/~blazek/app21/images/legenda C.png");                 
             } 
                                               }                  
                          );      
  });
});

I do not know where the error is. I need the feature to find my map ID or index of the current bookmark and accordingly change the image in the legend box.

Application: http://maps.fsv.cvut.cz/~blazek/app21/

Thank you for the advice

0 Kudos