0
 omnivore.wkt.parse("${feature}").removeFrom(map);

I select features by this line omnivore.wkt.parse("${feature}").addTo(map); but when I remove from map doesn't work

this code works but if I don't know delete feature

<c:if test="${not empty mapBean.layers}"> console.log('Kaydedilen featurelar:');
<c:forEach var="layer" items="${mapBean.layers}"> <c:if test="${layer.id==1}"> <c:if test="${not empty layer.features}"> <c:forEach var="feature" items="${layer.features}"> console.log("${feature}"); 
omnivore.wkt.parse("${feature}").addTo(map); </c:forEach> </c:if> </c:if> </c:forEach> </c:if>
6
  • You need to remove the layer from the map (map.removeLayer(your_layer), not from a wkt.parse object. Commented May 15, 2015 at 11:48
  • but I added feature not layer
    – hazem khd
    Commented May 15, 2015 at 11:56
  • I tried map.removeLayer also doesn't work
    – hazem khd
    Commented May 15, 2015 at 11:58
  • <c:if test="${not empty mapBean.layers}"> console.log('Kaydedilen featurelar:'); <c:forEach var="layer" items="${mapBean.layers}"> <c:if test="${layer.id==1}"> <c:if test="${not empty layer.features}"> <c:forEach var="feature" items="${layer.features}"> console.log("${feature}"); omnivore.wkt.parse("${feature}").addTo(map); </c:forEach> </c:if> </c:if> </c:forEach> </c:if> this code works but if I don't know delete feature
    – hazem khd
    Commented May 15, 2015 at 12:02
  • There is an edit button beneath your question that you should use to improve it with any requested clarifications.
    – PolyGeo
    Commented May 15, 2015 at 12:13

1 Answer 1

0

omnivore.wkt.parse returns a layer

// adding
var feature = omnivore.wkt.parse("${feature}");
feature.addTo(map);

// removing: feature.removeFrom() is not a function, use map.removeLayer()
map.removeLayer(feature);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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