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

Oscar Zamudio cmntlk at gmail.com
Tue May 4 17:38:25 PDT 2010


Well, it works like a charm!
But I still need some advise. The query generates a polygon and I use astext
to get readable output. Now I create a new table that will contain a name
and the geometry result of the query. I want to use something like:

INSERT INTO boundaries ( the_geom, the_name ) VALUES (SELECT
ST_ConvexHull(ST_Collect(the_geom)) as the_geom from my_street_table),
'mytablename');
This can't work but I don't know how to do it better.

By now I first returned the polygon as text and then did the following:
INSERT INTO boundaries ( the_geom, the_name ) VALUES
(ST_GeomFromText('POLYGON((-58.8714168974345
-34.5696042275729,-58.9620017725354 .......))'), 'mytablename');
With this and pgsql2shp I generated a shapefile for the boundary. I could
draw the streets (original shapefile) and the boundary both together and
they match perfect!

Please excuse me if I am making a silly question but I'm a newbie.
Thanks in advance


On Mon, May 3, 2010 at 2:47 PM, Oscar Zamudio <cmntlk at gmail.com> wrote:

> I must to recognize that today I did not research further about that, I
> just remember something about convex hull from my scientific research
> background. Anyway in my case if the convex hull of the streets table
> doesn't work in the straight manner, I still can make a new table containing
>  first and last point of every line. A convex hull over them should do the
> work.
>
>
> On Mon, May 3, 2010 at 1:14 PM, Martin Davis <mbdavis at refractions.net>wrote:
>
>> I believe that the convex hull of a set of lines is the same as the convex
>> hull of the vertices of the lines.  So it should do what you want.
>>
>> But if you have a reference showing otherwise I'd be interested to see it.
>>
>> Oscar Zamudio wrote:
>>
>>> ha, ha!!,
>>> My knowledge come from Maths ,and certainly not from Postgis!. The
>>> concept
>>> of Convex Hull (in algorithms and math fields) is always applied to set
>>> of
>>> points and I remember there was a big challenge to find a good method for
>>> lines (some years ago). But I don't mind Math anymore, if this function
>>> works to solve my problem, it will be ok for me.
>>> I will let you know later about my results.
>>>
>>> On Mon, May 3, 2010 at 11:29 AM, strk <strk at keybit.net> wrote:
>>>
>>>
>>>
>>>> On Mon, May 03, 2010 at 11:18:03AM -0300, Oscar Zamudio wrote:
>>>>
>>>>
>>>>> Thanks strk,
>>>>> As far as I know convex hull basically applies to a collection of
>>>>>
>>>>>
>>>> points...,
>>>>
>>>>
>>>>> nevertheless, I will try with my set of lines.
>>>>>
>>>>>
>>>> How far does your knowledge come from ? :)
>>>> http://postgis.refractions.net/docs/ST_ConvexHull.html
>>>>
>>>> --strk;
>>>>
>>>>  ()   Free GIS & Flash consultant/developer
>>>>  /\   http://strk.keybit.net/services.html
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users at postgis.refractions.net
>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>>
>>>>
>>>>
>>>
>>>  ------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>
>> --
>> Martin Davis
>> Senior Technical Architect
>> Refractions Research, Inc.
>> (250) 383-3022
>>
>>
>> _______________________________________________
>> 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/20100504/e6ccf509/attachment.html>


More information about the postgis-users mailing list