Solved

Polygon to Multipolygon

  • 15 September 2016
  • 14 replies
  • 171 views

Badge

I want to transform a Personal Geodatabase to a PostGIS database. In my Personal Geodatabase are Polygons (which also have multi parts). I used an Aggregator Grouped by OBJECTID of the features to create Multipolygons. Unfortunately this resulted in a geometry collection, so I used a GeometryRefiner which was suggested to me, but this only converted the Geometry collection back to Polygons. I also applied a GeometryFilter to check that there are only Areas in the dataset - this is actually true.

So, how can I identify the error? And how can I create Multipolygons so that my transformation will be successful?

icon

Best answer by david_r 15 September 2016, 10:39

View original

14 replies

Userlevel 4

What exactly is the error that you're getting? Can you post log here please.

If you use the Aggregator and group by the OBJECTID, it is very probable that no aggregates are generated, as usually the OBJECTID is unique.

In most cases, FME should be able to automaticall convert your geometries to the format expected by PostGIS. Which geometry type is used in your destination table?

Badge

What exactly is the error that you're getting? Can you post log here please.

If you use the Aggregator and group by the OBJECTID, it is very probable that no aggregates are generated, as usually the OBJECTID is unique.

In most cases, FME should be able to automaticall convert your geometries to the format expected by PostGIS. Which geometry type is used in your destination table?

Hi david,

 

the error with the Geometry refiner is:

 

Bulk copy failed on table 'cadaster.parcel' using delimiter ':'. Error was 'ERROR: Geometry type (Polygon) does not match column type (MultiPolygon)

 

If I use an aggregator without a geometry refiner, I would get a geometrycollection and the following error:

 

Error was 'ERROR: Geometry type (GeometryCollection) does not match column type (MultiPolygon)

 

CONTEXT: COPY parcel, line 1, column geometry: "0107000020887F000001000000010600000002000000010300

 

 

Userlevel 4

What happens if you try to set postgis_type to postgis_multipolyon:

Documentation here: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/postgis/Feature_Representation.htm

Userlevel 4

Also, when creating the writer, make sure to deselect "Create generic spatial columns", that way you can manually specify the geometry type in the output feature type properties:

Badge

Also, when creating the writer, make sure to deselect "Create generic spatial columns", that way you can manually specify the geometry type in the output feature type properties:

Great - That solved it!

 

Always a pleasure!

 

 

Badge +6

this is a bit of a trick in the system as you can only get to it when you first create the writer

once setup it is easy but if you leave it to generic you could end up with anything, we even had multisurface....

Badge +6

Also, when creating the writer, make sure to deselect "Create generic spatial columns", that way you can manually specify the geometry type in the output feature type properties:

maybe the check box should be reversed to be off by default

 

 

Badge +6

What happens if you try to set postgis_type to postgis_multipolyon:

Documentation here: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/postgis/Feature_Representation.htm

 

i tried that as a solution and it failed
Userlevel 4
Badge +13

An idea to add a parameter on the PostGIS Writer to better handle geometry situations like these has been posted on the Ideas Exchange:

 

PostGIS Writer: Add option to better manage geometry

Check it out and be sure to up vote it if you think it'll help your workflows!

Also, when creating the writer, make sure to deselect "Create generic spatial columns", that way you can manually specify the geometry type in the output feature type properties:

Where can I find this geometry type setting? I can't seem to find it in my postGIS writter... Thanks !

Userlevel 4

Where can I find this geometry type setting? I can't seem to find it in my postGIS writter... Thanks !

I just checked with FME 2019.0.2 and the setting is still there. Where are you looking?

Userlevel 6
Badge +33

Where can I find this geometry type setting? I can't seem to find it in my postGIS writter... Thanks !

@tsirkuse you probably have to uncheck "Create Generic Spatial Columns" in the "PostGIS Parameters" to set a geometry type in the writer.

Also, when creating the writer, make sure to deselect "Create generic spatial columns", that way you can manually specify the geometry type in the output feature type properties:

Hi. Is mulpolygon not available on FME 2018? I can see that option in the writer... If not, how can I convert a polygon to a multipolygon? Thanks!

Userlevel 3
Badge +13

Hi. Is mulpolygon not available on FME 2018? I can see that option in the writer... If not, how can I convert a polygon to a multipolygon? Thanks!

Hi @juanrodriguezso! Multipolygons should be available in FME 2018 if you use the Aggregator transformer. Take a look at this suggestion here: https://knowledge.safe.com/answers/114846/view.html

Reply