Select to view content in your preferred language

How to use an attribute field to define Polyline With?

959
3
06-10-2010 08:09 PM
chriss_
Emerging Contributor
Hi!

I've a polyline layer for streets. Int this Layer I ve an attribute field "Counts". Now I want to display each polyline depending on the value in the "Counts" field.
Let s say i ve 10 Features in this layer. The highest Value for all features is "Counts" =1000. So I want to display this with a width of lets say 10 and the other Features with lower values for "Counts" correspondingly. So a "Counts"= 100  would be a width of 1.

Anyone has an idea?

Thanks for your help

Chris
0 Kudos
3 Replies
AlexanderGray
Honored Contributor
Hi Chris,

this isn't really an ArcObjects question, well at least my answer isn't.  You can symbolize your layer in ArcMap based on quantities and a proportial symbol.  So if you had a count field in your line feature class defined as a numeric field, you could use that as a quantity.  Then you can set your min and max width and all that good stuff.
0 Kudos
MelitaKennedy
Esri Notable Contributor
Hi Chris,

this isn't really an ArcObjects question, well at least my answer isn't.  You can symbolize your layer in ArcMap based on quantities and a proportial symbol.  So if you had a count field in your line feature class defined as a numeric field, you could use that as a quantity.  Then you can set your min and max width and all that good stuff.


Given Alexander's answer, I found IProportionalSymbolRenderer in the SDK help. It's in the Carto library.

Melita
0 Kudos
chriss_
Emerging Contributor
Hi!

Thanks for both replies.

@Melita:that was exactly the keyword i was looking for. With this I found some nice postings in the old forum.

For anybody who has the same problem my Code is here:

Private Sub zankeyflow()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument

Dim pMap As IMap
Set pMap = pMxDoc.FocusMap

Dim pFeatLayer As IFeatureLayer
Set pFeatLayer = pMap.Layer(0)
Dim pFeatClass As IFeatureClass
Set pFeatClass = pFeatLayer.FeatureClass

Dim pProportionalSymbolRenderer As IProportionalSymbolRenderer
Dim pLineSymbol As ILineSymbol

Set pProportionalSymbolRenderer = New ProportionalSymbolRenderer


Dim pGeoFeatLayer As IGeoFeatureLayer
Set pGeoFeatLayer = pFeatLayer
pGeoFeatLayer.DisplayField = "Line_ID"


Dim pTable As ITable
Dim pCursor As ICursor
Dim pRow As IRow
Dim pQueryFilter As IQueryFilter
Set pQueryFilter = New QueryFilter
pQueryFilter.AddField "Line_ID"
Set pTable = pGeoFeatLayer
Set pCursor = pTable.Search(pQueryFilter, False)

Dim pData As IDataStatistics
Dim pResults As IStatisticsResults
Set pData = New DataStatistics
pData.Field = "Line_ID"
Set pData.Cursor = pCursor
Set pResults = pData.Statistics

Dim pRGB As IRgbColor
Set pRGB = New RgbColor
pRGB.Red = 255
pRGB.Green = 0
pRGB.Blue = 0

Set pLineSymbol = New SimpleLineSymbol
pLineSymbol.Color = pRGB

Set pLineSymbol = New SimpleLineSymbol
Set pRGB = New RgbColor
pRGB.Red = 0
pRGB.Green = 255
pRGB.Blue = 0

pLineSymbol.Color = pRGB
pLineSymbol.Width = 1


With pProportionalSymbolRenderer
.ValueUnit = esriUnknownUnits
.ValueRepresentation = esriValueRepUnknown
.Field = "Line_ID"
.FlanneryCompensation = True
.MinDataValue = pResults.Minimum
.MaxDataValue = pResults.Maximum
.MinSymbol = pLineSymbol
.LegendSymbolCount = 3
.CreateLegendSymbols
End With

Set pGeoFeatLayer.Renderer = pProportionalSymbolRenderer

pMxDoc.ActiveView.ContentsChanged
pMxDoc.UpdateContents
pMxDoc.ActiveView.Refresh



End Sub
0 Kudos