Select to view content in your preferred language

How do I show each 100th symbology out of 43000 points?

861
6
10-18-2018 12:03 AM
CarstAway
Emerging Contributor

Hello!

I have a lot of data and want to show just every 100th data( 0, 100, 200, 300, 400 and so on till 43000) in a map. I dont want to use the Query Builder in this way: "KP_CABLE" =0 OR "KP_CABLE" =100 OR "KP_CABLE"=200..... Has anyone an good idea?

Furthermore: How can I show in my map the name to the symbology for each 100th point? For example I want to show in my map the points 0, 100, 200,... with ne name on it: KP0, KP100, KP200?

Best wishes!

0 Kudos
6 Replies
DanPatterson_Retired
MVP Emeritus

Add a new field and calculate values to use for labeling and symbology.

It will return the field value if the modulus is 0, otherwise 0.

def modu(fld, divby):
    """return the modulous and vals"""
    if (fld % divby) == 0:
        val = fld
    else:
        val = 0
    return val

# ---- expression
#------ modu(!YourField!, 100)

for i in range(10): print(modu(i,3))
0
0
0
3
0
0
6
0
0
9

0 Kudos
CarstAway
Emerging Contributor

Hello,

thnaks for your answer. I never used a Field Calculator with expressions like yours.

# ---- expression

What is the meaning of that? Do I have to change here something?

def modu(fld, divby):
    """return the modulous and vals"""
    if (fld % divby) == 0:
        val = fld
    else:
        val = 0
    return val

# ---- expression
#------ modu(!YourField!, 100)

Using this, it leads to an error.

0 Kudos
CarstAway
Emerging Contributor

Sry, I really dont get it. I tried to copy and paste this into the Field Calculator

def modu(fld, divby):
    """return the modulous and vals"""
    if (fld % divby) == 0:
        val = fld
    else:
        val = 0
    return val

# ---- expression
#------ modu(!YourField!, 100)

But I dont know how to work with this.

Best Wishes

0 Kudos
DanPatterson_Retired
MVP Emeritus

Calculate Field Python examples—Data Management toolbox | ArcGIS Desktop 

there is a code block section where you put all the lines of the function (aka, the def)

there is an expression line... that is where you would put the expression ..  modu(blah, blah)  minus the #--- stuff

I don't have screen grab capabilities, but I am sure you can figure it out

CarstAway
Emerging Contributor

Thanks!

0 Kudos
XanderBakker
Esri Esteemed Contributor

It is probably easier to just use a definition query like:

mod( KP_CABLE, 100) = 0