Skip to main content

Hello, 

I have an input dataset, that has numerous fields which are Null, and only a handful of fields that are useful. I want to completely remove the attribute fields that are Null, only leaving the useful data. Input is a geo-package, and output is a file geodatabase. I have actually achieved the goal to 90% but have hit a snag, which this post is about. 

The geopackage has numerous layer I am doing this for, but for this post I will focus on the OBSTRN layer. 

My current work flow is:

Reader (OBSTRN) > NullAttributeMapper (Sets Nulls to Missing) > SchemaScanner (Removes Empty Attributes) > Dynamic Writer 

The dynamic writer settings: 

Feature Class/Table Name: fme_feature_type

Geometry: From Schema Definition

Schema Source: “Schema from Schema Feature”

Schema Def Name: fme_feature_type_name

  1. As mentioned , this output gets me to what I want about 90-95%. The problem is. Within the OBSTRN object class, there exists Points, Lines, and Polygons. I have noticed in other objects that have a single geometry, and attribute values are all null, the attribute field is removed, which is great. But, when multiple geometries exist, all attribute values for a particular field must be null across all geometries within the object class in order for it to be removed. So if OBSTRN.L has an attribute value, but in  OBSTRN.A the values are all null, because OBSTRN.L is populated, the field remains in OBSTRN.A. See output examples below. 
  2. In the above example, the CONDTN field should not be in the output, because all the values are <Null>. However I think this is because other CONDTN attributes within the OBSTRN object class (OBSTRN.polygon) do have values other than <Null>. See below 

    So I really would like the attribute field to get dropped when all <Null> based on geometries for the object class, instead of the object class as a whole. 

I have tried to place Geometry Filter before the NullAttributeMapper, in between NullAttributeMapper and Schema Scanner, and after SchemaScanner, but continuously get warnings with no output.

 Here are the warnings I am getting, pretty much warnings for all attributes it seems. It creates the GDB, but no feature classes. 

 

Appreciate any help, please let me know if you need more information. 

Thanks 

 

I think you need to suffix the feature class name with the geometry type before the SchemaScanner instead of after the SchemaScanner. Then you will get a different schema for OBSTRN_polygon and OBSTRN_line if the attributes differ.


When you say “suffix” you are referring to the GeometryFilter? I have placed that before the SchemaScanner as well, and get the same warnings with no output… I have also placed it at the front, before NullAttributeManager. 


What causes the text “_polygon” after the featureclass name? If you fix that manually, your issue is solved? I attached a sample of how I do this.

 


I am pretty sure the _polygon is coming from when the dynamic schema is being written…

If there is only one geometry in the object class it will just output the object name, no geometry.. Only adds _line, _polygon, _area if theres multiple geometries in the object class…. I am not sure if that will fix, can play with getting rid of it… Thanks for the file as well, I will see if I can work it in without completely restructuring mine. 


So if you make sure it is generic (so only point or line or polygon per feature class name) your issue is fixed.


Reply