Solved

Schemamapper - attributerange

  • 14 August 2017
  • 3 replies
  • 4 views

Badge +21

I want to map values from the following feature:

Myfeature:

- x = 100

- y = 100

- z = 150

Based on the following rules

newattribute = a if z > 0 and z < 50

newattribute = b if z > 50 and z < 100 newattribute = c if z > 100 and z < 120

 

newattribute = d if z > 120 and z < 175

 

So this feature will get the attribute:newattribute = dI can not seem to find an example with the schemamapper (or any other solution which is NOT Python-coding).The issue is that I have alot of changing interval-rules, in a database - so they can not be hardcoded in the workspace - but have to be read from a csv / Excel-file so the Schemamapper would be great if it could handle larger than and smaller than etc.

icon

Best answer by annabelleatsafe 6 May 2021, 03:31

View original

3 replies

Userlevel 2
Badge +12

HI Sigtil,

Can you use a csv with the min and max for each range:

value,min,max

a,0,50

b,50,100

And then use a FeatureMerger to merge all csv values to the features (merge on 1 = 1).

Then use the Tester to find the records where z > min and z < max.

That should get you the d in the example.

And you only need to change the csv for other ranges.

Userlevel 2
Badge +17

Hi @sigtill, alternatively, the InlineQuerier could be a solution.

0684Q00000ArLONQA3.png

Source "range" table:

min,max,newattribute
0,50,a
50,100,b
100,120,c
120,175,d

SQL statement in the InlineQuerier:

select
    s.*,
    r.newattribute
from source as s
left outer join range as r
on r.min < s.z and s.z <= r.max

This is a spatial approach. May be less efficient than the SQL approach, but an FMEic solution?

0684Q00000ArKzsQAF.png

Badge +1

Hi @Sigbjørn Herstad​  (and any others who stumble on this posting)! 

 

We're revisiting the SchemaMapper over here, to see how we might be able to shave down it's long tooth. In digging into this transformer, it's evident there are a lot of questions about what exactly a new-n-improved SchemaMapper looks like. We're beginning to look at supporting simple functions and conditionals but still need to investigate/verify the following:

  • Which functions and conditionals would be used? What would be helpful?
  • Would these statements be specified in the external lookup table, the configuration fields, or apply to the incoming feature values themselves?
  • What kind of UI help would the author expect for writing these statements?

Any and all feedback welcomed on these above points, if you would be game to share! I would greatly appreciate it!

 

Cheers,

 

Annabelle

Reply