Demo

LocationBox JavaScript Demos

Redline Drawing Tool

Start:     Get Points:     Clear:  

Instructions

Use the "Start" button to start drawing. Click to mark the corner points of region. Use "Finish" link on the map to finish drawing and the region will be created.
Use the "Get Points" to get the coordinates of the corner points.
Use the "Clear" link on the map to start over.
See the JavaScript API for more information.

Source Code

The Javascript code for the above map is:

 <script language="Javascript" 
    src="http://www.locationbox.com.tr/locationbox/services?Key=key&Cmd=APIV2
    &Typ=JS"></script>
    
  <script language="JavaScript">
  var mapper  = new IMapper();

  function startup() {
    mapper.initMap(41.1, 29.1, 6);
    mapper.addNavigationPanel();
    return;
  }

  function start() {
    mapper.setRedlineTool();
    return;
  } 
  function get() {
    var ordinates = mapper.getRedlineOrdinates();
    alert("Redline coordinates:" + ordinates + " ");
    return;
  }
  function remove() {
    mapper.clearRedlineTool();
    return;
  } 
  
  </script>
					

Buttons:

    <a href="javascript:start()"><img src="images/add.gif" border=0></a>
    <a href="javascript:get()"><img src="images/add.gif" border=0></a>

					
Download working page
Remember that you need to use your key code as Key attribute.