# [postgis-users] Need a "polygon box" of a table instead of the bounding box that returns extent function

Oscar Zamudio cmntlk at gmail.com
Wed May 5 13:28:02 PDT 2010

```Now that I get this polygon I found that it encloses all the streets in my
table and follows some more or less smooth path around them, much better
than a bounding box. But....to be honest, it is not the best suitable for my
purposes. I want a footprint of the whole bunch of streets. I mean: suppose
for a minute I have a table with only two equal length streets that crosses
each other at 90 degrees at the middle of them. With the proposed mechanism
I will get a square.
What I want to return from this cross is a closed cross shaped polygon that
sorrounds more or less smoothly the actual cross. Maybe I need to use some
buffer extent over the lines (to be defined) that helps to get the final
shape. This polygon is what I want to use as an area shape to query about
its overlaps with a point.
The need of such process is because I have many streets table for cities
that are closer to each other. Using bounding boxes concept they overlaps in
some regions for neighbour cities. This makes more complex the process of
finding to which city belongs a point that falls in the overlapping region.
Maybe a recursive process with dividing squares can be a good method. An
initial box that includes all the strets (extent) is divided in to four
squares. From these ones, the squares that contains streets (true) are left,
the other (false) are discarded. Every true square again is divided in 4
subsquares and so on ..up to a minimum size of square (maybe 100 m x 100
m).
I don't know if anyone has implemented or tried something like this or even
if there's already a solution to this problem.
Can anybody help me?

On Wed, May 5, 2010 at 11:23 AM, Nicolas Ribot <nicolas.ribot at gmail.com>wrote:

> > Nicolas,
> > What I want to do is an insert of the type INSERT INTO...VALUES .. as
> > follows:
> >
> > INSERT INTO boundaries ( the_geom, the_name ) VALUES
> >  (some_geometry_data,'some_arbitrary_name')
> >
> > My problem is that I want to replace the some_geometry_data value by the
> > result of the SELECT query. And of course I am not an expert user of SQL
> > statements so I don't know how to do that..
> > from my_street_table;
> > Maybe your example can work, I will try it later and let you know.
> >
> > INSERT INTO boundaries ( the_geom, the_name ) SELECT
> > ST_ConvexHull(ST_Collect(the_geom)) as the_geom, 'mytablename' from
> > my_street_table;
> >
>
> So yes, the example, (or, better, the link to the INSERT command
> (When inserting with a SELECT, the VALUES keyword is not used).
>
> Nicolas
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100505/034937e3/attachment.html>
```