Skip to main content

I have points in WGS84, collected with a gps on one single point (static). I would like to determine the median of these points. Or the one point with the less deviation.

Thank you for your comment.

I don't know if a graphical function is available.

But you can extract the lat/long values using the CoordinateExtractor and then calculate the average values using the StatisticsCalculator.

If you want the closest point to this location you can create a point (using the average values) with the VertexCreator and use the NeighborFinder to find the closest original point.


Hi @inkaduiker,

You could also calculate the convexhull of all the points, dissolve it and extract the center point or center of gravity point with the CenterPointExtractor transformer to form the new point.

Hope this helps.


Thank you for your help.

I tried the method of erik_jan, because I think that one comes closest to what I need.

Before I tried to buffer all the points and disolve the buffers and determine the center point of this polygon. I think this looks like the method of itay.


Hi @inkaduiker, I would use the Aggregator to aggregate all the points and the CenterPointExtractor (just to compute the coordinates) or the CenterPointReplacer (to create the point representing center of gravity), setting "Center of Gravity Point" to the Mode parameter.


Hi @inkaduiker, I would use the Aggregator to aggregate all the points and the CenterPointExtractor (just to compute the coordinates) or the CenterPointReplacer (to create the point representing center of gravity), setting "Center of Gravity Point" to the Mode parameter.

Which do you need, the median (statistics) or the center of gravity (geometric)? If you need to get the median, the StatisticsCalculator is the way to go. You can get the median for x-coordinates and y-coordinates literally.

 


I don't think if the center of gravity is the best idea as it can potentially be affected by some outliers. My suggestion is to use a depth function (e.g. Tukey depth, simplicial depth, spherical depth,...) to compute the point with the maximal depth that is the proper generalization of 1D median.


Hi.

I am trying to calculate the geometric median of several points, as in ST_GeometricMedian() function in Postgis.

I tried with the StatisticsCalculator as @erik_jan​ suggested in the first answer. 6 years ago :)

  1. CoordinateExtractor -> _x and _y attributes created for each point feature
  2. StatisticsCalculator for those 2 attributes, with Mean selected
  3. CoordinateSystemSetter + VertexCreator to create the median point

But the result differ from when I use the Postgis Function.

Any idea why or how to get the same result ? I precise I don't use any specific parameter in the Postgis function.


Hi.

I am trying to calculate the geometric median of several points, as in ST_GeometricMedian() function in Postgis.

I tried with the StatisticsCalculator as @erik_jan​ suggested in the first answer. 6 years ago :)

  1. CoordinateExtractor -> _x and _y attributes created for each point feature
  2. StatisticsCalculator for those 2 attributes, with Mean selected
  3. CoordinateSystemSetter + VertexCreator to create the median point

But the result differ from when I use the Postgis Function.

Any idea why or how to get the same result ? I precise I don't use any specific parameter in the Postgis function.

Hi @p.jeremie​ if possible, are you able to share some sample data and a sample workspace with us to demonstrate the differences between your results? I'd be interested in seeing how much your results differ by. One thing to double-check that could affect your results is the coordinate system of the data (and making sure your calculations were done in the same coordinate system).


Hi @p.jeremie​ if possible, are you able to share some sample data and a sample workspace with us to demonstrate the differences between your results? I'd be interested in seeing how much your results differ by. One thing to double-check that could affect your results is the coordinate system of the data (and making sure your calculations were done in the same coordinate system).

Hi @danminneyatsaf​,

here is a test workspace where I compare the method with StatisticsCalculator and the ST_GeometricMedian() function from postgis.

All geom are in EPSG:2154 which is metric.


Hi @p.jeremie​ if possible, are you able to share some sample data and a sample workspace with us to demonstrate the differences between your results? I'd be interested in seeing how much your results differ by. One thing to double-check that could affect your results is the coordinate system of the data (and making sure your calculations were done in the same coordinate system).

@p.jeremie​ thanks for sharing the workspace. I can see that the difference between the FME method vs the PostGIS ST_GeometricMedian is relatively minimal. You will need to make sure you assign a coordinate system after the VertexCreator to get the same result as below, if you haven't already.

imageWe would expect some difference in the accuracy between the two methods since the StatisticsCalculator in FME is only calculating the arithmetic median. Whereas the ST_GeometricMedian method uses the Weiszfeld algorithm, which is specific to calculating the geometric median.


Hi @p.jeremie​ if possible, are you able to share some sample data and a sample workspace with us to demonstrate the differences between your results? I'd be interested in seeing how much your results differ by. One thing to double-check that could affect your results is the coordinate system of the data (and making sure your calculations were done in the same coordinate system).

Thanks for your feedback. I now understand the difference (arithmetic vs Weiszfeld).

Regarding the coordinate system, I'm pretty sure that when I saved the workspace as a template including the feature caches the output of the VertexCreator was with the correct coordinate system and not unknown as it is when I open the template I uploaded... Strange.

However, I did got the same location as in your screenshot.


Reply