• Hi Joe,

    I’m having a little trouble with “shapes”. Specifically, I want to display circles of 10 and 20 miles radius of my village. I have marked 257 walking routes on a page all of them inside the larger circle. If I draw the circles first and then add a few routes the circles disappear for some reason. This happened a few times. So, I added all the routes and lastly the circles but as these shapes are in the foreground when the page loads I can’t click on any of the enclosed routes (lines). To counter this I set “Show initially” to “No” but this is not the plan.

    You will see what I mean if you take a look at my page (it may take a while to load). If you hover on the map icon you will be able to select/deselect the “10 Mile Radius” shape but, once selected, you can’t click on a route, and nothing happens on a hover, inside the circle but it’s all ok outside of it.

    So, is there a way of pushing the shape to the back? I see that if you deselect the “walks” and then select them again, all the walks (lines) are brought to the foreground, which is very handy, and the circles are pushed to the back. This is exactly what I want but I also want the shapes to be in the background initially and stay in the background when they are selected. Perhaps an option in “Settings” i.e. Normal behaviour | Keep in foreground | Keep in background?

    Also, is it possible to change the text in the map box? I would like to have something else instead of “Shapes” (I can’t think of what at the moment!) and “Walks” instead of “Lines”.

    Cheers,
    Phil.

    P.S. I noticed a slight error on your “Basemaps” Getting Started page: Under Examples you have “Thuderforest”. You probably have a similar keyboard to me! ??

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Joe

    (@morehawes)

    Hi Phil,

    Thanks for the detail.

    If I draw the circles first and then add a few routes the circles disappear for some reason.

    Odd, I wasn’t able to replicate this.

    So, I added all the routes and lastly the circles but as these shapes are in the foreground when the page loads I can’t click on any of the enclosed routes (lines).

    So, is there a way of pushing the shape to the back?

    Right – understood. The easiest way I could think of doing this would be to use the Waymark Public Export feature (and Overlay Filter) to export the Shapes and Lines into separate GeoJSON files.

    When you create a new Map, importing the Shapes first and then the Lines second should put them in the desired order (like this).

    Hopefully this does the trick. Another option would be to manually edit the GeoJSON and move the Shape features from the end to the start of the content.

    Let me know if this doesn’t do the trick. I will think on how this can be improved.

    Also, is it possible to change the text in the map box? I would like to have something else instead of “Shapes” (I can’t think of what at the moment!) and “Walks” instead of “Lines”.

    Not easily! I will look into improving this also because I realise these are very generic.

    The best way I can think of achieving this is with JavaScript/jQuery. This is pretty crude, but it just replaces the relevant text when the page loads:

    <script>
     jQuery(document).ready(function() {
      var control = jQuery('.waymark-map .leaflet-control-layers').first();
      
      if(control.length) {
       jQuery('.leaflet-control-layers-overlays b', control).each(function() {
        var label_text = jQuery(this).text();
        
        switch(label_text) {
         case 'Markers' : 
          label_text = 'Points';
          
          break;
    
         case 'Lines' : 
          label_text = 'Routes';
          
          break;
    
         case 'Shapes' : 
          label_text = 'Areas';
          
          break;            
        }
        
        jQuery(this).text(label_text)    
       });   
      }
     });
    </script>

    I hope that helps.

    Cheers,

    Joe

    Plugin Author Joe

    (@morehawes)

    P.S. I noticed a slight error on your “Basemaps” Getting Started page: Under Examples you have “Thuderforest”. You probably have a similar keyboard to me!

    Appreciated!

    Joe

    Thread Starter RottenSod

    (@rottensod)

    Hi Joe,

    I really appreciate your help and thoughts on this.

    Unfortunately, I have not been able to get any of your suggestions to work. Maybe my 72 year old brain is more fried than I thought!

    I might just relax on this and leave things as they are, maybe even drop the ‘shapes’ from the map – less is more, sort of thing.

    Cheers,
    Phil.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Keeping a shape at the back’ is closed to new replies.