Identifying “long and narrow” polygons in with PostGISlength and width of polygonWhy postgis st_overlaps reports Qgis' “avoid intersections” generated polygon as overlapping with others?Adjusting polygons to boundary and filling holesDrawing polygons with fixed area?How to remove spikes in Polygons with PostGISDeleting sliver polygons after difference operation in QGIS?Snapping boundaries in PostGISSplit polygon into parts adding attributes based on underlying polygon in QGISSplitting overlap between polygons and assign to nearest polygon using PostGIS?Expanding polygons and clipping at midpoint?Removing Intersection of Buffers in Same Layers

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

How do I keep an essay about "feeling flat" from feeling flat?

Should my PhD thesis be submitted under my legal name?

Applicability of Single Responsibility Principle

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

The Riley Riddle Mine

HashMap containsKey() returns false although hashCode() and equals() are true

Using parameter substitution on a Bash array

Why did Kant, Hegel, and Adorno leave some words and phrases in the Greek alphabet?

How to verify if g is a generator for p?

Modify casing of marked letters

Why are on-board computers allowed to change controls without notifying the pilots?

The baby cries all morning

What to do with wrong results in talks?

What will be the benefits of Brexit?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

How can I use the arrow sign in my bash prompt?

Modulo 2 binary long division in European notation

Is it correct to write "is not focus on"?

Cynical novel that describes an America ruled by the media, arms manufacturers, and ethnic figureheads

when is out of tune ok?

Finding all intervals that match predicate in vector

There is only s̶i̶x̶t̶y one place he can be

Best way to store options for panels



Identifying “long and narrow” polygons in with PostGIS


length and width of polygonWhy postgis st_overlaps reports Qgis' “avoid intersections” generated polygon as overlapping with others?Adjusting polygons to boundary and filling holesDrawing polygons with fixed area?How to remove spikes in Polygons with PostGISDeleting sliver polygons after difference operation in QGIS?Snapping boundaries in PostGISSplit polygon into parts adding attributes based on underlying polygon in QGISSplitting overlap between polygons and assign to nearest polygon using PostGIS?Expanding polygons and clipping at midpoint?Removing Intersection of Buffers in Same Layers













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 Mar 21 at 22:14









PolyGeo

53.8k1781244




53.8k1781244










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
    Mar 21 at 14:11











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

    – Cyril
    Mar 21 at 14:12


















9














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
    Mar 21 at 7:15











  • @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
    Mar 21 at 7:20


















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
      Mar 21 at 14:11











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

      – Cyril
      Mar 21 at 14:12















    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
      Mar 21 at 14:11











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

      – Cyril
      Mar 21 at 14:12













    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 Mar 21 at 7:21









    CyrilCyril

    1,0601214




    1,0601214












    • 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
      Mar 21 at 14:11











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

      – Cyril
      Mar 21 at 14:12

















    • 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
      Mar 21 at 14:11











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

      – Cyril
      Mar 21 at 14:12
















    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
    Mar 21 at 14:11





    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
    Mar 21 at 14:11













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

    – Cyril
    Mar 21 at 14:12





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

    – Cyril
    Mar 21 at 14:12













    9














    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
      Mar 21 at 7:15











    • @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
      Mar 21 at 7:20















    9














    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
      Mar 21 at 7:15











    • @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
      Mar 21 at 7:20













    9












    9








    9







    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 Mar 21 at 10:39

























    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
      Mar 21 at 7:15











    • @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
      Mar 21 at 7:20

















    • 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
      Mar 21 at 7:15











    • @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
      Mar 21 at 7:20
















    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
    Mar 21 at 7:15





    @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
    Mar 21 at 7:15













    @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
    Mar 21 at 7:20





    @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
    Mar 21 at 7:20











    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,0352245




        9,0352245





















            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

            Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

            Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

            Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High