I have .shp layer with column Length

In Layer Properties it's possible to display Layer with natural breaks (Jenks) classification.

It's shown below: enter image description here

Based on that classification I'd like to create new column which store Natural Breaks (Jenks) classes for example if some object displays as 1 I want 1 in created column etc.

Obviously I could write statement in field calculator (after classification in Layer Properties) like (simply version):

if Length < first_class_high_value then 1 etc.

But I'd like to put creating new field in Model in order to using with many Layers, so I wouldn't know threshold value for each class.

Any idea how solve that problem?

  • 2
    You'll need to choose between implementing the natural breaks algorithm in Python or descibing the classes to extract ranges. – Vince Dec 31 '16 at 14:48
  • I've tried implementing algorithm in python, but it didn't work. Could you tell me how to do that? – ami Jan 1 '17 at 19:42
  • 1
    Not without several hours of donated labor. If, however, you alter the question to contain your code and debug output, with test data against which to validate the algorithm, then maybe someone here can help. – Vince Jan 1 '17 at 19:57
  • I've found that gist.github.com/drewda/1299198 but don't know how use it in my case :/ – ami Jan 4 '17 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.