0

I have point data which has a number of fields/columns, each of which is at a different scale. I'm looking to find a way of constructing a very simple index which would combine this data. Say I have 3 levels of scale (so 3 fields) - small, medium, large. Each of the points either has or hasn't got a text string at each of those levels. I'm looking to assign a number (or not) depending on whether the text string is present or not, and aggregate that data.

Basically I want to see if there are patterns in the presence/absence of text strings at these different scales (possibly re-combining the value given to each of them in more than one way). I'll then figure out a way of showing this map format (Arc). I don't think I've been very clear but please ask if you need clarification.

Here's a sample table with something along the lines of what I was thinking of doing (in grey). I'm not sure this will give me the outcome I need - ideally each column should have a different weighting reflecting relative size. But should give a rough idea of the sort of thing I was thinking of doing. enter image description here

2
  • 1
    It would definitely help (me at least) if you could include an actual example of the tabular structure Commented Sep 7, 2013 at 22:01
  • Hi Stephen - explained above.
    – Joules
    Commented Sep 8, 2013 at 8:11

2 Answers 2

2

I think the easiest way would be to use Field Calculator. Assuming you want a 1 if text is present and a 0 if there is no text, the following will do the trick:

There are no truly blank values in a shapefile (it's stored as a single space), so the code is slightly different for shapefiles vs. Geodatabases.

Parser

Python

Code block

#For GDB
def scalar(textfield):
    return 0 if not textfield else 1

#For shapefile
def scalar(textfield):
    return 0 if textfield == " " else 1

Expression

scalar(COUNTRY)

Repeat for the other two fields.

3
  • Thanks Paul - the above looks do-able. Will try it later on!
    – Joules
    Commented Sep 12, 2013 at 8:59
  • Didn't get the above to work - I'm not sure where the 'expresion' part is meant to be entered either. Sorry, my coding skills are non-existent.
    – Joules
    Commented Sep 16, 2013 at 15:39
  • You're going to enter this is Field Calculator. Expression is a parameter.
    – Paul
    Commented Sep 16, 2013 at 21:34
1

I still don't fully understand the problem, but given this:

Each of the points either has or hasn't got a text string at each of those levels. I'm looking to assign a number (or not) depending on whether the text string is present or not, and aggregate that data

You could approach this with some kind of conditional statement within a loop. In pseudocode:

for each point in pointLayer
  if street is not null then calculate value = Street
  else if city is not null then calculate value = City
  else if country is not null then calculate value = Country
  else calculate value = error

You could do this in Python using an UpdateCursor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.