<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
w\:* {
BEHAVIOR: url(#default#VML)
}
..shape {
BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]-->
<STYLE>@page Section1 {size: 595.3pt 841.9pt; margin: 70.85pt 3.0cm 70.85pt 3.0cm; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EstiloCorreo17 {
COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=ES vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2>It uses the Geos library to calculate centroid if Geos is
installed. My cursory glance of the Geos code, looks to me like for
polygons and multipolygons</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2> it first takes the area of the region and then finds
the average x,y, z of that encompassing area.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2>So yes it is conceivable in a multipolygon that the
centroid may not fall in any of the polygons.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2>Anyone correct me if I am wrong since I'm not too familiar
with c++ code.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2>Anyrate I think the relevant piece of code in geos library
is source\algorithm\CentroidArea.cpp</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=228024611-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Matt
Doughty<BR><B>Sent:</B> Thursday, June 14, 2007 7:03 AM<BR><B>To:</B>
postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] How is
Centroid(Geometry) calculated?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Can anybody explain how PostGIS
calculates centroids? I’ve checked the manual but the relevant section doesn’t
refer to an OGC Specification. From what I can understand, it takes an average
of the coordinates of all the vertices of an entry, ignoring whether or not the
centroid falls outside the polygons. Is this right? This differs from other GIS-
GeoMedia, for example, when confronted with a multipolygon entry, always puts
the centroid inside the largest polygon.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Can anybody shed some light on
this?<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Cheers,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Matt<o:p></o:p></SPAN></FONT></P>
<TABLE class=MsoNormalTable style="BACKGROUND: white; WIDTH: 100%" cellPadding=0
width="100%" align=left bgColor=white border=0>
<TBODY>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt"
colSpan=2>
<P class=MsoNormal style="mso-element: frame"><FONT face="Times New Roman"
size=3><SPAN lang=EN-GB
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt"
colSpan=2>
<P class=MsoNormal style="mso-element: frame"><FONT face="Times New Roman"
size=3><SPAN lang=EN-GB
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt">
<P class=MsoNormal style="mso-element: frame"><FONT face=Arial
color=#2e3a75 size=3><SPAN lang=EN-GB
style="FONT-SIZE: 12pt; COLOR: #2e3a75; FONT-FAMILY: Arial">Matt
Doughty</SPAN></FONT><SPAN lang=EN-GB><o:p></o:p></SPAN></P></TD>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt"
vAlign=top rowSpan=5>
<P class=MsoNormal style="mso-element: frame"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><IMG id=_x0000_i1025 height=100
src="cid:228024611@14062007-097E"
width=90><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt">
<P class=MsoNormal style="mso-element: frame"><FONT face=Arial
color=#2e3a75 size=3><SPAN
style="FONT-SIZE: 12pt; COLOR: #2e3a75; FONT-FAMILY: Arial">GEOGRAMA
S.L.</SPAN></FONT><FONT face=Arial><SPAN
style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt">
<P class=MsoNormal style="mso-element: frame"><FONT face=Arial
color=#2e3a75 size=3><SPAN
style="FONT-SIZE: 12pt; COLOR: #2e3a75; FONT-FAMILY: Arial">Tel.:
+34 945 13 13 72 652 77 14 15</SPAN></FONT><FONT
face=Arial><SPAN
style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt">
<P class=MsoNormal style="mso-element: frame"><FONT face=Arial
color=#2e3a75 size=3><SPAN
style="FONT-SIZE: 12pt; COLOR: #2e3a75; FONT-FAMILY: Arial">Fax: +34 945
23 03 40 </SPAN></FONT><FONT face=Arial><SPAN
style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt">
<P class=MsoNormal style="mso-element: frame"><FONT face=Arial
color=#2e3a75 size=3><SPAN
style="FONT-SIZE: 12pt; COLOR: #2e3a75; FONT-FAMILY: Arial">www.geograma.com</SPAN></FONT><FONT
face=Arial><SPAN
style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt"
colSpan=2>
<P class=MsoNormal style="mso-element: frame"><FONT face="Times New Roman"
size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P></DIV></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>