Skip to main content

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

@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


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


@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​ 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👍


Reply