0

Working from a basic example generated by Oracle MapBuilder. I have a base map and a FOI layer.

At the start no filter is applied and the map shows all object types (column OBJECTTYPE) available in the FOI layer.

 function addThemeBasedFOI()
  {
    layers["themebasedfoi1"] = layer1; 
    map.addLayer(layer1);
    layer1.setZoomLevelRange(0,9);
   }

A checkbox, initially unchecked, calls this function:

  function setFilter(item)
  {
    if (item.checked) {
      layer1.applyFilter(new OM.filter.In('OBJECTTYPE',["WGD","PND","OTD","BTD"]),true);
    }
    else
    {
    layer1.applyFilter(new OM.filter.In('OBJECTTYPE',["WGD","PND","OTD"]),true);

    }
  }

First click on the checkbox checks it and all objecttypes are removed from the layer except the four specified ["WGD","PND","OTD","BTD"].

Second click on the checkbox unchecks it and the layer now show only the three object types. ["WGD","PND","OTD"]

With the checkbox checked again I expect the objecttype "BTD" to return but this doesn't happen.

How should this be done?

0

Apparently the filter is more like a delete statement in SQL than a where clause. I got it to work by creating a copy of the original layer and displaying the copy.

if (layerFilter) 

{ map.removeLayer(layerFilter); }

layer1.setVisible(true);

layerFilter = layer1.applyFilter(new OM.filter.In('OBJECTTYPE',filterArray),false);

layer1.setVisible(false);

map.addLayer(layerFilter);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.