Hi Jukka,

PostGIS writer now detects if the geometry column is of type Multi*.
In this case it should wraps geometry inserts using the ST_Multi postgis function.
Let me know if it solves the problem for you.

I also added two functions in geometry functions plugin to wrap/unwrap single geometries into/from MultiGeometries

Michaël

Le 02/11/2016 à 20:51, Rahkonen Jukka (MML) a écrit :

Hi,

Yes, that table was created with GDAL. By default it takes the first feature from a shapefile and uses that as a template for creating the PostGIS table. Quite often it is polygon, which leads to an error when the first multipolygon is met, and a new conversion with an option “-nlt promote_to_multi” or with “-nlt geometry” for creating a layer as multigeometry or with a generic geometry type. Some people would prefer having “promote_to_multi” as a default because that would suit well for the combination of shapefiles, PostGIS, and QGIS. QGIS by design is more fixed to shapefile types and it likes to know if table has points, lines, or polygons.

If PostGIS table is of type MultiPolygon then OpenJUMP user must digitize a simple polygon, select it and convert to MultiPolygon with the geometry converter through the right click menu. It is not a hard job but perhaps it could be automatic. Either automatic cast to multipolygon once new polygon is created or automatic pro-processing of the whole bunch of features before changes are committed back to constrained PostGIS table would do is as well. I do not consider real geometry constraints necessary, flexibility with geometry types is a strength.

It does happen for me also the other way, features from polygon layer may be changed to multipolygons because of some processing and they must be exploded before saving. Multilines are not as common in our data, and multipoints are almost non-existing.

-Jukka-

*Lähettäjä:*Michaël Michaud [mailto:m.michael.mich...@orange.fr]
*Lähetetty:* 2. marraskuuta 2016 21:03
*Vastaanottaja:* jump-pilot-devel@lists.sourceforge.net
*Aihe:* Re: [JPP-Devel] Meaning of PostGIS table (new)

Hi Jukka,

Thanks for the tests.

You table has been created with GDAL right ? Because when a table is created from OpenJUMP, I declare only "geometry"
without further constraint as a OpenJUMP layer can contains any geometry.

To achieve what you ask in the general case may be quite complex, because we can find every kind of geometry in an OpenJUMP layer and the postgis table may have any type of constraint (maybe you would like to explode your multipolygon if the postgis table had a
Polygon constraint).
What I propose is to expose a function like ST_Multi to wrap any simple geometry into a MultiGeometry wrapper. Independant from
the PostGIS interface.
We can do the other way with "explode", but I think we can't transform simple geometries to multi right now.
What do you think ?

Michaël

Le 02/11/2016 à 15:22, Rahkonen Jukka (MML) a écrit :

    Hi,

    Perhaps at some point the old one could be changed back to
    read-only with dynamic refresh.

    I made some tests and at least I can edit, delete, and insert
    features into tables which are created with GDAL and with OpenJUMP
    itself.  I had brand new versions: PostgreSQL 9.6.1 and PostGIS
    2.3.  Feels rather good so far. The old driver is still good to
    have because it can read also not so thoroughly thought tables
    without primary keys etc.

    Some of my test tables were created from shapefiles having a
    mixture of polygons/multipolygons. They were all converted into
    multipolygons for PostGIS. If I now digitize new polygons with
    OpenJUMP they can’t be written into the database because it
    accepts only multipolygons. For effective editing OpenJUMP could
    have an option for creating new lines and polygons as
    multi-versions even if they are simple and the setting could be in
    the Options – View/Edit “Create new features as
    MultiLinestring/MultiPolygon”.  Or would it be better to have
    separate controls for lines and polygons?

    -Jukka Rahkonen-

    *Lähettäjä:*Michaël Michaud [mailto:m.michael.mich...@orange.fr]
    *Lähetetty:* 2. marraskuuta 2016 14:57
    *Vastaanottaja:* jump-pilot-devel@lists.sourceforge.net
    <mailto:jump-pilot-devel@lists.sourceforge.net>
    *Aihe:* Re: [JPP-Devel] Meaning of PostGIS table (new)

    Hi Jukka,

    PostGIS table (new) is supposed to replace the old one at some point,
    but both have a rich set of options which makes the comparison
    difficult
    and I have only had very few feedback on the second until now.

    Fundamentally, the old one load a table, then disconnect, then
    offers a
    few options to insert, replace or delete rows based on a unique
    identifier.

    The second one has a transaction mechanism based on OpenJUMP event
    system. It keeps track of all modifications made on a layer and
    can commit
    the corresponding transaction from a button click.
    
https://sourceforge.net/projects/jump-pilot/files/Documentation/OpenJUMP%201.7%20Docs/

    Michaël

    Le 02/11/2016 à 11:33, Rahkonen Jukka (MML) a écrit :

        Hi,

        We have two alternatives for saving data into PostGIS:
        “PostGIS table” and “PostGIS table (new)”.  I wonder if “new”
        in the latter means that the driver is new and better and it
        will replace the old driver in the future. Or does “new” mean
        that the driver can only create new tables and not replace or
        append data in existing tables?

        -Jukka Rahkonen-





        
------------------------------------------------------------------------------

        Developer Access Program for Intel Xeon Phi Processors

        Access to Intel Xeon Phi processor-based developer platforms.

        With one year of Intel Parallel Studio XE.

        Training and support from Colfax.

        Order your platform today.http://sdm.link/xeonphi





        _______________________________________________

        Jump-pilot-devel mailing list

        Jump-pilot-devel@lists.sourceforge.net
        <mailto:Jump-pilot-devel@lists.sourceforge.net>

        https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel




    
------------------------------------------------------------------------------

    Developer Access Program for Intel Xeon Phi Processors

    Access to Intel Xeon Phi processor-based developer platforms.

    With one year of Intel Parallel Studio XE.

    Training and support from Colfax.

    Order your platform today.http://sdm.link/xeonphi




    _______________________________________________

    Jump-pilot-devel mailing list

    Jump-pilot-devel@lists.sourceforge.net
    <mailto:Jump-pilot-devel@lists.sourceforge.net>

    https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi


_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to