Question

Data Downloading with User Parameters allowing users to draw box or clip by existing layer

  • 22 September 2022
  • 6 replies
  • 11 views

Badge

Hey there,

 

So I recently set up a Data Distribution service on FME Server using this tutorial https://community.safe.com/s/article/data-distribution-fme-server-app . Everything works fine and I can use the area of interest box to draw an area and download all the relevant layers.

I am trying to add a second option in the User Parameters to allow the user to either draw a selection or choose a layer to clip by.

In user parameters I added a 'Choice' option and added a layer as an option to clip by imagemy thought was I could add a second geometryreplacer, set the encoding to OGC well known text and the source as $(LAYERCLIP) by when I run it and select the City Boundary to clip but FME gives me the error INVALID_PARAMETER_GEOMETRY_SOURCE. Is it because FME doesn't know what GISOWNER.city_boundary is? Its a layer in our enterprise SDE. I tried adding in a featurereader to read the layer before it goes to the replacer and had no luck.

image 

Thanks!


6 replies

Badge +10

Hi @tslack​, you might not need to use the GeometryReplacer at all for the city boundary stream. That parameter in the transformer can't accept a featureclass name.

imageThat transformer is typically used to restore geometry previously extracted into an attribute by the GeometryExtractor.

 

I would use a feature reader to read the city boundary instead. Can you try that route again without using a GeometryReplacer?

Badge

Hi @tslack​, you might not need to use the GeometryReplacer at all for the city boundary stream. That parameter in the transformer can't accept a featureclass name.

imageThat transformer is typically used to restore geometry previously extracted into an attribute by the GeometryExtractor.

 

I would use a feature reader to read the city boundary instead. Can you try that route again without using a GeometryReplacer?

@carmijo​ thanks, i am fairly new to FME and very new to FME server. i guess when using featurereader my question is how to tie that back into the User Parameters. With the GeometeryReplacer for the AOI selection, I am able to specify the geometry source by way of what I named the AOI parameter identifier in the User Parameters image" data-fileid="0694Q00000LFdgOQATRight now the input on the app page looks like

image" data-fileid="0694Q00000LFdgsQAD 

Where they have an option to select by AOI or to clip by an existing layer. I've named the parameter identifier in the User Parameters dialog but am uncertain as to how to reference it in the workflow so that when a user selects that option its triggered and when they don't choose it its not triggered.

 

Thanks again

Badge

@carmijo​ thanks, i am fairly new to FME and very new to FME server. i guess when using featurereader my question is how to tie that back into the User Parameters. With the GeometeryReplacer for the AOI selection, I am able to specify the geometry source by way of what I named the AOI parameter identifier in the User Parameters image" data-fileid="0694Q00000LFdgOQATRight now the input on the app page looks like

image" data-fileid="0694Q00000LFdgsQAD 

Where they have an option to select by AOI or to clip by an existing layer. I've named the parameter identifier in the User Parameters dialog but am uncertain as to how to reference it in the workflow so that when a user selects that option its triggered and when they don't choose it its not triggered.

 

Thanks again

my first thought was a testfilter but i didn't have a much luck. i guess in my head the testfilter needs some way of looking to see if the user parameters value for LAYERCLIP (what i called the parameter id) = 'City Boundary' but I cant quite find a format that works for that.

 

EDIT: You put me on the right track confirming I had to use featurereader.

 

I managed to get this working by using parameterfetcher and passing that into an attribute and using a testfilter on that. Thanks!

Badge +10

@carmijo​ thanks, i am fairly new to FME and very new to FME server. i guess when using featurereader my question is how to tie that back into the User Parameters. With the GeometeryReplacer for the AOI selection, I am able to specify the geometry source by way of what I named the AOI parameter identifier in the User Parameters image" data-fileid="0694Q00000LFdgOQATRight now the input on the app page looks like

image" data-fileid="0694Q00000LFdgsQAD 

Where they have an option to select by AOI or to clip by an existing layer. I've named the parameter identifier in the User Parameters dialog but am uncertain as to how to reference it in the workflow so that when a user selects that option its triggered and when they don't choose it its not triggered.

 

Thanks again

You could set it up like this where the featurereader feature types to read are taken from the user input of the 'clip_layer' paremeter. If a user draws a polygon to clip by, it will be used. If a user selects a layer to clip by, it will be used instead. In this example, the user would need to put something in one of the two parameter or nothing will happen.

imageimage---

If i've provided something helpful, please upvote the comment. If i've provided a solution, please mark it as 'Best Answer'. This marks the post as answered and helps the community find the solution. If I didn't provide a solution, please let me know if I can help further. Thanks! 🙂

Badge

@carmijo​ thanks, i am fairly new to FME and very new to FME server. i guess when using featurereader my question is how to tie that back into the User Parameters. With the GeometeryReplacer for the AOI selection, I am able to specify the geometry source by way of what I named the AOI parameter identifier in the User Parameters image" data-fileid="0694Q00000LFdgOQATRight now the input on the app page looks like

image" data-fileid="0694Q00000LFdgsQAD 

Where they have an option to select by AOI or to clip by an existing layer. I've named the parameter identifier in the User Parameters dialog but am uncertain as to how to reference it in the workflow so that when a user selects that option its triggered and when they don't choose it its not triggered.

 

Thanks again

Thanks for the response. I'll try this out and see if its any faster. I managed to come up with this that seems to work so far

image

Badge +10

@carmijo​ thanks, i am fairly new to FME and very new to FME server. i guess when using featurereader my question is how to tie that back into the User Parameters. With the GeometeryReplacer for the AOI selection, I am able to specify the geometry source by way of what I named the AOI parameter identifier in the User Parameters image" data-fileid="0694Q00000LFdgOQATRight now the input on the app page looks like

image" data-fileid="0694Q00000LFdgsQAD 

Where they have an option to select by AOI or to clip by an existing layer. I've named the parameter identifier in the User Parameters dialog but am uncertain as to how to reference it in the workflow so that when a user selects that option its triggered and when they don't choose it its not triggered.

 

Thanks again

good to hear! take care

Reply