# How to estimate the average width of a sidewalk? [duplicate]

I have a table with two polygons representing urban block with and without the sidewalk: `geomBlock` and `geomBlockWithSidewalk`.

On my city we can approximate the polygons of `geomBlockWithSidewalk` to a `geomBlock` buffer of 2 meters. The standard OGC function that generates this buffer is

``````geomBlockWithSidewalk_false = ST_Buffer(geomBlock,2.0)
``````

It is "false" because reality is very very different than this ideal scenery. My problem now is estimate the sidewalk width `w`, that is How to estimate `w` on the best approximation for `st_buffer(geomBlock,w)`?

Here an illustration of typical urban blocks shapes and sidewalk variations. .

NOTICE:

If the sidewalk representation are stored as "rectangular strips", the problem of this question is similar to "How can I calculate the average width of a polygon?", because both solutions need to solve the problem of "estimation of the average width of a rectangular strip".

Another usual representation for sidewalks, used here, is aggregating the shape of the sidewalks around a block with the block...

The rectangular strip here can be also a ring (a polygon with a hole): the sidewalk is the polygon resulted from the spatial difference between geometries of the blockWithSideWalk (`g2`) and the block (`g1`) "`g2 - g1`", that is `ST_Difference(g2,g1)`.  Imagining cut the ring: the cut make it a "rectangular strip"... But not exactly, it is more precisely a "trapezoidal strip". It is a new question. After @whuber closed this question as "duplicated", I posted the general question: "Is there a st_buffer inverse function?", where we can see that all the questions are very closely related,

The solution can use the "hypothesis of retangular blocks with sides `L` and `H` >>`w`". It is a function,

``````CREATE FUNCTION sidewalk_width(geometry, geometry) RETURNS float AS \$\$
-- calculations using geomBlockWithSidewalk and geomBlock
-- ST_Within(geomBlock,geomBlockWithSidewalk) is true.
\$\$ LANGUAGE SQL immutable;
``````
• @whuber, please re-open for I post "best answer" (that is not the same that you indicated) – Peter Krauss Sep 10 '12 at 16:59
• Peter, could you explain further? As far as I can tell, you are asking exactly the same question that is asked and answered in that other thread. How does yours differ? Unlike your claim in the edited first paragraph, the duplicate does not ask to estimate the widths of "blocks": it is specifically about streets. Those are so similar to sidewalks that it seems to make little sense to separate the two questions and ask readers to find them both when they have similar problems. – whuber Sep 10 '12 at 19:09
• There are same solutions, then is good all people at the same "forum". It is ok, I now adapted and working with my solutions there. BUT we must preserve (and can edit/simplify) this question because another users, like I, not see the direct correspondence of sidewalks and block squared polygons, and "average width of a line-buffered-polygon". Here we can/must demonstrate the path that goes from one to another problem. – Peter Krauss Sep 10 '12 at 20:15
• I see from your answer there, Peter, that you do seem to be addressing a different problem. But it's still hard to tell what problem you are solving. If you want to find the average width of the difference of two buffers, that's just the difference in the buffer radii, which is a trivial calculation. For your problem to be understandable, could you explain precisely what inputs you have and what the output is supposed to be? – whuber Sep 10 '12 at 20:21