Skip to main content
Solved

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

  • March 7, 2023
  • 4 replies
  • 55 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img+2
  • 1891 replies
  • March 7, 2023

@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
  • 51 replies
  • March 9, 2023

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


Forum|alt.badge.img+2
  • 1891 replies
  • 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
  • 51 replies
  • March 14, 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

Thanks, Let me try. It's works👍