[postgis-users] Centroid Calculation Error???

Paul Ramsey pramsey at refractions.net
Wed Oct 29 09:04:08 PST 2003


The CVS version, when enabled w/ GEOS should now give the "correct" 
centroid, as per strk's email this morning.
P.

Martin Davis wrote:

> Thanks, Duster.
> 
> JTS (and presumably GEOS) returns POINT (593910.9988377226
> 226906.23058975482) as the centroid.  Visually, this looks correct
> (like the centre of mass).
> 
> Over to you, DB...
> 

>> -----Original Message----- From: Düster Horst
>> [mailto:Horst.Duester at bd.so.ch] Sent: Tuesday, October 28, 2003
>> 11:50 PM To: 'PostGIS Users Discussion' Subject: AW:
>> [postgis-users] Centroid Calculation Error???
>> 
>> 
>> Martin
>> 
>> Here the WKT of the polygon (Swiss Coordinates)
>> 
>> 
>> SRID=-1;POLYGON((594029.238 227076.667,594066.353
>> 226989.68,594127.292 227001.806,594210.769 227017.778,594218.472
>> 227018.871,594224.075 227019.225,594328.615 227028.385,594331.241
>> 227028.382,594333.724 227027.428,594336.024 227026.092,594346.999
>> 227019.388,594348.032 227020.432,594350.97 227023.404,594356.685
>> 227031.13,594362.592 227040.194,594366.079 227045.735,594370.242
>> 227053.048,594373.478 227060.511,594376.985 227068.785,594382.289
>> 227079.941,594382.488 227080.884,594382.962 227087.377,594384.064
>> 227093.667,594385.213 227096.506,594387.354 227100.144,594389.542
>> 227101.84,594391.487 227102.947,594393.32 227104.067,594394.477
>> 227104.395,594397.771 227090.279,594396.953 227091.474,594395.743
>> 227091.446,594394.556 227090.976,594393.277 227089.864,594391.045
>> 227085.427,594384.128 227069.284,594378.54 227057.05,594376.497
>> 227052.679,594373.552 227046.879,594368.451 227038.839,594362.221
>> 227029.185,594356.649 227021.43,594350.262 227013.202,594317.432
>> 226980.488,594257.534 226946.253,594070.893 226878.908,593881.138
>> 226809.861,593622.716 226735.129,593566.768 226904.993,593642.974
>> 226925.582,593723.166 226942.676,593749.26 226939.353,593782.779
>> 226940.175,593829.131 226935.872,594029.238 227076.667))
>> 
>> Horst
>> 
>> -----Ursprüngliche Nachricht----- Von: Martin Davis
>> [mailto:mbdavis at VividSolutions.com] Gesendet am: Dienstag, 28.
>> Oktober 2003 18:11 An: PostGIS Users Discussion Betreff: RE:
>> [postgis-users] Centroid Calculation Error???
>> 
>> Can you submit the WKT for the feature?  I'm curious how JTS/GEOS
>> handle this.
>> 
>> Martin Davis, Senior Technical Architect Vivid Solutions Inc. Suite
>> #1A-2328 Government Street   Victoria, B.C.   V8T 5G5 Phone: (250)
>> 385 6040 - Local 308      Fax: (250) 385 6046
>> 
>> 
>> 
>> 
>>> -----Original Message----- From: Düster Horst
>>> [mailto:Horst.Duester at bd.so.ch] Sent: Tuesday, October 28, 2003
>>> 6:18 AM To: postgis-users at postgis.refractions.net Subject:
>>> [postgis-users] Centroid Calculation Error???
>>> 
>>> 
>>> I try to calculate a centroid for a polygon with
>>> 
>>> select centroid(wkb_geometry) from polygon_table;
>>> 
>>> You can see the result of the calculation in the attached image.
>>> The red point is the place of the calculated centroid. This place
>>> 
>> 
>> is obviously
>> 
>>> wrong. I think the reason for this wrong placement is the weight
>>> of the vertex points (yellow with black center). The centroid
>>> point is shifted to the north east edge of the polygon due to the
>>> heavy concentration of vertex points in this area of the polygon.
>>> In my opinion the distribution of vertex points shouldn't have an
>>> influence of the centroid position.
>>> 
>>> Perhaps I'm wrong?? Any hints?
>>> 
>>> Horst



-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_




More information about the postgis-users mailing list