Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Shapefie.Categories.Generate crashes with large files

Hello again,

I'm really sorry, it seems I fill up this thread on my own.

Work and studying the documentation brought me a Little further. So I found out that I don't Need to create an index to clear a selection. A simple
objShape.SelectNone
does the trick.

But still I'm stuck. Further down in my Code I iterate over the shapes of a shapefile and check certain Attributes. If an Attribute fits I'd like to add ths shape to a selection, or at least change the fillColor of it. The solution I found still uses an index. The Code is as follows:
' ...

' Create a shapefile object
Set objShape = Forms(strMap).mapMain.GetObject(lngHandle)

' Create the index
objShape.Categories.Generate 0, ctUniqueValues, 0
objShape.Categories.ApplyExpressions

' iterate over shapes
For i = 0 To objShape.NumShapes - 1
    ' Check for correct value
    If objShape.CellValue(1, i) = correctValue Then
        ' This is Where the Index seems to be needed
        lngShpIndex = objShape.ShapeCategory(i)
        ' Here I simply Change the fillColor
        objShape.Categories.Item(lngShpIndex).DrawingOptions.fillColor = Me.txtColor.BackColor
    End If
Next i
As stated before, the application crashes with very large Shapefiles. So here are two more questions:

1) Do I really Need to create the Index to Change the fillColor (up to 4.8.1 I could work with the the "i" value here)?
2) How can I add a shape to a selection?

Thanks again

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>