redwonnie

Search & Display icons entered.

Discussion created by redwonnie on Mar 28, 2011
Hi, I'm new to this & therefore, I would like to query on something which I can't manage to do it.

I want to be able to hide the (hardcoded) icons which are categorized into various groups. For example, when I type "Food" in the textbox, all the food icons will be shown on the map. Likewise goes to when I type "Toilet", all the icons will appear as entered. How can I do it?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta http-equiv="X-UA-Compatible" content="IE=7" />
 <!--<meta http-equiv="refresh" content="300">-->

 <title>Peranakan @ SG</title>
 <script type='text/JavaScript' src='http://www.onemap.sg/API/JS?accessKEY=xkg8VRu6Ol+gMH+SUamkRIEB7fKzhwMvfMo/2U8UJcFhdvR4yN1GutmUIA3A6r3LDhot215OVVkZvNRzjl28TNUZgYFSswOi'></script> 
 
 <script type="text/javascript">

         dojo.require("esri.map");
         dojo.require("esri.tasks.geometry"); 
         //dojo.require("esri.dijit.InfoWindow");
         var map=null;
         var topoMap=null; 
         var levelNumber=1; 
         var centerPoint="32173.834393929,29296.8452311538"; 
         var OneMap = new GetOneMap('map','SM',{level:levelNumber,center:centerPoint}); 
         
  function initialize(){ 
          try{
    map=OneMap.map; 
               //handle map object here
               if(map==null){
                   LogError("map not initialized");
     return;
               }
               //dojo.connect(map, "onLoad", PlaceLabel); 
               PlaceLabel();
          }
          catch(err2){
    LogError(err2.message);
   }
         }
 
         function PlaceLabel(evt){
          map.graphics.clear(); 
          var strImage,symbol,pt,graphic,stX,stY,infoTemplate,json,g,cont,cont1,tit,lin;
          var icounter = 0;
 
   stX = "23319.3347409758";
   stY = "28825.7191286444";
   tit = "TRY OUT";
   cont = "abc";
   lin= "www.onemap.com"
 
   pt= new esri.geometry.Point(stX,stY,map.spatialReference); 
   cont1 = "Description:"+cont+ "<br/>Detail:"+lin; 
  
   strImage = "C:/Users/L33508/Desktop/images/fish.jpg";
 
   symbol = new esri.symbol.PictureMarkerSymbol(strImage, 25,25);
 
   json = {title:tit,content:cont1 };
 
   infoTemplate = new esri.InfoTemplate(json);
   graphic = new esri.Graphic(pt,symbol); 
   graphic.setInfoTemplate(infoTemplate);
   map.graphics.add(graphic); 
 
   dojo.connect(graphic, "onClick", function(evt){
   g = evt.graphic;
   map.infoWindow.setTitle();
   map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
   map.infoWindow.resize(260,130); 
   });


   stX = "26103.0415215090";
   stY = "26103.0325216080";
   tit = "TRY OUT";
   cont = "abc";
   lin= "www.onemap.com"
 
   pt= new esri.geometry.Point(stX,stY,map.spatialReference); 
   cont1 = "Description:"+cont+ "<br/>Detail:"+lin; 
  
   strImage = "C:/Users/L33508/Desktop/images/pizza.jpg";
 
   symbol = new esri.symbol.PictureMarkerSymbol(strImage, 25,25);
 
   json = {title:tit,content:cont1 };
 
   infoTemplate = new esri.InfoTemplate(json);
   graphic = new esri.Graphic(pt,symbol); 
   graphic.setInfoTemplate(infoTemplate);
   map.graphics.add(graphic); 
 
   dojo.connect(graphic, "onClick", function(evt){
   g = evt.graphic;
   map.infoWindow.setTitle();
   map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
   map.infoWindow.resize(260,130); 
   });


   stX = "36179.8395210000";
   stY = "36179.8395210000";
   tit = "TRY OUT";
   cont = "abc";
   lin= "www.onemap.com"
 
   pt= new esri.geometry.Point(stX,stY,map.spatialReference); 
   cont1 = "Description:"+cont+ "<br/>Detail:"+lin; 
  
   strImage = "C:/Users/L33508/Desktop/images/fish.jpg";
 
   symbol = new esri.symbol.PictureMarkerSymbol(strImage, 25,25);
 
   json = {title:tit,content:cont1 };
 
   infoTemplate = new esri.InfoTemplate(json);
   graphic = new esri.Graphic(pt,symbol); 
   graphic.setInfoTemplate(infoTemplate);
   map.graphics.add(graphic); 
 
   dojo.connect(graphic, "onClick", function(evt){
   g = evt.graphic;
   map.infoWindow.setTitle();
   map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
   map.infoWindow.resize(260,130); 
   });    
  }

  dojo.addOnLoad(initialize);

 </script>
 </head>

 <body class="tundra">
 
 <table>
 <tr>
         <td width="2px">
                 
     <td colspan="3">Mashup data</td>
    </tr>
    <tr>
     <td>Enter theme name:</td>
 
     <td><input type="text" id="txtTheme" value="" style="width: 250px" /></td>
  </tr>  
  <tr>
  <td id="txt"></td>
  <td><input type="button" value="MashUp Theme" onclick="OverlayTheme();" /></td>

                <div style="display: block;">
                </div>
                
                <div id="map" style="width:800px; height:500px; border:1px solid #000;"></div>
                </td>
         <td width="2px">
                 
         </td>
         </tr>
         <tr>
         <td width="2px">
                 
             </td>
             <td>
                
             </td>
             <td width="2px">
                 
             </td>
 </tr>
 <tr>
         <td width="2px">
                 
             </td>
             <td>
 </tr>  
 </table>
 </body>
 </html>

 <script type="text/javascript"> 

 function LogError(msg){ 
  try{ 
   var img = new Image(1, 1); 
   var sPath = window.location.pathname; 
   var sPageName = sPath.substring(sPath.lastIndexOf('/') + 1);
   img.src="http://www.pub.gov.sg/waterlevel/webproject/LogError/writeLog.aspx?src="+sPageName+"&msg="+msg+"&date" + new Date(); 
  }
  catch(exc){
   //alert(exc.message);
  }
 }
 </script>

Really need help, thanks!

Outcomes