Identifying “long and narrow” polygons in with PostGIS












6















I have a set of polygons representing large areas, say city neighborhoods. I want to identify the large overlapping areas between them.



But there's a problem: sometimes these polygons will overlap along their perimeters (because they were drawn with little precision). This will generate long and narrow overlaps that I do not care about.



But other times there will be big overlaps of robust polygons, meaning large areas where a neighborhood's polygon overlaps another. I want to select only these.



See the picture below of just the overlaps. Imagine I wanted to select only the blue polygon in the lower left corner.



overlap



I could look at areas, but sometimes the narrow ones are so long they end up having areas as large as the blue polygon. I've tried to do a ratio of area / perimeter, but that has also yielded mixed results.



I've even tried using ST_MinimumClearance, but sometimes the large areas will have a narrow part attached to it, or two very close vertices.



Any ideas of other approaches?





In the end what worked best for me was using a negative buffer, as suggested by @Cyril and @FGreg below.



I used something like:



ST_Area(ST_Buffer(geom, -10)) as neg_buffer_area


In my case, units were meters, so 10 m negative buffer.



For narrow polygons, this area returned zero (also, the geometry would be empty). Then I used this column to filter out the narrow polygons.










share|improve this question




















  • 4





    Certainly the area/perimeter ratio could be used for this.

    – Vince
    Mar 20 at 15:17











  • It's hard to tell where the distinct polygons are from the image, but doing something like this gis.stackexchange.com/a/265233/64838 might work? Calculate minimum rotated bounding box then discard ones with small width or height.

    – FGreg
    Mar 20 at 22:31











  • You could also try using a negative buffer as described here: How can I identify really thin polygons in my shape file?

    – FGreg
    Mar 20 at 22:46
















6















I have a set of polygons representing large areas, say city neighborhoods. I want to identify the large overlapping areas between them.



But there's a problem: sometimes these polygons will overlap along their perimeters (because they were drawn with little precision). This will generate long and narrow overlaps that I do not care about.



But other times there will be big overlaps of robust polygons, meaning large areas where a neighborhood's polygon overlaps another. I want to select only these.



See the picture below of just the overlaps. Imagine I wanted to select only the blue polygon in the lower left corner.



overlap



I could look at areas, but sometimes the narrow ones are so long they end up having areas as large as the blue polygon. I've tried to do a ratio of area / perimeter, but that has also yielded mixed results.



I've even tried using ST_MinimumClearance, but sometimes the large areas will have a narrow part attached to it, or two very close vertices.



Any ideas of other approaches?





In the end what worked best for me was using a negative buffer, as suggested by @Cyril and @FGreg below.



I used something like:



ST_Area(ST_Buffer(geom, -10)) as neg_buffer_area


In my case, units were meters, so 10 m negative buffer.



For narrow polygons, this area returned zero (also, the geometry would be empty). Then I used this column to filter out the narrow polygons.










share|improve this question




















  • 4





    Certainly the area/perimeter ratio could be used for this.

    – Vince
    Mar 20 at 15:17











  • It's hard to tell where the distinct polygons are from the image, but doing something like this gis.stackexchange.com/a/265233/64838 might work? Calculate minimum rotated bounding box then discard ones with small width or height.

    – FGreg
    Mar 20 at 22:31











  • You could also try using a negative buffer as described here: How can I identify really thin polygons in my shape file?

    – FGreg
    Mar 20 at 22:46














6












6








6


0






I have a set of polygons representing large areas, say city neighborhoods. I want to identify the large overlapping areas between them.



But there's a problem: sometimes these polygons will overlap along their perimeters (because they were drawn with little precision). This will generate long and narrow overlaps that I do not care about.



But other times there will be big overlaps of robust polygons, meaning large areas where a neighborhood's polygon overlaps another. I want to select only these.



See the picture below of just the overlaps. Imagine I wanted to select only the blue polygon in the lower left corner.



