Skip to main content
Solved

Rename attribute when translation in dynamic mode and run in FME server


viviancfhung
Contributor
Forum|alt.badge.img+1

I want to translate a shp file into gpkg format, but there is a id(32 bit int in shp) field in shp file. I can't do it via FME server

It throw errors of

3792023-3-7 11:28:17 | OGCGEOPACKAGE writer: OGCGEOPACKAGE writer: For feature type 'd_y_n40', primary key attribute 'id' has unsupported type 'mediumint'. Primary key must have type 'int,PrimaryKey'

I try to use AttributeRenamer, But it is not working.

How can I use AttributeRenamer in this case

The attached is testing dataset

Best answer by markatsafe

@viviancfhung​ If you are using a dynamic workflow, I think all you have to do is add the new id (type int, Primary Key) to the writer Feature type. This will probably be the only attribute on the feature type. It will get appended to any other attributes that get mapped with the dynamic mode. When you read the GeoPackage back, this will be represented as the geopackage_fid - which the FME reader uses to represent the Primary Key. Sorry about the confusion

image

View original
Did this help you find an answer to your question?

4 replies

Forum|alt.badge.img+2

@viviancfhung​ Thanks for including a nice small sample dataset. Geopackage assumes an attribute called 'id' will be the primary key so it needs to be type 'int' with the index set to primary key. If you do not need the 'id' attribute to be the primary key in the geopackage, then just add another attribute, i.e. primaryID and set that to int & Primary Key. You don't need to map anything to the new attribute, GeoPaackage will populate it with unique values


viviancfhung
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • March 9, 2023

You mean I should modify the original shp file and add a primaryID attribute?


Forum|alt.badge.img+2
  • Best Answer
  • March 9, 2023

@viviancfhung​ If you are using a dynamic workflow, I think all you have to do is add the new id (type int, Primary Key) to the writer Feature type. This will probably be the only attribute on the feature type. It will get appended to any other attributes that get mapped with the dynamic mode. When you read the GeoPackage back, this will be represented as the geopackage_fid - which the FME reader uses to represent the Primary Key. Sorry about the confusion

image


viviancfhung
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • March 14, 2023
markatsafe wrote:

@viviancfhung​ If you are using a dynamic workflow, I think all you have to do is add the new id (type int, Primary Key) to the writer Feature type. This will probably be the only attribute on the feature type. It will get appended to any other attributes that get mapped with the dynamic mode. When you read the GeoPackage back, this will be represented as the geopackage_fid - which the FME reader uses to represent the Primary Key. Sorry about the confusion

image

Thanks, Let me try. It's works👍


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