Select points based on minimum connection lines

1689
17
10-03-2016 10:27 AM
LanoYado
New Contributor III

I am using Model Builder and I have two layers; point and line. I want to select (and then create a point layer of them) those points that have less connections with other points. 

For instant, point # 6 is connected to 5 points (# 11, 16, 20, 47, & 19) through 5 lines. Among these five points, # 47 is the one I want to find it since it has only 2 connections with others (# 6 & # 54), the rest have more lines connected to (#19 connected to 3 lines, # 11 connected to 4 lines, #16 connected to 3 lines, #20 connected to 3 lines). 

Note that I already calculated (created a field)  the number of lines connected to each point using spatial join.

Any way to use in ModelBuilder?

0 Kudos
17 Replies
ChrisDonohue__GISP
MVP Alum

By the way, if you are familiar with Python, you may want to consider doing the process with it instead of Modelbuilder.  I believe in Python one has access to a Minimum function, which would save the whole workaround one has to do in Modelbuilder to accomplish the same thing.

Chris Donohue, GISP

DanPatterson_Retired
MVP Emeritus

min is a built-in

>>> some_stuff = [8,2,5]
>>> min(some_stuff)

explore as Chris suggests

>>> dir(__builtins__)
['....snip ...'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 
'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 
'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 
'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted',
 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
ChrisDonohue__GISP
MVP Alum

Got it to work.

Not exactly sure why it didn't work before, but after I closed ArcCatalog and reopened it, then reopened the Model and redid the expression, it now works.  I also undid the Parameters, but that seemed to have no effect.

Chris Donohue, GISP

LanoYado
New Contributor III

Still not working with me. I know Python is better and faster but I can not switch to it until I can finish my current work with model builder, hopefully soon.

0 Kudos
LanoYado
New Contributor III

What type of data should I choose for "get value"?

0 Kudos
ChrisDonohue__GISP
MVP Alum

I went with the default, which is "String".   Though the field it is checking is a Double precision, but it still worked anyway.  (Maybe it has built in casting?  Not sure)

I'd check the properties of the field you are running the Get Field Value against and match its properties, if possible.  There seems to be String and Long available as choices, but not the others.

Chris Donohue, GISP

XanderBakker
Esri Esteemed Contributor

It would be cool to throw some python code at it (I would never consider ModelBuilder for something like this). Just a small questions. What to do in the case of point 20? It has two connected points that only have connections to one other point (30 and 37). Which one should be taken?

LanoYado
New Contributor III

That is a good question Xander, in that case and for my work, it takes one of them randomly since they have the same weight of connection.

0 Kudos