2

I'm using MapInfo 16 to edit a PostGIS table through ODBC driver. The geometry column type of my table is MultiPolygon. The value in spatialtype colmun of a record in mapinfo.mapinfo_mapcatalog table is 19.2. That stands for MapInfo region type AFAIK.

When I'm hitting a Save Table button, I get an ODBC Error: Geometry type (Polygon) does not match column type (MultiPolygon);

So I guess MapInfo is trying to insert a Polygon geometry into a MultiPolygon column. Converting new created features to regions doesn't help.

The only workaround I can think of is to set a BEFORE INSERT trigger on this table with something like NEW.geom := st_multi(NEW.geom); But it doesn't seem like a natural solution. Maybe I'm missing something in MapInfo options?

UPDATE:Proposed trigger solution doesn't work. Seems like type checking happens earlier than trigger fires.

  • If "region" stands for both polygons and multipolygons for MapInfo then your solution feels good to me. Another option would be to create the geometry column in PostGIS as general "GEOMETRY". – user30184 Oct 1 '17 at 15:08
  • Trigger doesn't work. It seems to be fired after type checking. A general "GEOMETRY" is another workaround, but then I'll have problems with editing by QGIS etc. – mofoyoda Oct 1 '17 at 16:33
  • If you do not have real multipart polygons you could change the PostGIS table into "POLYGON" then. – user30184 Oct 1 '17 at 20:03
  • I do have multipolygons in my table. That is why it's of MultiPolygon type. Some of them have only one geometry, but often not. Splitting a table into polys and multipolys isn't convenient either. – mofoyoda Oct 1 '17 at 23:24
  • Doesn't PostGIS allow you to insert Polygon as well as MultiPolygon into a table? In MapInfo Pro a Region basically can be both. – Peter Horsbøll Møller Oct 2 '17 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.