[postgis-users] Corner coordinates from Geometry

Paul Ramsey pramsey at opengeo.org
Tue Nov 24 09:47:44 PST 2009


select st_x(st_centroid(geom)) as x, st_y(st_centroid(geom)) as y from mytable;

On Tue, Nov 24, 2009 at 9:46 AM, Robert Hicks <robhyx at gmail.com> wrote:
> Great thanks! I think either ST_PointOnSurface() or ST_Centroid()
> should be fine, but now I need convert the geometry string into
> latitude and longitude (Sorry, I should have been more clear before
> what I was ultimately looking for).
>
> On Tue, Nov 24, 2009 at 12:40 PM, Paul Ramsey <pramsey at cleverelephant.ca> wrote:
>> Ah, POINT(avg(X), avg(Y))...
>>
>> On Tue, Nov 24, 2009 at 9:38 AM, Kevin Neufeld <kneufeld at refractions.net> wrote:
>>> Maxime van Noppen wrote:
>>>>
>>>> Paul Ramsey wrote:
>>>>>
>>>>> Use ST_Centroid() then. It's just the mid-point of the bbox, so it's
>>>>> fast to calculate.
>>>>
>>>> It might be outside the polygon though.
>>>>
>>>
>>> In which case, if it matters, use ST_PointOnSurface().
>>>
>>> Paul, just a clarification, I believe centroid calculates the geometric
>>> centre of a geoemtry or "centre of mass" and not the mid-point of the bbox.
>>>  Here are a few pictorial examples:
>>> http://postgis.org/documentation/manual-1.5SVN/ST_Centroid.html
>>>
>>> -- Kevin
>>> _______________________________________________
>>> 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
>>
>
>
>
> --
> web http://www.hyxspace.com
> aim hyx1138
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list