I have a table with two polygons representing urban block with and without the sidewalk:
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
Here an illustration of typical urban blocks shapes and sidewalk variations.
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 (
g2 - g1", that is
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 "width of the beach of a little island" problem,
- the calculation of "the average width of a street" problem, and
- this (here) "average width of a sidewalk represented with the block" problem.
The solution can use the "hypothesis of retangular blocks with sides
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;