overlap



I could look at areas, but sometimes the narrow ones are so long they end up having areas as large as the blue polygon. I've tried to do a ratio of area / perimeter, but that has also yielded mixed results.



I've even tried using ST_MinimumClearance, but sometimes the large areas will have a narrow part attached to it, or two very close vertices.



Any ideas of other approaches?





In the end what worked best for me was using a negative buffer, as suggested by @Cyril and @FGreg below.



I used something like:



ST_Area(ST_Buffer(geom, -10)) as neg_buffer_area


In my case, units were meters, so 10 m negative buffer.



For narrow polygons, this area returned zero (also, the geometry would be empty). Then I used this column to filter out the narrow polygons.










share|improve this question
















I have a set of polygons representing large areas, say city neighborhoods. I want to identify the large overlapping areas between them.



But there's a problem: sometimes these polygons will overlap along their perimeters (because they were drawn with little precision). This will generate long and narrow overlaps that I do not care about.



But other times there will be big overlaps of robust polygons, meaning large areas where a neighborhood's polygon overlaps another. I want to select only these.



See the picture below of just the overlaps. Imagine I wanted to select only the blue polygon in the lower left corner.



overlap



I could look at areas, but sometimes the narrow ones are so long they end up having areas as large as the blue polygon. I've tried to do a ratio of area / perimeter, but that has also yielded mixed results.



I've even tried using ST_MinimumClearance, but sometimes the large areas will have a narrow part attached to it, or two very close vertices.



Any ideas of other approaches?





In the end what worked best for me was using a negative buffer, as suggested by @Cyril and @FGreg below.



I used something like:



ST_Area(ST_Buffer(geom, -10)) as neg_buffer_area


In my case, units were meters, so 10 m negative buffer.



For narrow polygons, this area returned zero (also, the geometry would be empty). Then I used this column to filter out the narrow polygons.







qgis postgis slivers






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









PolyGeo

53.7k1781244




53.7k1781244










asked Mar 20 at 14:42









bplmpbplmp

885




885








  • 4





    Certainly the area/perimeter ratio could be used for this.

    – Vince
    Mar 20 at 15:17











  • It's hard to tell where the distinct polygons are from the image, but doing something like this gis.stackexchange.com/a/265233/64838 might work? Calculate minimum rotated bounding box then discard ones with small width or height.

    – FGreg
    Mar 20 at 22:31











  • You could also try using a negative buffer as described here: How can I identify really thin polygons in my shape file?

    – FGreg
    Mar 20 at 22:46














  • 4





    Certainly the area/perimeter ratio could be used for this.

    – Vince
    Mar 20 at 15:17











  • It's hard to tell where the distinct polygons are from the image, but doing something like this gis.stackexchange.com/a/265233/64838 might work? Calculate minimum rotated bounding box then discard ones with small width or height.

    – FGreg
    Mar 20 at 22:31











  • You could also try using a negative buffer as described here: How can I identify really thin polygons in my shape file?

    – FGreg
    Mar 20 at 22:46








4




4





Certainly the area/perimeter ratio could be used for this.

– Vince
Mar 20 at 15:17





Certainly the area/perimeter ratio could be used for this.

– Vince
Mar 20 at 15:17













It's hard to tell where the distinct polygons are from the image, but doing something like this gis.stackexchange.com/a/265233/64838 might work? Calculate minimum rotated bounding box then discard ones with small width or height.

– FGreg
Mar 20 at 22:31





It's hard to tell where the distinct polygons are from the image, but doing something like this gis.stackexchange.com/a/265233/64838 might work? Calculate minimum rotated bounding box then discard ones with small width or height.

– FGreg
Mar 20 at 22:31













You could also try using a negative buffer as described here: How can I identify really thin polygons in my shape file?

– FGreg
Mar 20 at 22:46





You could also try using a negative buffer as described here: How can I identify really thin polygons in my shape file?

