# Questions tagged [centroids]

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 to any object X in n-dimensional space: its centroid is the intersection of all hyperplanes that divide X into two parts of equal moment.

232 questions
Filter by
Sorted by
Tagged with
30 views

### Creating polygons from centroid and bounds

I am looking to create multiple overlapping administrative boundary polygons, but only have centroid and "bounds" columns to draw from at the moment (the latter being four, comma-separated ...
59 views

### Plot points around defined centroid using degrees and distance in QGIS

I have a shapefile plot_center of plot centroid points (like picture below) and then I have a Excel table with trees which corresponds to plot centroid points by common field ID. The excel table ...
• 521
31 views

### QGIS rotate CRS around a new centre

I've been given some NetCDF data in a Mercator projection with a centre longitude of 173.9581, centre latitude of -41.0870 and rotation of 40 degrees. I have tried to create a new CRS based on ...
• 231
66 views

### Computing visual "center" of irregular polygon

I am using the centroid to render a marker in the "center" of a parcel, but the marker location is heavily influenced by detailed curves in the geometry. Parcels on a cul-de-sac, for ...
• 2,821
31 views

### Rasterize a vector layer where pixels just need to include a vector inside, not necessarily on the center

QGIS(3.22) I'm trying to compare a vector layer to a raster layer by rasterizing the layer to the same pixel size as the raster and then using raster calculator. I just want to know which pixels in ...
1 vote
12 views

### Centre of mass w.r.t. a raster

I have a vector layer of polygons, and a raster layer with real numbers. I would like to get for each polygon, a 'centroid', not purely based on the geometry of the polygon (such as provided by Vector ...
• 33
64 views

### Scaling polygons in vector grid around polygon centers in QGIS

I have a aerial image with a vector grid overlaid in QGIS. Is it possible to scale the individual polygons (scale all of them by the same size) around their individual centroids? For example, to cut ...
• 61
1 vote
50 views

### Create polygons around centroids, maintaining information

I have a csv file which contains points (latitude, longitude) around all the African continent (see the picture for clarification). Apart from the latitude and longitude, it contains more information. ...
• 445
1 vote
106 views

### Getting centroid of area and info in popup in Leaflet

I'm trying to get the centroids of each of the features of a polygon layer, and the popup with its info inside: but I'm not able to show those centroids. Something is wrong in my code, the variables ...
• 143
1 vote
273 views

### Convert MultiLineString to one LineString

TLDR: I was not able to change the String type from MultiLineString to LineString and keep the line together but there is a way to still represent that as a symbology. So my problem is solved, but the ...
• 301
88 views

### Creating centroid on curved surface in QGIS

I am using QGIS 3.16.13 to build a map in which I have 98 adjacent polygons that represent areas of ocean around the coastline of an island. I want to have a centroid inside of each polygon, even ...
• 53
223 views

### Generation of centroids outside polygon

I have a polygons layer and creating a centroid layer of it, some of them are generated outside my polygon, what cause a selection problem after. Does anyone know how to solve this?
• 281
26 views

### Getting minimum latitude of centroid geometries in a folder using ArcPy

My goal is to print names of feature classes and corresponding minimum latitude of centroids of geometry for all shapefiles in a folder. In total I have 5 shapefiles and I'm trying to loop through ...
• 411
129 views

### Calculating raster weighted centroids for polygon in QGIS

I need to calculate centroids for each feature in a polygon layer, weighted by the values of a raster. So the centroids are shifted towards higher raster values. I found a way, but it is complicated. ...
• 51.4k
312 views

### QGIS - how to use geometry generator to place a centroid in each segment of a multiline?

With geometry generator in QGIS I'm trying to place a marker in the midpoint of each segment of a multiline vector (I don't want to use the Highlight line option). My main issue is how to read each ...
16 views

### Storing the standard distance of a centroid alongside the centroid coordinates

I'd like to calculate and save a centroid (the central tendency) of a set of points as well as the standard distance (i.e. the root mean squared distance to the centroid). I can store the centroid as ...
• 874
116 views

### Calculating/obtaining a "centerpoint" inside a multipolygon entity with FME software?

Obviously, this point does not necessarily have to be the real centroid, but it does have to be a, only one, single interior point of each multipolygon. What I have found is the CenterPointReplacer ...
• 1
73 views

### Filtering on centroid distance between layers in Rule based layer styling in QGIS

By using Rule based layer styling for a polygon shapefile I want to display only those features whose centroid is separated by 1.000m from the feature centroids of another polygon layer ('layerB'). ...
1 vote
102 views

### Extracting centroids from property of polygons

I have been using a function to get the centroid of each polygon (building) in my dataset. var buildings = ee.FeatureCollection('GOOGLE/Research/open-buildings/v1/polygons') Map.addLayer(buildings, {...
• 51
41 views

### Drawing routes combining a geographic dataset and a dataset containing routes in R

I want to draw migration routes on a map in R. The basic idea is that I have a dataset containing 3 municipalities inside Mexico through which an individual has passed. I want to draw a line ...
• 103
1 vote
171 views

### Preserving IDs when using gCentroid to find centroids of multiple polygons in R

This seems like it should be simple. I have multiple polygons contained in one shapefile, and I am using the gCentroid() function from rgeos to create a bunch of centroid points. The function has an ...
• 37
1 vote
101 views

### Create a database of the world divided into .25km squares

I would like to build a database of GPS coordinates spaced out .25km over all of the land in the entire world. It's a discovery project for a client that wants to perform visualization and I'm not a (...
• 121
321 views

### Finding centroid of features within polygon using ArcGIS Pro

I have some polygon features and within those polygons are some coordinates for some other features. How do I find the centroid of those coordinate points within the polygon (NOT the geometric ...
1 vote
1k views

### Google Earth Engine: How to obtain coordinates of centroids of polygons of a FeatureCollection

I need to obtain coordinates (longitude, latitude) of the centroids of a FeatureCollection of polygons in Google Earth Engine. I would like to download the coordinates if possible. I am new to GEE and ...
• 11
395 views

### Splitting concave polygons into convex polygons in QGIS

I want to optimize and decompose several concave polygon into convex ones but not too small or to complicated ones.Ideally cutting in places that would minimize the creation of convex polygons and in ...
79 views

I want to download a time series of the average pixel value of a buffer around a number of points. In the resulting table, I'd like to have the coordinates of each point as a variable. How to do this? ...
• 617
53 views

### Using PostGIS operations

I'm new on PostGIS I have this The orange ones are buffers, the red dots are the centroids of each brown polygon So I've tried to cover the brown polygons by making buffers of the centroids (red dots)...
33 views

### Translate polygon using QGIS 3 [duplicate]

I would like to move a polygon's center to another location by specifying a latitude and longitude. I am using a EPSG:4326 - WGS 84 projection.
• 353
1 vote
273 views

### Creating Hexagon from centroids of polygons using ArcMap

How do I create a hexagon from its centroids using ArcMap? I will show the image below. It is H3 resolution 9. This picture illustrate the centroid of the hexagon so I would like to know how to ...
358 views

### QGIS: Create point layer (centroids) with radius attribute from circle polygon layer

I have polygon layer which consists of many circles with different radius (see below) and I want to convert it to centroids and write new attribute into attribute table of centroids with value of ...
• 355
306 views

### Calculate distance from polygon feature centroid to coordinate in QGIS 3.18

I have a shapefile with a lot of polygon features in it. For each polygon, I want to calculate the distance from the centroid of each polygon to a certain coordinate. How can I achieve this using the ...
1k views

### R st_centroid GEOS error Unknown WKB type 12

I’m trying to calculate centroids of polygons of postcode areas (wfs shapefile), but I’m getting the following error message: Error in CPL_geos_op(“centroid”, x, numeric(0), integer(0), numeric(0), : ...
1 vote
92 views

### QGIS distance between centroids from NUTS1 information

I have calculated the centroids from NUTS1 information. Now for every neighbor centroids, I would like to calculate the distance. I want to connect only the neighbor's Centroids regarding the NUTS1. I ...
228 views

### How do you create a point within a polygon that is the farthest from all edges of the polygon in ArcGIS Pro?

I am curious how one could create a centroid for an irregularly shaped polygon in ArcGIS Pro, that lies within that polygon's boundaries, with the concept of centroid in this case meaning a point ...
• 105
377 views

### Get image pixel centroids in Google Earth Engine

I would like to create a feature collection consisting of the centroid points of the pixels in an image. The question of how to do this has been asked before on Stack Exchange, but not actually ...
• 343
96 views

### Plotting data with centroids only

I am fairly new to spatial analysis and I am trying to create a map of the spatial distribution of pollution in the UK using publicly available data retrieved from https://uk-air.defra.gov.uk/data/pcm-...
1 vote
225 views

### Calculating perpendicular distance from centroid of polygon to multiple lines in QGIS

In QGIS 3.10.4, I have two shapefiles (polyline and polygon, layer name 'boundaries', 'lines' respectively), look like below: My goal is to calculate the perpendicular distance from the centroid of ...
1 vote
255 views

### Match centroids from one dataset with polygons of another

I want to make a data frame showing which voting precincts are in each school zone. To do this, I want to see which precincts' center points are in which school zones. library(sf) precincts <- ...
• 287
82 views

### Spatial Query for centroid of one feature falls within another

I am looking at doing a spatial query where I can find when the center of one feature falls within another. Both geometries are on different layers. For example, when the center (centroid) of an area (...
80 views

### Manually adding centroids to arrows in Virtual Layers in QGIS

Currently, I'm making a map that depicts the migration flows of people who have finished their university degrees and decide to move to a different Dutch city after their studies. By following Anita ...
• 365
1 vote
102 views

### Why does the location of the mean of a set of points not coincide with the location of a point I created in QGIS?

So I've made a number points for a set of locations in the Netherlands. Here they are: The location of the purple point was computed by means of the “mean coordinate(s)” tool in QGIS. It represents ...
• 365
64 views

### Unable to get latitude and longitude of the US map from TopoJSON's us-atlas repository when using GeoPandas

To do some geospatial analysis I am using the USA counties map from topojson/us-atlas repository After loading the link https://cdn.jsdelivr.net/npm/us-atlas@3/counties-10m.json in geopandas I get the ...
• 173
1 vote
123 views

### Drawing points in layer given its coordinates using PyQGIS [closed]

I want to draw points in a certain polygon layer. Specifically, I want to display the centroid over each respective feature. All this using PyQGIS. So far, none of the answers I found helped me. I am ...
46 views

### Find mean / median point based on ID attribute and point density (hot spots)

I have a point feature class within ArcGIS Pro, with 10.000 features, data are structured like this: ObjectID | MemberID | Lat | Long 1 ID_1 Y1 X1 2 ID_1 Y2 X2 3 ...
• 115
1 vote
37 views

### Why does dropping a single point dramatically affect location of polygon centroid?

I'm a relative novice working with some coordinate data using shapely and have found a weird behavior when trying to identify outlier points. The approach I am using is to iterate over a series of ...
• 11
1 vote
204 views

### Create feature collection of polygons' centroids in GEE

I am trying to determine the distance between province centroids and a polygon. Based on this past post, I was able to store the geographic coordinates of the province centroids into their feature ...
• 129
622 views

### How to ensure centroid is calculated within polygon?

I am working with a Search Cursor approach to calculate centroids within polygon features. You can see from the screenshot that the script calculates centroids within polygon features, however, some ...
• 50.2k
72 views

### Centroid in British National Grid

I am trying to work out centroid of a polygon, but I need this in British National Grid. Does anyone know a way of getting it to work in QGIS 3.10?
• 57
340 views

### Creating Virtual layer that is the centroid of another polygon layer

There's a polygon layer building and I want to create a point layer centroid containing centroids of building layer. I have 2 more requests: to keep all attributes in the building layer in the newly-...
• 510