Turning a single MultiPolygon into many small polygons?How to run a simple python script for QGIS from...

Have the UK Conservatives lost the working majority and if so, what does this mean?

Can I legally make a website about boycotting a certain company?

Multiple null checks in Java 8

Can I combine Divination spells with Arcane Eye?

Why would you use 2 alternate layout buttons instead of 1, when only one can be selected at once

Is there a way to pause a running process on Linux systems and resume later?

Log to console in a Lightning Web Component

How does the spell Slow affect freefall?

How do I write a maintainable, fast, compile-time bit-mask in C++?

simplicial objects in a model category

How to play songs that contain one guitar when we have two or more guitarists?

Did the characters in Moving Pictures not know about cameras like Twoflower's?

Isn't a semicolon (';') needed after a function declaration in C++?

Coworker asking me to not bring cakes due to self control issue. What should I do?

Build ASCII Podiums

Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded

How do I handle a blinded enemy which wants to attack someone it's sure is there?

What is formjacking?

Why Doesn't It Completely Uninstall?

Buying a "Used" Router

Can I do anything else with aspersions other than cast them?

Is there any danger of my neighbor having my wife's signature?

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

Are encryption algorithms with fixed-point free permutations inherently flawed?



Turning a single MultiPolygon into many small polygons?


How to run a simple python script for QGIS from outside (e.g. Sublime Text)?Converting huge multipolygon to polygonsEliminate small polygons from shapefileBBox missing when converting TIGER to GeoJSONOGR merge shapefiles of different geom type into a single GeoJSON feature collectionConvert GeoJSON with multiple Polygons and MultiPolygons into single MultiPolygon?How to export thousands of features from PostGIS to a single GeoJSON file?Export to DXF from PostgreSQL using ogr2ogrfrom geometrycollection to polygon geometry with pythonClip overlapping polygon in equal sharing sizeCreating Multipolygon Shapefile from MultiLineString GeoJson using ogr2ogr?how to use GDAL ogr2ogr













1















I have a large GeoJSON file with a single very complex MultiPolygon, and I would like to turn it into an identical file with many small polygons.



How can I do this? I can use ogr2ogr or mapshaper or PostGIS, or any other command-line tool.



This is what my file looks like:



enter image description here










share|improve this question

























  • If you want to use QGIS this is very quick using the multipart to singleparts tool.

    – TeddyTedTed
    Jan 8 at 16:23











  • Thanks! My source file is actually about 9GB(!) so I'd prefer to use something command line.

    – Richard
    Jan 8 at 16:27











  • Ah I see, I haven't done it before so I have no idea if it would work for you but you might want to have a look at this question and see if it helps at all.

    – TeddyTedTed
    Jan 8 at 16:36






  • 1





    Thanks. I ended up using PostGIS and doing CREATE TABLE polygon_table AS SELECT id (ST_Dump(geom)).geom::geometry(Polygon,27700) AS geom FROM multipolygon_table.

    – Richard
    Jan 8 at 21:20











  • @Richard would you post your findings as an answer and accept it?

    – Logan Byers
    Jan 16 at 0:43
















1















I have a large GeoJSON file with a single very complex MultiPolygon, and I would like to turn it into an identical file with many small polygons.



How can I do this? I can use ogr2ogr or mapshaper or PostGIS, or any other command-line tool.



This is what my file looks like:



enter image description here










share|improve this question

























  • If you want to use QGIS this is very quick using the multipart to singleparts tool.

    – TeddyTedTed
    Jan 8 at 16:23











  • Thanks! My source file is actually about 9GB(!) so I'd prefer to use something command line.

    – Richard
    Jan 8 at 16:27











  • Ah I see, I haven't done it before so I have no idea if it would work for you but you might want to have a look at this question and see if it helps at all.

    – TeddyTedTed
    Jan 8 at 16:36






  • 1





    Thanks. I ended up using PostGIS and doing CREATE TABLE polygon_table AS SELECT id (ST_Dump(geom)).geom::geometry(Polygon,27700) AS geom FROM multipolygon_table.

    – Richard
    Jan 8 at 21:20











  • @Richard would you post your findings as an answer and accept it?

    – Logan Byers
    Jan 16 at 0:43














1












1








1








I have a large GeoJSON file with a single very complex MultiPolygon, and I would like to turn it into an identical file with many small polygons.



How can I do this? I can use ogr2ogr or mapshaper or PostGIS, or any other command-line tool.



This is what my file looks like:



enter image description here










share|improve this question
















I have a large GeoJSON file with a single very complex MultiPolygon, and I would like to turn it into an identical file with many small polygons.



How can I do this? I can use ogr2ogr or mapshaper or PostGIS, or any other command-line tool.



This is what my file looks like:



enter image description here







postgis postgresql polygon multipart singlepart






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 min ago









Andre Silva

7,525113682




7,525113682










asked Jan 8 at 16:20









RichardRichard

93611429