– FGreg
Mar 20 at 22:46










4 Answers
4






active

oldest

votes


















2














I would try to create a negative buffer, if it eats thin polygons, then it’s good, if it doesn’t eat the polygon, then it’s mine ... :-)



run this script, having previously set 2/3 of the width of the linear polygons ...



create table name_table as
SELECT ST_Buffer(
(ST_Dump(
(ST_Union(
ST_Buffer(
(geom),-0.0001))))).geom,
0.0001)) as geom from source_table

OS :-)...






share|improve this answer
























  • in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

    – bplmp
    2 days ago











  • Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

    – Cyril
    2 days ago



















8














Instead of area/perimeter, it is better to use the area divided by the square of the perimeter (or its inverse).



This is also called "shape index". The square of the perimeter divided by the area has a minimum value of 4*Pi() (in the case of a disk, which is the most compact 2D geometry), so it can be normalized by 4*Pi() for an easy interpretation (normalized values close to 1 then mean that you have very compact objects and squares have a values of approximately 1.27).



EDIT: A threshold on the area would be usefull to remove the very small artefacts, which could be compact. Then the shape index would show better contrast.
EDIT: in addition to this answer, the use of ST_Snap could help you solve the problem before it occurs.






share|improve this answer


























  • Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

    – bplmp
    Mar 20 at 15:55











  • Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

    – bplmp
    Mar 20 at 16:09






  • 2





    Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

    – John Powell
    Mar 20 at 16:50











  • @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

    – radouxju
    2 days ago











  • @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

    – radouxju
    2 days ago



















5














One option would be to use the ratio of the area of the polygon to the longest line that can be drawn using its extremities. Identifying long narrow polygons.



select * from polygons where ST_Length(ST_LongestLine(geom, geom)) < ST_Area(geom) * 4



This works pretty well for sliver polygons. You can adjust what the ratio (what you multiply the area with) to suit your needs and projection.






