Solved

How to read ESRI FileGeoDB spatial+non-spatial data with Search Envelope ?


Badge +9
  • Contributor
  • 101 replies

Hello

I seem to be locked with a seemingly simple problem with reading ESRI FileGDB (Geodatabase)

If I specify a Search Envelope the reader refuses to read non-spatial data.

Non-spatial data are only read if no Search Envelope is defined.

So how do I read spatial data with search envelope and all non-spatial data ?

Do I need two readers ?

If yes: How do I say read only non-spatial data ?

There is an option: "Spatial data only", I don't see a "non-spatial data only" option ?!

Thanks for any hints

Michael

icon

Best answer by takashi 18 June 2018, 10:26

View original

9 replies

Badge

In this case, you may need to use two Readers, or two FeatureReaders.

You only need to set the Table list to the spatial table and the non-spatial table respectively in the parameters of the two readers.

Badge +9

In this case, you may need to use two Readers, or two FeatureReaders.

You only need to set the Table list to the spatial table and the non-spatial table respectively in the parameters of the two readers.

I see...

 

My problem however is, that I have a list of 100+ tables, the list generated dynamically at runtime and I don't know easily from the list which ones are spatial and which are non spatial.

 

 

 

Userlevel 2
Badge +17

Hi @mhab, I think you can use the Schema (Any Format) reader to read schema features from the FGDB dataset and then separate the source tables into two groups - spatial tables and non-spatial tables. The schema features output from the Schema reader will have these attributes.

  • fme_feature_type_name: Feature type (table) name defined in the source FGDB dataset.
  • geometry{0}: Geometry type name identified by FME.

If a table is for non-spatial layer, the value of "geometry{0}" would be "fme_no_geom", so you can separate the schema features into the two groups according to "geometry{0}". You can then create table names list (space separated table names) from "fme_feature_type_name" for each group, and pass it to the Feature Types to Read parameter in a corresponding FeatureReader - reading spatial features or reading non-spatial features.

Badge
I see...

 

My problem however is, that I have a list of 100+ tables, the list generated dynamically at runtime and I don't know easily from the list which ones are spatial and which are non spatial.

 

 

 

You can refer to the following workspace.

 

 

read-gdb-table.fmw

 

Userlevel 2
Badge +17

Hi @mhab, I think you can use the Schema (Any Format) reader to read schema features from the FGDB dataset and then separate the source tables into two groups - spatial tables and non-spatial tables. The schema features output from the Schema reader will have these attributes.

  • fme_feature_type_name: Feature type (table) name defined in the source FGDB dataset.
  • geometry{0}: Geometry type name identified by FME.

If a table is for non-spatial layer, the value of "geometry{0}" would be "fme_no_geom", so you can separate the schema features into the two groups according to "geometry{0}". You can then create table names list (space separated table names) from "fme_feature_type_name" for each group, and pass it to the Feature Types to Read parameter in a corresponding FeatureReader - reading spatial features or reading non-spatial features.

This screenshot illustrates my intention.

 

 

Badge

Hi @mhab, I think you can use the Schema (Any Format) reader to read schema features from the FGDB dataset and then separate the source tables into two groups - spatial tables and non-spatial tables. The schema features output from the Schema reader will have these attributes.

  • fme_feature_type_name: Feature type (table) name defined in the source FGDB dataset.
  • geometry{0}: Geometry type name identified by FME.

If a table is for non-spatial layer, the value of "geometry{0}" would be "fme_no_geom", so you can separate the schema features into the two groups according to "geometry{0}". You can then create table names list (space separated table names) from "fme_feature_type_name" for each group, and pass it to the Feature Types to Read parameter in a corresponding FeatureReader - reading spatial features or reading non-spatial features.

Hi @takashi, I didn't notice that the schema reader can also read geomery's information and learn.

 

In my method, the Esri Geodatabase (File Geodb Open API) reader cannot set the WHERE Clause parameter. Only the Esri Geodatabase (File Geodb) reader has this parameter, so if you do not have ArcGIS installed, you will not be able to use it. From any perspective, use the the schema reader's method is better.
Userlevel 2
Badge +17
Hi @takashi, I didn't notice that the schema reader can also read geomery's information and learn.

 

In my method, the Esri Geodatabase (File Geodb Open API) reader cannot set the WHERE Clause parameter. Only the Esri Geodatabase (File Geodb) reader has this parameter, so if you do not have ArcGIS installed, you will not be able to use it. From any perspective, use the the schema reader's method is better.
Also be aware that every feature class doesn't always contain a feature where OBJECTID = 1.

 

 

Badge
Also be aware that every feature class doesn't always contain a feature where OBJECTID = 1.

 

 

Thank you for your reminder, this is indeed the case.

 

I tried to set the Max Features to Read Per Feature Type parameter to 1 in the normal Esri Geodatabase (File Geodb Open API) reader and Esri Geodatabase (File Geodb) reader too, but unfortunately it seems to be ineffective. The reader only reads one feature .

 

Badge +9

Hi @mhab, I think you can use the Schema (Any Format) reader to read schema features from the FGDB dataset and then separate the source tables into two groups - spatial tables and non-spatial tables. The schema features output from the Schema reader will have these attributes.

  • fme_feature_type_name: Feature type (table) name defined in the source FGDB dataset.
  • geometry{0}: Geometry type name identified by FME.

If a table is for non-spatial layer, the value of "geometry{0}" would be "fme_no_geom", so you can separate the schema features into the two groups according to "geometry{0}". You can then create table names list (space separated table names) from "fme_feature_type_name" for each group, and pass it to the Feature Types to Read parameter in a corresponding FeatureReader - reading spatial features or reading non-spatial features.

Thanks takashi

 

 

It needed quite some effort to get all options transfered from FileGDB reader to the combination of SchemaReader and seperate FeatureReaders for spatial and non-spatial, but it works now.

 

 

One option is not transferable however: START_FEATURE is only supported by the FileGDB Reader and not the FeatureReader.

 

 

EDIT:

 

I was wrong about PostGIS reading non-spatial features with rectangle filter specified.

 

It is a pain, but I have to fix this too by myself. PostGIS reader doesn't even mention that nothing is read from non-spatial feature tables. Not nice !!!

 

EDIT 2:

 

PostGIS reads non-spatial features even with rectangle specified, only when CLIP_TO_ENVELOPE is set then it doesn't read non-spatial features.

 

Really inconsistent behaviour !

 

 

 

Michael

 

 

Reply