93611429













  • If you want to use QGIS this is very quick using the multipart to singleparts tool.

    – TeddyTedTed
    Jan 8 at 16:23











  • Thanks! My source file is actually about 9GB(!) so I'd prefer to use something command line.

    – Richard
    Jan 8 at 16:27











  • Ah I see, I haven't done it before so I have no idea if it would work for you but you might want to have a look at this question and see if it helps at all.

    – TeddyTedTed
    Jan 8 at 16:36






  • 1





    Thanks. I ended up using PostGIS and doing CREATE TABLE polygon_table AS SELECT id (ST_Dump(geom)).geom::geometry(Polygon,27700) AS geom FROM multipolygon_table.

    – Richard
    Jan 8 at 21:20











  • @Richard would you post your findings as an answer and accept it?

    – Logan Byers
    Jan 16 at 0:43



















  • If you want to use QGIS this is very quick using the multipart to singleparts tool.

    – TeddyTedTed
    Jan 8 at 16:23











  • Thanks! My source file is actually about 9GB(!) so I'd prefer to use something command line.

    – Richard
    Jan 8 at 16:27











  • Ah I see, I haven't done it before so I have no idea if it would work for you but you might want to have a look at this question and see if it helps at all.

    – TeddyTedTed
    Jan 8 at 16:36






  • 1





    Thanks. I ended up using PostGIS and doing CREATE TABLE polygon_table AS SELECT id (ST_Dump(geom)).geom::geometry(Polygon,27700) AS geom FROM multipolygon_table.

    – Richard
    Jan 8 at 21:20











  • @Richard would you post your findings as an answer and accept it?

    – Logan Byers
    Jan 16 at 0:43

















If you want to use QGIS this is very quick using the multipart to singleparts tool.

– TeddyTedTed
Jan 8 at 16:23





If you want to use QGIS this is very quick using the multipart to singleparts tool.

– TeddyTedTed
Jan 8 at 16:23













Thanks! My source file is actually about 9GB(!) so I'd prefer to use something command line.

– Richard
Jan 8 at 16:27





Thanks! My source file is actually about 9GB(!) so I'd prefer to use something command line.

– Richard
Jan 8 at 16:27













Ah I see, I haven't done it before so I have no idea if it would work for you but you might want to have a look at this question and see if it helps at all.

– TeddyTedTed
Jan 8 at 16:36





Ah I see, I haven't done it before so I have no idea if it would work for you but you might want to have a look at this question and see if it helps at all.

– TeddyTedTed
Jan 8 at 16:36




1




1





Thanks. I ended up using PostGIS and doing CREATE TABLE polygon_table AS SELECT id (ST_Dump(geom)).geom::geometry(Polygon,27700) AS geom FROM multipolygon_table.

– Richard
Jan 8 at 21:20





Thanks. I ended up using PostGIS and doing CREATE TABLE polygon_table AS SELECT id (ST_Dump(geom)).geom::geometry(Polygon,27700) AS geom FROM multipolygon_table.

– Richard
Jan 8 at 21:20













@Richard would you post your findings as an answer and accept it?

– Logan Byers
Jan 16 at 0:43





@Richard would you post your findings as an answer and accept it?

– Logan Byers
Jan 16 at 0:43










1 Answer
1






active

oldest

votes


















0














As OP figured out, the ST_Dump function from PostGIS is one way to explode multipart geometries to single ones:




When the input geometry is a collection or multi it will return a record for each of the collection components, ... .



ST_Dump is useful for expanding geometries. ... . For example it can be use to expand MULTIPOLYGONS into POLYGONS.




SELECT sometable.field1, 
(ST_Dump(sometable.the_geom)).geom AS the_geom
FROM sometable;




The following is a related post with Python alternatives: Converting huge multipolygon to polygons





share























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "79"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f307959%2fturning-a-single-multipolygon-into-many-small-polygons%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As OP figured out, the ST_Dump function from PostGIS is one way to explode multipart geometries to single ones:




    When the input geometry is a collection or multi it will return a record for each of the collection components, ... .



    ST_Dump is useful for expanding geometries. ... . For example it can be use to expand MULTIPOLYGONS into POLYGONS.




    SELECT sometable.field1, 
    (ST_Dump(sometable.the_geom)).geom AS the_geom
    FROM sometable;




    The following is a related post with Python alternatives: Converting huge multipolygon to polygons





    share




























      0














      As OP figured out, the ST_Dump function from PostGIS is one way to explode multipart geometries to single ones:




      When the input geometry is a collection or multi it will return a record for each of the collection components, ... .



      ST_Dump is useful for expanding geometries. ... . For example it can be use to expand MULTIPOLYGONS into POLYGONS.




      SELECT sometable.field1, 
      (ST_Dump(sometable.the_geom)).geom AS the_geom
      FROM sometable;




      The following is a related post with Python alternatives: Converting huge multipolygon to polygons





      share


























        0












        0








        0







        As OP figured out, the ST_Dump function from PostGIS is one way to explode multipart geometries to single ones:




        When the input geometry is a collection or multi it will return a record for each of the collection components, ... .



        ST_Dump is useful for expanding geometries. ... . For example it can be use to expand MULTIPOLYGONS into POLYGONS.




        SELECT sometable.field1, 
        (ST_Dump(sometable.the_geom)).geom AS the_geom
        FROM sometable;




        The following is a related post with Python alternatives: Converting huge multipolygon to polygons





        share













        As OP figured out, the ST_Dump function from PostGIS is one way to explode multipart geometries to single ones:




        When the input geometry is a collection or multi it will return a record for each of the collection components, ... .



        ST_Dump is useful for expanding geometries. ... . For example it can be use to expand MULTIPOLYGONS into POLYGONS.




        SELECT sometable.field1, 
        (ST_Dump(sometable.the_geom)).geom AS the_geom
        FROM sometable;




        The following is a related post with Python alternatives: Converting huge multipolygon to polygons






        share











        share


        share










        answered 2 mins ago









        Andre SilvaAndre Silva

        7,525113682




        7,525113682






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f307959%2fturning-a-single-multipolygon-into-many-small-polygons%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Щит и меч (фильм) Содержание Названия серий | Сюжет |...

            is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

            Meter-Bus Содержание Параметры шины | Стандартизация |...