share|improve this answer































    1














    It sounds like this might match your use case: Eliminate selected polygons




    Combines selected polygons of the input layer with certain adjacent polygons by erasing their common boundary. The adjacent polygon can be either the one with the largest or smallest area or the one sharing the largest common boundary with the polygon to be eliminated.



    Eliminate is normally used to get rid of sliver polygons, i.e. tiny polygons that are a result of polygon intersection processes where boundaries of the inputs are similar but not identical.




    It sounds like you'd want to try the "Largest Common Boundary" option.






    share|improve this answer








    New contributor




    FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















    • I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

      – FGreg
      Mar 20 at 22:49











    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%2f316128%2fidentifying-long-and-narrow-polygons-in-with-postgis%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    I would try to create a negative buffer, if it eats thin polygons, then it’s good, if it doesn’t eat the polygon, then it’s mine ... :-)



    run this script, having previously set 2/3 of the width of the linear polygons ...



    create table name_table as
    SELECT ST_Buffer(
    (ST_Dump(
    (ST_Union(
    ST_Buffer(
    (geom),-0.0001))))).geom,
    0.0001)) as geom from source_table

    OS :-)...






    share|improve this answer
























    • in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

      – bplmp
      2 days ago











    • Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

      – Cyril
      2 days ago
















    2














    I would try to create a negative buffer, if it eats thin polygons, then it’s good, if it doesn’t eat the polygon, then it’s mine ... :-)



    run this script, having previously set 2/3 of the width of the linear polygons ...



    create table name_table as
    SELECT ST_Buffer(
    (ST_Dump(
    (ST_Union(
    ST_Buffer(
    (geom),-0.0001))))).geom,
    0.0001)) as geom from source_table

    OS :-)...






    share|improve this answer
























    • in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

      – bplmp
      2 days ago











    • Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

      – Cyril
      2 days ago














    2












    2








    2







    I would try to create a negative buffer, if it eats thin polygons, then it’s good, if it doesn’t eat the polygon, then it’s mine ... :-)



    run this script, having previously set 2/3 of the width of the linear polygons ...



    create table name_table as
    SELECT ST_Buffer(
    (ST_Dump(
    (ST_Union(
    ST_Buffer(
    (geom),-0.0001))))).geom,
    0.0001)) as geom from source_table

    OS :-)...






    share|improve this answer













    I would try to create a negative buffer, if it eats thin polygons, then it’s good, if it doesn’t eat the polygon, then it’s mine ... :-)



    run this script, having previously set 2/3 of the width of the linear polygons ...



    create table name_table as
    SELECT ST_Buffer(
    (ST_Dump(
    (ST_Union(
    ST_Buffer(
    (geom),-0.0001))))).geom,
    0.0001)) as geom from source_table

    OS :-)...







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 2 days ago









    CyrilCyril

    1,0051214




    1,0051214













    • in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

      – bplmp
      2 days ago











    • Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

      – Cyril
      2 days ago



















    • in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

      – bplmp
      2 days ago











    • Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

      – Cyril
      2 days ago

















    in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

    – bplmp
    2 days ago





    in the end your suggestion is what worked best for me. I ended using something like ST_Area(ST_Buffer(geom, -10)), the -10 being -10 meters in my case. If anything returned 0 from that expression then I could filter it out.

    – bplmp
    2 days ago













    Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

    – Cyril
    2 days ago





    Thank you, I am glad that it helped you, use this approach in such cases, with respect ...

    – Cyril
    2 days ago













    8














    Instead of area/perimeter, it is better to use the area divided by the square of the perimeter (or its inverse).



    This is also called "shape index". The square of the perimeter divided by the area has a minimum value of 4*Pi() (in the case of a disk, which is the most compact 2D geometry), so it can be normalized by 4*Pi() for an easy interpretation (normalized values close to 1 then mean that you have very compact objects and squares have a values of approximately 1.27).



    EDIT: A threshold on the area would be usefull to remove the very small artefacts, which could be compact. Then the shape index would show better contrast.
    EDIT: in addition to this answer, the use of ST_Snap could help you solve the problem before it occurs.






    share|improve this answer


























    • Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

      – bplmp
      Mar 20 at 15:55











    • Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

      – bplmp
      Mar 20 at 16:09






    • 2





      Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

      – John Powell
      Mar 20 at 16:50











    • @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

      – radouxju
      2 days ago











    • @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

      – radouxju
      2 days ago
















    8














    Instead of area/perimeter, it is better to use the area divided by the square of the perimeter (or its inverse).



    This is also called "shape index". The square of the perimeter divided by the area has a minimum value of 4*Pi() (in the case of a disk, which is the most compact 2D geometry), so it can be normalized by 4*Pi() for an easy interpretation (normalized values close to 1 then mean that you have very compact objects and squares have a values of approximately 1.27).



    EDIT: A threshold on the area would be usefull to remove the very small artefacts, which could be compact. Then the shape index would show better contrast.
    EDIT: in addition to this answer, the use of ST_Snap could help you solve the problem before it occurs.






    share|improve this answer


























    • Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

      – bplmp
      Mar 20 at 15:55











    • Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

      – bplmp
      Mar 20 at 16:09






    • 2





      Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

      – John Powell
      Mar 20 at 16:50











    • @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

      – radouxju
      2 days ago











    • @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

      – radouxju
      2 days ago














    8












    8








    8







    Instead of area/perimeter, it is better to use the area divided by the square of the perimeter (or its inverse).



    This is also called "shape index". The square of the perimeter divided by the area has a minimum value of 4*Pi() (in the case of a disk, which is the most compact 2D geometry), so it can be normalized by 4*Pi() for an easy interpretation (normalized values close to 1 then mean that you have very compact objects and squares have a values of approximately 1.27).



    EDIT: A threshold on the area would be usefull to remove the very small artefacts, which could be compact. Then the shape index would show better contrast.
    EDIT: in addition to this answer, the use of ST_Snap could help you solve the problem before it occurs.






    share|improve this answer















    Instead of area/perimeter, it is better to use the area divided by the square of the perimeter (or its inverse).



    This is also called "shape index". The square of the perimeter divided by the area has a minimum value of 4*Pi() (in the case of a disk, which is the most compact 2D geometry), so it can be normalized by 4*Pi() for an easy interpretation (normalized values close to 1 then mean that you have very compact objects and squares have a values of approximately 1.27).



    EDIT: A threshold on the area would be usefull to remove the very small artefacts, which could be compact. Then the shape index would show better contrast.
    EDIT: in addition to this answer, the use of ST_Snap could help you solve the problem before it occurs.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 2 days ago

























    answered Mar 20 at 15:36









    radouxjuradouxju

    41.2k144120




    41.2k144120













    • Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

      – bplmp
      Mar 20 at 15:55











    • Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

      – bplmp
      Mar 20 at 16:09






    • 2





      Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

      – John Powell
      Mar 20 at 16:50











    • @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

      – radouxju
      2 days ago











    • @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

      – radouxju
      2 days ago



















    • Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

      – bplmp
      Mar 20 at 15:55











    • Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

      – bplmp
      Mar 20 at 16:09






    • 2





      Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

      – John Powell
      Mar 20 at 16:50











    • @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

      – radouxju
      2 days ago











    • @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

      – radouxju
      2 days ago

















    Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

    – bplmp
    Mar 20 at 15:55





    Thanks! But I'm unsure how ST_Snap could help in this case... If I got it right, you're suggesting something like (o.overlap_perimeter^2 / o.overlap_area) / (4 * Pi()) as overlap_ratio? This is having worse results for me than just area / perimeter.

    – bplmp
    Mar 20 at 15:55













    Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

    – bplmp
    Mar 20 at 16:09





    Now using o.overlap_perimeter / (4 * sqrt(o.overlap_area)) as overlap_ratio according to this paper, but still worse results (although that's hard to quantify what I mean by worse) isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/I-7/135/…, page 183.

    – bplmp
    Mar 20 at 16:09




    2




    2





    Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

    – John Powell
    Mar 20 at 16:50





    Thank you for this, I had never heard of the "shape index". I had always thought that using a minimum bounding rectangle was the best way to answer this sort of question. I found this, repository.asu.edu/attachments/111230/content/…, which is interesting.

    – John Powell
    Mar 20 at 16:50













    @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

    – radouxju
    2 days ago





    @JohnPowell intersting paper, thanks. I see that what I know as a shape index is called circularity index in the paper. My problem with minimum bounding rectangles is that it doesn't work with very concave objects (e.g. U-shaped)

    – radouxju
    2 days ago













    @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

    – radouxju
    2 days ago





    @bplmp ST_Snap would help you snap the vertices of "nearly" adjacent polygons so that they do no overlap anymore. There is no scale on your figures, but your artefact look like lines, so I guess that you can use a tolerance value theat is enough to avoid artefacts but does not affect the large polygons.

    – radouxju
    2 days ago











    5














    One option would be to use the ratio of the area of the polygon to the longest line that can be drawn using its extremities. Identifying long narrow polygons.



    select * from polygons where ST_Length(ST_LongestLine(geom, geom)) < ST_Area(geom) * 4



    This works pretty well for sliver polygons. You can adjust what the ratio (what you multiply the area with) to suit your needs and projection.






    share|improve this answer




























      5














      One option would be to use the ratio of the area of the polygon to the longest line that can be drawn using its extremities. Identifying long narrow polygons.



      select * from polygons where ST_Length(ST_LongestLine(geom, geom)) < ST_Area(geom) * 4



      This works pretty well for sliver polygons. You can adjust what the ratio (what you multiply the area with) to suit your needs and projection.






      share|improve this answer


























        5












        5








        5







        One option would be to use the ratio of the area of the polygon to the longest line that can be drawn using its extremities. Identifying long narrow polygons.



        select * from polygons where ST_Length(ST_LongestLine(geom, geom)) < ST_Area(geom) * 4



        This works pretty well for sliver polygons. You can adjust what the ratio (what you multiply the area with) to suit your needs and projection.






        share|improve this answer













        One option would be to use the ratio of the area of the polygon to the longest line that can be drawn using its extremities. Identifying long narrow polygons.



        select * from polygons where ST_Length(ST_LongestLine(geom, geom)) < ST_Area(geom) * 4



        This works pretty well for sliver polygons. You can adjust what the ratio (what you multiply the area with) to suit your needs and projection.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 20 at 15:54









        HeikkiVesantoHeikkiVesanto

        9,0152145




        9,0152145























            1














            It sounds like this might match your use case: Eliminate selected polygons




            Combines selected polygons of the input layer with certain adjacent polygons by erasing their common boundary. The adjacent polygon can be either the one with the largest or smallest area or the one sharing the largest common boundary with the polygon to be eliminated.



            Eliminate is normally used to get rid of sliver polygons, i.e. tiny polygons that are a result of polygon intersection processes where boundaries of the inputs are similar but not identical.




            It sounds like you'd want to try the "Largest Common Boundary" option.






            share|improve this answer








            New contributor




            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





















            • I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

              – FGreg
              Mar 20 at 22:49
















            1














            It sounds like this might match your use case: Eliminate selected polygons




            Combines selected polygons of the input layer with certain adjacent polygons by erasing their common boundary. The adjacent polygon can be either the one with the largest or smallest area or the one sharing the largest common boundary with the polygon to be eliminated.



            Eliminate is normally used to get rid of sliver polygons, i.e. tiny polygons that are a result of polygon intersection processes where boundaries of the inputs are similar but not identical.




            It sounds like you'd want to try the "Largest Common Boundary" option.






            share|improve this answer








            New contributor




            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





















            • I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

              – FGreg
              Mar 20 at 22:49














            1












            1








            1







            It sounds like this might match your use case: Eliminate selected polygons




            Combines selected polygons of the input layer with certain adjacent polygons by erasing their common boundary. The adjacent polygon can be either the one with the largest or smallest area or the one sharing the largest common boundary with the polygon to be eliminated.



            Eliminate is normally used to get rid of sliver polygons, i.e. tiny polygons that are a result of polygon intersection processes where boundaries of the inputs are similar but not identical.




            It sounds like you'd want to try the "Largest Common Boundary" option.






            share|improve this answer








            New contributor




            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.










            It sounds like this might match your use case: Eliminate selected polygons




            Combines selected polygons of the input layer with certain adjacent polygons by erasing their common boundary. The adjacent polygon can be either the one with the largest or smallest area or the one sharing the largest common boundary with the polygon to be eliminated.



            Eliminate is normally used to get rid of sliver polygons, i.e. tiny polygons that are a result of polygon intersection processes where boundaries of the inputs are similar but not identical.




            It sounds like you'd want to try the "Largest Common Boundary" option.







            share|improve this answer








            New contributor




            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            share|improve this answer



            share|improve this answer






            New contributor




            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            answered Mar 20 at 22:29









            FGregFGreg

            1135




            1135




            New contributor




            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            New contributor





            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            FGreg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.













            • I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

              – FGreg
              Mar 20 at 22:49



















            • I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

              – FGreg
              Mar 20 at 22:49

















            I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

            – FGreg
            Mar 20 at 22:49





            I realize now you were asking for postgis solutions not qgis solutions. My apologies, I don't think postgis has an equivalent function but I'll leave this up for posterity.

            – FGreg
            Mar 20 at 22:49


















            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%2f316128%2fidentifying-long-and-narrow-polygons-in-with-postgis%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

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...