I have an inmemoryfeature layer with several items added.
When the items are added programmatically the have a key e.g ( “16,112324,AX7”)
I would like to go through each Item
for i = 0 to layer.inmemoryfeatures.count-1 ’ For each item in the layer
if layer.internalfeatures(i).columnvalues(“MyID”) = 16 then ’ Does the Column = MYID
Layer.FeatureIdsToExclude.Add(???) ’ If yes the exclude from list
end if
next
The (???) above is my problem. I search by index yet I need the Key string.
Get a features key using its Index
Hi Steve,
I think the (???) should be the layer.internalfeatures(i).Id, have you tested this value?
And the feature won’t be really removed from the layer by this way, but only won’t be rendered and got by any API of layer.
Regards,
Don
I tried the ID. It is a system generated id that has no meaning to me. The Key I used to add the feature is something I can use for determining whether I want this feature used.
To be clear, there is information in the Key I assigned this feature I need to compare to.
I can then pass the id to the exclude function.
Basically I just need to be able to reference the Key for all of the features.
So, I have managed to deal with this using the ID.
New Problem
using the following code.
’ My intention is to ignore any features that have an Rtyp = “G”
For i As Integer = 0 To pointLayer.InternalFeatures.Count - 1
If pointLayer.InternalFeatures(i).ColumnValues(“Rtyp”) = “G” Then
pointLayer.FeatureIdsToExclude.Add(pointLayer.InternalFeatures(i).Id)
End If
Next
This appears to work as I have 9 total features and only 1 is not Rtyp=“G"
The FeatureIDstoExclude has 8 items. leaving only 1 item
’ The next segment should return the pointshape I clicked ( Ignoring any Rtyp=“G” items)
The plyr always returns a count of 0 even when I click directly on the non Rtyp=G” object.
Try
plyr = pointLayer.QueryTools.GetFeaturesNearestTo(clickedPointShape, GeographyUnit.Meter, 1, ReturningColumnsType.AllColumns)
Catch ex As Exception
Exit Sub
End Try
Not sure why, as it should still have the one item to return.
I have also noticed there is no fixed zorder to the way the objects are drawn on the map.
Normally I would add the icons ordered by date so the newest icons should be on top. ( Not the case)
Hi Steve,
If you call pointLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns), will you still get 0 feature return?
And could you please add a breakpoint to make sure whether the pointLayer.FeatureIdsToExclude contains 8 features.
About the zorder of icons we haven’t noticed that, I think the latest icon should be on the top, if you found that’s not correct please let me know more detail about that, so I can reproduce that.
Regards,
Don
I have confirmed that the FeatureIDstoExclude does in fact have 8 items.
Essentially, My routine which adds the icons to the map compares the the type of the icon. Column Rtype
If it is a type A , then the routine saves them in a list.
All other icon types are added immediately.
Once the other types have been added to the map, the routine then adds all the icons in the saved list.
The Idea here was if I add them last , then they should be on top. Turns out that they actually display with some of the other icons on top of it.
Hi Steve,
Sorry that’s strange I haven’t succeed reproduced your issues. FeatureIdsToExclude works here and the last saved icon shows on the top level.
Could you please create a simple sample for reproduce that?
And for your first issue, I think we have a workaround, you can create an InmemoryFeatureLayer to save valid feature, so to avoid use FeatureIdsToExclude.
Regards,
Don