Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7928339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:42:16+00:00 2026-06-03T19:42:16+00:00

This little OpenLayers.Control.EditingToolbar from is inserted by default: It’s not really evident what these

  • 0

This little OpenLayers.Control.EditingToolbar from is inserted by default:

It’s not really evident what these buttons mean. I would like to replace this editing toolbar with a button group (e.g. like the one Twitter Bootstrap offers):

The markup of the editing toolbar currently is this:

<div id="panel" class="olControlEditingToolbar">
  <div class="olControlNavigationItemInactive olButton"></div>
  <div class="olControlDrawFeaturePointItemActive olButton"></div>
  <div class="olControlDrawFeaturePathItemInactive olButton"></div>
  <div class="olControlDrawFeaturePolygonItemInactive olButton"></div>
</div>

The images are basic sprites – so I know I could change these. But I can’t see how I could get away from these divs, replacing them with buttons. I thought about just creating the button group manually and add click() event listeners to the buttons, triggering OpenLayers’ different editing modes. But I couldn’t find any documentation on how I could do that.


So, basically, I see these options:

  • Create button group manually, and trigger the appropriate OpenLayers events through my own JS — but which events do I need to trigger?

  • Don’t use the EditingToolbar, but manually build my toolbar with OpenLayers — how could I do that?

  • Modify the automatically created editing toolbar by hacking the OpenLayers source (meh…) — is this worth the effort?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:42:17+00:00Added an answer on June 3, 2026 at 7:42 pm

    The best way is to manually build the control buttons. Based on the Draw Feature Example, you can go ahead and add your controls:

    drawControls = {
      point: new OpenLayers.Control.DrawFeature(pointLayer,
          OpenLayers.Handler.Point),
      line: new OpenLayers.Control.DrawFeature(lineLayer,
          OpenLayers.Handler.Path),
      polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
          OpenLayers.Handler.Polygon),
      )
    };
    
    for(var key in drawControls) {
      map.addControl(drawControls[key]);
    }
    

    Then, add a function that changes the currently used control based on a clicked element:

    function toggleControl(element) {
        for(key in drawControls) {
            var control = drawControls[key];
            if(element.value == key && element.checked) {
                control.activate();
            } else {
                control.deactivate();
            }
        }
    }
    

    Finally, create the HTML markup yourself. For each element that changes the control, add an onClick handler that calls the toggleControl function. You can also attach the click handler through jQuery, but in essence, this works:

    <ul id="controlToggle">
      <li>
          <input type="radio" name="type" value="none" id="noneToggle"
                 onclick="toggleControl(this);" checked="checked" />
          <label for="noneToggle">navigate</label>
      </li>
      <li>
          <input type="radio" name="type" value="point" id="pointToggle" onclick="toggleControl(this);" />
          <label for="pointToggle">draw point</label>
      </li>
      <!-- add more elements here, based on which draw modes you added -->
    </ul>
    

    You can see this in action here (sign up with a test user, no real e-mail needed) and find the code on GitHub.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little NetStream movie (which I'm not allowed to show, sorry) set
I made this little function from code snippets around the net. It does what
In this little piece of code, what is the fourth line all about? from
This little line of code here is from a shopping cart: <a href=javascript:; onclick=simpleCart.add(
This little bit of syntax has been a bit of a confusion for me
Given this little piece. http://jsfiddle.net/4gb6K/7/ I am attempting to align the bot element at
Given this little fiddle: http://jsfiddle.net/5Sw3h/8/ I have a navigation panel to the left, a
I have this little rake task: namespace :db do namespace :test do task :reset
I have this little problem, that I cannot figure out which arguments to pass
I have this little question that's been on my mind for a while now.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.