# Tagged Questions

In geometry, the centroid, geometric center, or barycenter of a plane figure or two-dimensional shape X is the intersection of all straight lines that divide X into two parts of equal moment about the line. Informally, it is the "average" (arithmetic mean) of all points of X. The definition extends ...

20k views

### How to find the center of geometry of an object?

Well it might be a simple question. Given a set of 2D or 3D points, the question is: How to find the center of geometry of an object? According to the following figure, the center of geometry ...
52k views

### Where can I obtain an up-to-date list of US ZIP Codes with Latitude and Longitude Geocodes?

NOTE: This began as a question on Stack Overflow, which has subsequently been closed. I also noticed a similar question about Most Up-To-Date Source for US Zip Code Boundaries, but I believe this ...
13k views

### How to calculate polygon centroids in R (for non-contiguous shapes)

I've spent a little while figuring out the answer to this question. It's not immediately obvious from a Google search, so thought it may useful to post the answer on here. There is also an additional ...
20k views

### How to determine the centroid of polygons?

I have a polygon vector and I want to quickly attain the centroid of this polygon for insertion in a text document. I am working with QGIS. I searched through other questions and although some are ...
4k views

### How does ArcGIS Desktop calculate INSIDE point for Feature to Point?

Let me back up and say that from what I understand there are two common ways to calculate the centroid of a polygon in ArcGIS Desktop: Using Calculate Geometry on fields within the attribute table ...
29k views

### find the centroid of a cluster of points

While searching the web, solutions for finding centroids of polygons come up rather often. What I'm interested in is finding a centroid of a cluster of points. A weighted mean of sorts. I would ...
3k views

### How to take polygon centroid in Postgis

I have table with column name,Latitude and Longitude.I want to update this with polygon name and its centroid latitude longitude.I know there is a function in postgis st_centroid(geometry). But I want ...
651 views

### How exactly is the centroid of polygons calculated?

I would like to know how exactly QGIS Geometry tools -> polygon centroid is calculating the point coordinates. For example does it divide the boarder of the polygon into small points, take two pairs ...
1k views

### assign and move centroids to their polygons

I m using QGIS 1.8 Lisboa. After calculating the centroids from a polygon shapefile, if some of them lie outside the polygon outlines, I'd like to move them on the polygon they came from. The ...
3k views

### Calculating a spherical polygon centroid

I'd like a general way to calculate centroids for polygons on a sphere. So far, the best online reference appears to be: Tools for Graphics and Shapes by Jeff Jenness. The method described ...
26k views

### How to add Lat/long columns to a point layer which is not in WGS84?

I need to extract the Lat/long coordinates of the centroids of districts. My QGIS project SCR and the different layers have all been set on "WGS 84 / UTM zone 18N". I've created the centroids using ...
9k views

### List of central coordinates for all countries?

I need a list of the central points for all countries: China: lat/long (coordinates of the most central point in China) France: lat/long (coordinates of the most central point in France) etc...
337 views

### Coordinates of cities and villages in The Gambia/Senegal

I am looking for sources of geo-referenced data on villages and cities (or all other things there are) in The Gambia (and Senegal if available). One issue with geocoding in rural West Afrika is the ...
219 views

### How to connect centroids of lines sharing the same intersection in QGIS?

I'm looking for a big help to accomplish the following task: I have this street network of the center of Turin (IT), composed by lines representing streets, and black points representing ...
1k views

### How to get the centroid of a set of points in POSTGIS?

I use PostgreSQL with POSTGIS extension. I have a set of points in the_geom column from a table myshema.myobjects I would want create a select statement to get the centroid of this cluster, so from a ...
5k views

### What is Centroid of all lands of Earth?

May be my question is somehow ridiculous but I want to find the center point of all lands of the earth. What I have tried up to now is downloading shape file of all countries and polar parts of the ...
1k views

### How to place multiple symbols on one polygon centroid?

I am using QGIS for visualizing the health conditions of elderly living in an old age home, some of the elderly have multiple medical device with them and I want to show them on the map. Suppose I ...
2k views

### calculate {minimal} distance between polygons in R

I have calculated the surface area of species distributions (merging polygons from shapefiles), but since this area can be comprised of quite distanced polygons, I would like to calculate some measure ...
1k views

### How to force QGIS Centroid Fill inside the Polygon?

I would like to use a centroid fill to enable me to place a letter inside a polygon. The advantage of using a centroid fill is that it also shows up in a legend, whereas labelling the layer would mean ...
4k views

### Polygon Centroid Options and Appropriateness (FeatureToPoint, Labels, etc)?

I've found a couple of other Stack Exchange questions related to this, but they were not satisfying. For example: How does ArcGIS Desktop calculate INSIDE point for Feature to Point? does not tell ...
1k views

### How to create point labels from midpoints of road polylines in QGIS?

Heres what i want to achieve: i have a roading polyline layer (singlepart ie has several features per road, grouped by an id field), and i want to (after merging the parts) find the mid point of the ...
3k views

### How do I calculate a weighted centroid with respect to a raster, e.g. population weighted centroid

In ArcGIS 10.0, how do I calculate the weighted centroid of a collection of polygons, where I want the weight to be a raster layer. In particular I am using a raster of population counts and would ...
191 views

### Why does qgis give multiple centroids per polygon?

