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
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.
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
add a comment |
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.
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
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
add a comment |
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.
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
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.
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
qgis postgis slivers
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
add a comment |
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
add a comment |
4 Answers
4
active
oldest
votes
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 :-)...
in the end your suggestion is what worked best for me. I ended using something likeST_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
add a comment |
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.
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 usingo.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
|
show 2 more comments
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.
add a comment |
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.
New contributor
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 :-)...
in the end your suggestion is what worked best for me. I ended using something likeST_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
add a comment |
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 :-)...
in the end your suggestion is what worked best for me. I ended using something likeST_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
add a comment |
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 :-)...
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 :-)...
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 likeST_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
add a comment |
in the end your suggestion is what worked best for me. I ended using something likeST_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
add a comment |
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.
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 usingo.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
|
show 2 more comments
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.
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 usingo.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
|
show 2 more comments
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.
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.
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 usingo.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
|
show 2 more comments
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 usingo.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
|
show 2 more comments
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 20 at 15:54
HeikkiVesantoHeikkiVesanto
9,0352245
9,0352245
add a comment |
add a comment |
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.
New contributor
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
add a comment |
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.
New contributor
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
add a comment |
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.
New contributor
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.
New contributor
New contributor
answered Mar 20 at 22:29
FGregFGreg
1135
1135
New contributor
New contributor
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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