[postgis-users] order of points in ST_ConvexHull

Martin Davis mbdavis at refractions.net
Thu Feb 26 13:11:52 PST 2009


Or perhaps more simply, you can test the points using the following 
criteria:

Max(x + y) => upper right
Min(x + y) => Lower Left
Max(abs(x - y)) => Lower Right
Min(abs(x - y)) => Lower Left

Sufficool, Stanley wrote:
> Pull the centroid of the geometry and use generate_series() / pointn()
> to "explode" the points and test each point for above & right of
> centroid, above and left of centroid, etc...
>
>   
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net 
>> [mailto:postgis-users-bounces at postgis.refractions.net] On 
>> Behalf Of Armin Burger
>> Sent: Thursday, February 26, 2009 11:57 AM
>> To: PostGIS Users Discussion
>> Subject: [postgis-users] order of points in ST_ConvexHull
>>
>>
>> Hello
>>
>> I need to find a possibility to identify upper-left, 
>> upper-right, etc. 
>> corners of +/- rectangular polygons. I.e. polygons with 
>> guranteed just 4 
>> corners, but with a shape that is typically between a rectangle and a 
>> rhomb. The polygons define the geometry of image boundaries ("image 
>> footprints"). But it cannot be guaranteed which point in the polygon 
>> corresponds to which corner since the order of points during geometry 
>> creation is unknown.
>>
>> One idea was to use ST_ConvexHull(geometry) since for this 
>> very simple 
>> polygons the convex hull seems to be identical with the geometry. It 
>> looked to me that the order in this convex hull was:
>>    lower-right, lower-left, upper-left, upper-right
>> Does anybody know if this order is always like that or can this order 
>> change? Would anybody know another method to identify which 
>> point of the 
>> polygon corresponds to which corner?
>>
>> Regards
>>
>> Armin
>> _______________________________________________
>> 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




More information about the postgis-users mailing list