Demo

LocationBox JavaScript Demos

Add Layer With Features Style

Add Layer:     Remove:  

Instructions

Use the "Add Layer" button to add marker to a particular point on the map. Use "Remove" button to remove the marker.
Edit the source code to add more markers to any other point.
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();
  var layer = new ILayer();
  
  function startup() {
    mapper.initMap(41.1, 29.1, 6);
    mapper.addNavigationPanel(); 
    return;
  } 
  
  function add() {
    var render_style_l01 = mapper.createColorStyle("cs1","cccccc", 0.4, "#444444", 1, 3);
    var render_style_l02 = mapper.createColorStyle("cs2",null, null, "#ffff00", 2.5, 3);
    var selectStyle = mapper.createColorStyle("cs2","#cccc00", 0.3, "#ffff00", 2.5, 3);
    var hoverStyle = mapper.createColorStyle("cs2","#e0d8ff", 0.3, "#ffff00", 2.5, 3);      
    layer.createVectorLayer(ILayer.MAP_IL, "iller", null,"IL_ID",render_style_l01,true, null, 
                            null, render_style_l02, null, hoverStyle , null, selectStyle, true);
    return;
  } 
  
  function remove() {    
    layer.removeLayer();
    return;
  }  
    
  </script>
					

Buttons:

  <a href="javascript:add()"><img src="images/add.gif" border=0></a>
  <a href="javascript:remove()"><img src="images/remove.gif" border=0></a>
					
Download working page
Remember that you need to use your key code as Key attribute.