Skip to main content
Best Answer

How to find miss values from a sequence of number and asign them to other feature?

  • July 30, 2019
  • 8 replies
  • 137 views

bobo
Contributor
Forum|alt.badge.img+3

I've got some features and one of their attribute is a sequence of number or number with letter such as A001, A002... Now some of numbers are miss from sequence due to editting was performed. Is there a way to find out miss numbers and asign them to newly created feature from North to South, West to East?

Best answer by dellerbeck

So if you are looking to "fill in the gaps" yes, there are TONS of options for doing this. I find that most people are comfortable with direct FME approach but lists, inline querier and python caller are very simple ways to accomplish this. But for this example here is a direct FME approach that is readable and will most likely be acceptable on performance.

This has 2 examples The Original_Code and New_Code is an example of filling in the gaps. It looks at a previous value based on sorting then does some math and cloning. The Sequenced simply replaces the existing values with an "in order" value but that would require updating the existing values.

If you are trying to manage the "A","B",etc. as well you could easily convert the split out text (see workspace) and convert it to the ASCII numeric value. This would let you re-index or fill in much simpler than trying to find the missing letter.

Hope this helps!! I would really look into the Python caller, you could do a very simple while statement that would fill in the gaps and create a new object. This would replace almost all of the transformers and would be tons more efficient if you have a lot of data.

rangegapfinder.fmw

 

ENJOY!!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

8 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+47

It wouldn't be easy with FME I don't think. You could do a two step process.

 

 

First step add a unique ID to each feature with a Counter. Write these out as new temporary feature classes, in the same process write out the new ID column as well as the sequence attributes to excel. Use excels sequence magic to fix the sequence.

 

Once you have a fixed sequence you can then read in the excel and your temp feature classes and then use a FeatureJoiner to get the fixed sequence back onto your features. remove the temp id field and you should have fixed data.

 

 

It's a little work but its probably faster than figuring out how FME can do this in one go.

takashi
Celebrity
  • July 31, 2019

I'm unclear what your desired result is. What does "newly created feature from North to South, West to East" mean?

If the input table looks like below, for example, what kind of table you need to create from this?

codeA001A002A005A006A007A010

dellerbeck
Contributor
Forum|alt.badge.img+7
  • Contributor
  • Best Answer
  • July 31, 2019

So if you are looking to "fill in the gaps" yes, there are TONS of options for doing this. I find that most people are comfortable with direct FME approach but lists, inline querier and python caller are very simple ways to accomplish this. But for this example here is a direct FME approach that is readable and will most likely be acceptable on performance.

This has 2 examples The Original_Code and New_Code is an example of filling in the gaps. It looks at a previous value based on sorting then does some math and cloning. The Sequenced simply replaces the existing values with an "in order" value but that would require updating the existing values.

If you are trying to manage the "A","B",etc. as well you could easily convert the split out text (see workspace) and convert it to the ASCII numeric value. This would let you re-index or fill in much simpler than trying to find the missing letter.

Hope this helps!! I would really look into the Python caller, you could do a very simple while statement that would fill in the gaps and create a new object. This would replace almost all of the transformers and would be tons more efficient if you have a lot of data.

rangegapfinder.fmw

 

ENJOY!!


bobo
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • August 1, 2019

I'm unclear what your desired result is. What does "newly created feature from North to South, West to East" mean?

If the input table looks like below, for example, what kind of table you need to create from this?

codeA001A002A005A006A007A010

Identify missing values A003, A004, A008 and A009 from the sequence, and after some editing, there're may be some feature has same value or no value, asign identified missing values to these features.


bobo
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • August 1, 2019

It wouldn't be easy with FME I don't think. You could do a two step process.

 

 

First step add a unique ID to each feature with a Counter. Write these out as new temporary feature classes, in the same process write out the new ID column as well as the sequence attributes to excel. Use excels sequence magic to fix the sequence.

 

Once you have a fixed sequence you can then read in the excel and your temp feature classes and then use a FeatureJoiner to get the fixed sequence back onto your features. remove the temp id field and you should have fixed data.

 

 

It's a little work but its probably faster than figuring out how FME can do this in one go.

Yeah, that's one way to do it, but how to asign values?


bobo
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • August 1, 2019

So if you are looking to "fill in the gaps" yes, there are TONS of options for doing this. I find that most people are comfortable with direct FME approach but lists, inline querier and python caller are very simple ways to accomplish this. But for this example here is a direct FME approach that is readable and will most likely be acceptable on performance.

This has 2 examples The Original_Code and New_Code is an example of filling in the gaps. It looks at a previous value based on sorting then does some math and cloning. The Sequenced simply replaces the existing values with an "in order" value but that would require updating the existing values.

If you are trying to manage the "A","B",etc. as well you could easily convert the split out text (see workspace) and convert it to the ASCII numeric value. This would let you re-index or fill in much simpler than trying to find the missing letter.

Hope this helps!! I would really look into the Python caller, you could do a very simple while statement that would fill in the gaps and create a new object. This would replace almost all of the transformers and would be tons more efficient if you have a lot of data.

rangegapfinder.fmw

 

ENJOY!!

Thank you very much, I'll try this tomorrow.


takashi
Celebrity
  • August 1, 2019

I'm unclear what your desired result is. What does "newly created feature from North to South, West to East" mean?

If the input table looks like below, for example, what kind of table you need to create from this?

codeA001A002A005A006A007A010

If you need to create this table from the above one, @dellerbeck's answer would help you.

codeA001A002A003A004A005A006A007A008A009A010

bobo
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • August 1, 2019

If you need to create this table from the above one, @dellerbeck's answer would help you.

codeA001A002A003A004A005A006A007A008A009A010

I'll try it tomorrow, already downloaded the attached fmw.