Skip to main content
Solved

Help on my spatial allocation script

  • December 10, 2013
  • 1 reply
  • 4 views

Hi all

 

 

A short introduction to my script so far: I have two readers 

 

 

a. NewsArticle (s stands for source)

 

ID-S   |   Text     |    Country_S     |      Sector_S

 

1.              ...

 

...               ...

 

30             ...

 

 

b. Shapefiles of all different sectors

 

ID-dB   |   Sector_dB  |   Country_dB  |   

 

1.               .... 

 

...              ....

 

30000    .....

 

 

The mail goal is to assign the different Newsarticles to the correct sector (in order to map the news). I am doing this by an inlinequery that Takashi suggested. This query's output are all the articles that are both matched by country as by sector. (lets say 14 out of the 30 articles).

 

 

I would now like to use the rest of the articles (that have not been assigned to a specific sector) to be linked at the country level. I have a shapefile of all the countries.

 

I have come up so far with a query that links all the articles to a country, but I only need the ones that are not yet linked to a sector.

 

 

Is there an easy filter method or even better a query to efficiently do this?

 

Best answer by takashi

Hi again,

 

 

There could be several approach, one possible way is like this. Continuing from my post in the previous Q&A; and assume the NewsArticle features have unique identifier attribute named "ArticleID".

 

  1) Append a column for "ArticleID" to NewsArticle table in the InlineQuerier. Table: NewsArticle:   Columns:     ARTICLE  text     SOURCE  text     ArticleID  <appropriate type>   2) Append another output port to the InlineQuerier, select articles which matches with a country. Output Port: Matched2 SQL Query: ----- select a.fme_feature_content, b.ARTICLE, b.SOURCE, b.ArticleID from Location as a cross join NewsArticle as b where b.SOURCE like '%'||a.COUNTRY||'%' -----   3) Modify SQL for "Matched" port so that "ArticleID" will be added to selected features. ----- select a.fme_feature_content, b.ARTICLE, b.SOURCE, b.ArticleID ... -----   4) Use a FeatureMerger to find target articles. i.e. Matched2 --> REQUESTOR Matched --> SUPPLIER Join On: ArticleID   Then, NOT_MERGED features will be target articles.

 

 

Takashi
View original
Did this help you find an answer to your question?
<strong>This post is closed to further activity.</strong><br /> It may be a question with a best answer, an implemented idea, or just a post needing no comment.<br /> If you have a follow-up or related question, please <a href="https://community.safe.com/topic/new">post a new question or idea</a>.<br /> If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

takashi
Influencer
  • Best Answer
  • December 10, 2013
Hi again,

 

 

There could be several approach, one possible way is like this. Continuing from my post in the previous Q&A; and assume the NewsArticle features have unique identifier attribute named "ArticleID".

 

  1) Append a column for "ArticleID" to NewsArticle table in the InlineQuerier. Table: NewsArticle:   Columns:     ARTICLE  text     SOURCE  text     ArticleID  <appropriate type>   2) Append another output port to the InlineQuerier, select articles which matches with a country. Output Port: Matched2 SQL Query: ----- select a.fme_feature_content, b.ARTICLE, b.SOURCE, b.ArticleID from Location as a cross join NewsArticle as b where b.SOURCE like '%'||a.COUNTRY||'%' -----   3) Modify SQL for "Matched" port so that "ArticleID" will be added to selected features. ----- select a.fme_feature_content, b.ARTICLE, b.SOURCE, b.ArticleID ... -----   4) Use a FeatureMerger to find target articles. i.e. Matched2 --> REQUESTOR Matched --> SUPPLIER Join On: ArticleID   Then, NOT_MERGED features will be target articles.

 

 

Takashi

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings