Classic ARC/INFO Commands in PostGIS: Mean Center
- artlembo
- 7 minutes ago
- 1 min read
We'll continue our look into ESRI commands in PostGIS by examining another simple task: calculating the Mean Center of a data set.
To illustrate these concepts, I will be showing examples from my book Statistical Problem Solving in Geography. In my textbook, I have an example of 7 data points:

So, we can recreate the same results with the following SQL:
this query gets the average X and Y coordinate values for a point layer by first converting the geometry into X and Y values, and then calculating the average of those values. But, we not returning a point feature :it is simply the average values for the coordinates. So, the next query shows how to modify what we've already written to create a point feature:
in this case, the ST_MakePoint turns the X,Y values into an actual geometry. Of course, the geometries no longer have a coordinate system assigned to them, so this is where you can reapply the ST_SetSRID function I showed you in the previous post to the result.