Question

Change the name of the geometry column in a dynamic reader?


Badge +1


6 replies

Badge +1
I have a geopackage database of tables that I want to transfer to a spatialite database. [Because the geopackage has different system tables and Esri does not support the GDAL extension to allow aspatial tables (!)]

 

So the obvious workbench is a simple dynamic workflow. It now works but there are several gotchas. The first is that I have to use two writers for sqlite/spatialite because FME does not merge these writers for spatial and non-spatial tables.

 

The next issue is the name of the geometry field has been set as 'Geometry' and for downstream compatibility I need it called 'Shape'. Is there an fme_format attribute I can set?

 

The third problem I gave up on was adding a timestamp field to all tables. Its just too hard in a dynamic workflow. I have read all the tutorials and am no wiser.

 

 

Userlevel 2
Badge +12

I do not know if this works fpr geopackage.

But during the workflow you can use the GeometryPropertySetter to set the name for the geometry.

The Oracle and SmallWorld writers do use that option.

Worth a try.

Badge +1

I do not know if this works fpr geopackage.

But during the workflow you can use the GeometryPropertySetter to set the name for the geometry.

The Oracle and SmallWorld writers do use that option.

Worth a try.

Thanks. That is just what I was looking for. If there is a transformer then it has been noted and handled.....

 

But it doesn't work as expected (or documented) No exclusions for spatialite. So I changed to a static workflow. Nope. I tried getting the definition on the writer from another spatialite reader with the geometry called 'shape'. Nope.

 

It appears spatialite writer always sets the shape field as 'GEOMETRY'. If I start again then the renamer does work for a new table directed into the Inspector, but if it is then written out it turns into 'GEOMETRY'. There are other tables in the same database that do have a name 'shape'.that have been written by other software.

 

 

It seems that the spatialite reader and writer is a bit 'unloved' by Safe.

 

 

Badge +3

I think the problem lies in the Dynamic Writer. It takes the properties from the reader and applies them to the Writer. If the Writer has a different geometry column, it will not be recognized within the definition.

I don't know how many classes you have, but it might be an option to import the Writer feature class and adjust the column afterwards. When you add the Writer, you select 'Import from Dataset' for 'Add Feature Type(s). When you get the dialog you select the original reader (geopackage database) and select the feature types you want to import. When you have the writers you want you can adjust the columns as is needed for writing purposes.

Another option is to add the columns with the geometry as new columns, a dynamic writer allows that, but I am not sure whether that will not conflict with the existing geometry columns when writing or will result in a corrupt output having two geometry columns.

Badge +1

I think the problem lies in the Dynamic Writer. It takes the properties from the reader and applies them to the Writer. If the Writer has a different geometry column, it will not be recognized within the definition.

I don't know how many classes you have, but it might be an option to import the Writer feature class and adjust the column afterwards. When you add the Writer, you select 'Import from Dataset' for 'Add Feature Type(s). When you get the dialog you select the original reader (geopackage database) and select the feature types you want to import. When you have the writers you want you can adjust the columns as is needed for writing purposes.

Another option is to add the columns with the geometry as new columns, a dynamic writer allows that, but I am not sure whether that will not conflict with the existing geometry columns when writing or will result in a corrupt output having two geometry columns.

Yes, I tried all sorts of workarounds, see the last comment (not answer). It looks great in the Inspector, but writes something different to the database. I have submitted a bug report. I note that ArcCatalog does not automatically change the geometry field to shape either. I could handle a different shape-name but my workflow would need to be edited, especially if there were multiple names. Adding any template ignores the shape name it is always GEOMETRY in caps.

 

 

Badge +3

I think the problem lies in the Dynamic Writer. It takes the properties from the reader and applies them to the Writer. If the Writer has a different geometry column, it will not be recognized within the definition.

I don't know how many classes you have, but it might be an option to import the Writer feature class and adjust the column afterwards. When you add the Writer, you select 'Import from Dataset' for 'Add Feature Type(s). When you get the dialog you select the original reader (geopackage database) and select the feature types you want to import. When you have the writers you want you can adjust the columns as is needed for writing purposes.

Another option is to add the columns with the geometry as new columns, a dynamic writer allows that, but I am not sure whether that will not conflict with the existing geometry columns when writing or will result in a corrupt output having two geometry columns.

@kimo Could you share some data?

 

 

Reply