[postgis-users] median center instead of st_centroid

Rémi Cura remi.cura at gmail.com
Thu Mar 12 15:26:40 PDT 2015


De rien lointain cousin du Québec ;-)
Rémi-C

2015-03-12 19:43 GMT+01:00 <Steve.Toutant at inspq.qc.ca>:

> Wow merci Remi. That saves me a lot of coding...
>
>
>
>
>  *Rémi Cura <remi.cura at gmail.com <remi.cura at gmail.com>>@lists.osgeo.org
> <http://lists.osgeo.org>*
> Envoyé par : postgis-users-bounces at lists.osgeo.org
>
> 2015-03-12 12:42
>  Veuillez répondre à
> PostGIS Users Discussion <postgis-users at lists.osgeo.org>
>
>   A
> PostGIS Users Discussion <postgis-users at lists.osgeo.org>
> cc
>   Objet
> Re: [postgis-users] median center instead of st_centroid
>
>
>
>
>
>
> Hey,
> what you want is extremely easy to get.
> First add the median function to your database from *here*
> <https://wiki.postgresql.org/wiki/Aggregate_Median>
> (Now you have access to median(numeric) )
>
> Then,
> for a table my_table containing points in the geom column
>
> --not tested
> SELECT ST_MakePoint(median(ST_X(geom)), median(ST_Y(geom))) as
> my_median_point
> FROM my_table
>
> Cheers,
> Rémi-C
>
> 2015-03-12 14:56 GMT+01:00 <*Steve.Toutant at inspq.qc.ca*
> <Steve.Toutant at inspq.qc.ca>>:
> Hi,
> I used st_centroid on a multipoint table to get the mean center.
> I would like to compare the result on the median center
> *http://en.wikipedia.org/wiki/Center_of_population#Mean_center*
> <http://en.wikipedia.org/wiki/Center_of_population#Mean_center>
>
> Is there already an operator in postgis that does that?
>
> Otherwise I would like to write one, but I don't have much experience
> doing that, so any tips on how to do that well would be appreciated
> Thanks in advace for your help!
>
>
> _______________________________________________
> postgis-users mailing list
> *postgis-users at lists.osgeo.org* <postgis-users at lists.osgeo.org>
> *http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users*
> <http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150312/c5115074/attachment.html>


More information about the postgis-users mailing list