I have a shapefile for the boundaries of European NUTS regions, and I would like to compute the centroid for each of those regions. When I do this in QGIS (2.6.1 on OSX, using polygon centroids from ...
1k views

### How to use the field calculator's centroid() Geometry function in qgis 2.0?

There is an option in the field calculator for centroids under geometry which when you double click gives you "centroid( ". What information is required here in order to use this function?
489 views

### Misalignment when generating centroids with Qgis

I was wondering if anyone could shed a light on why this behavior is happening in QGIS ? I'm pretty confident that the issue here is not due to "centroids within polygon" Edit Added a detailed ...
394 views

### What is the difference between data access's “SHAPE@XY” and “SHAPE@TRUECENTROID” tokens?

Data Access Search Cursor. What, if anything, is the difference between the tokens "SHAPE@XY" and "SHAPE@TRUECENTROID"? They returned the same coordnates on a test polygon: >>> cursor = ...
9k views

### How can I calculate the center point inside a polygon in ArcGIS 9.3?

I'm using the JavaScript API 1.6 on ArcGIS 9.3. I have a polygon geometry in an ArcGIS map, and I'm trying to find a way to get the point that lies in the exact center of the geometry. What is the ...
87 views

### How to assign polygon attributes to grid cells using centroids in QGIS?

I am relatively new using QGIS. Unfortunately I can´t figure out the following yet. I have two polygon shapefiles, one is a grid I have created using QGIS 2.12.3-Lyon (Creat graticule) and the ...
2k views

### Finding the “center of gravity” of multiple points where points have unequal weights [closed]

I'm trying to reduce a set of lat/lons (each with it's own weight) into one lat/lon that is the center of mass of all of the points. however when I map the results the average point falls no where ...
386 views

### Computing radius of gyration in PostGIS

The radius of gyration is a measure of the standard deviation of distances between points (and their center of mass), i.e., how frequently and how far points are moving. A formal definition is: I ...
1k views

### How do I get the centroid of line with OGR

Can somebody explain how to get the centroid of a feature with ogr? I have no idea what the centroid() function itself does. >>> linelyr = lineshp.GetLayer() >>> f = linelyr....
72 views

### PostGIS - Get a point inside a line or polygon

I need to get the center point of a line or polygon to make marker for my app. So that when you click a marker the geometry appears (line or polygon). I used ST_Centroid to make it work. The result ...
65 views

### Positioning labels in center of clipped polygons?

I am using ArcMap 10.1 and would like to label a polygon layer that i have clipped. It appears that the label is set for the geometric center of the polygon that falls outside of the clipping.
207 views

### How to compute weighted centroids in PostGIS?

I have a group of points and each point has an associated count value. How can I calculate the centroid of the group weighted by the values associated to each point?
439 views

### Is there a method in SQL Server (2008 or 2012) that will return the equivalent of the Esri LabelPoint for geometry?

I'm looking for a method that is equivalent to the Esri LabelPoint for SQL Server Geometry (or fairly close). Does it exist by a different name? Or is there an after-market implementation? I found ...
56 views

### How to get mean coordinates of features from a point layer?

I have a vector layer containing several points and I would like to generate the mean coordinates of these points, using QGIS only if possible. I'm looking for something similar to centroids, but for ...
698 views

### Shortest distance from polygon centroids to a line in QGIS

To get the distance of each polygon centroid from a line, I have tried the Distance to nearest hub algorithm from the Processing Toolbox. The distances I got from the algorithm did not seem correct, ...
250 views

### How to get projected centroids in QGIS?

I am trying to get a centroid for several polygons on a global scale, in a way that it would correctly represent the common centre of all the polygons, taking Earth's curvature into account. The ...
1k views

### How do I convert longitude & latitude to a 3d (geocentric x,y,z) coordinate?

I'm interested in finding the centroid of a point cloud. I understand that to do this I need to convert latitude and longitude values to 3d coordinates, average them and then convert the resulting ...
290 views

### Zip + 4 Centroids

I have a data set with ZIP +4 codes, and ideally, I'd like to map them (their centroids) as points. I'm not interested in their boundaries (since they're not really geographies anyway). Does anyone ...
87 views

### Qgis creating point within complex shapes (with holes) [duplicate]

I'm looking for a tool to create a point in every polygon, that will be placed in the polygon. these are complex shapes with holes. the point must not put in those holes! the "plugin RealCentroid" ...
28 views

### Rasterize in QGIS using point as centroid (not vertex)

I'm attempting to make the full switch from ArcGIS to QGIS, but there are a few snags I'm hitting along the way, one of which is in the GDAL "Rasterize" function. My process goes like this: I have a ...
83 views

### Finding centroids for icosahedral gnomonic projection?

I've been trying to create an icosahedral gnomonic projection, like this example by Jason Davies or this one (the Fisher projection). The method that I initially used was using the centroid of each ...
612 views

### OpenLayers: How to get *real* centroid of a Line Geometry/Feature?

I have declared a line geometry as: var lineString = new OpenLayers.Geometry.LineString([source,target]); then I am trying to get the centroid of this lineString as lineString.getCentroid(). But ...
6k views

### How to calculate centroid of a polygon defined by a list of longitude/latitude points? [duplicate]

I've imported some polygons (ways) from OpenStreetMap and now want to calculate the centroids of them. For this purpose I wrote following code: final List<Point2D.Double> points = ...
4k views

### Is it possible to extract Coordinates of Polygon Centroid in QGIS?

I have created polygon centroids using one of the "Geometry Tools" but I would like to extract the actual coordinates into Excel for further work. Is this possible?
198 views

### How to find multiple centers of gravity?

Say I have a number of customers in a geographical area, marked "c": Each customer has a Lat/Long. I would like to find x number of points, in the same space, that best serve the customers, ie. ...
2k views

### Combining different geometry types into same feature class?

I've searched the question in this blog. Maybe I don't use the right words but anyway my problem is not present in any post so I'll try to explain my question by opening a new one. I have a polygon ...