# 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.

186 questions
Filter by
Sorted by
Tagged with
30 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 ...
20 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 ...
13 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 ...
186 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 ...
37 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?
70 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-...
174 views

### Creating centroid inside of polygon [closed]

I want to get the centroids of my multipolygons using Python and GeoPandas. But when viewing the polygons and the centroids points on QGIS, the centroids are not inside the polygons. Here is the code ...
46 views

### Spatial join with GeoPandas with two geometry columns

I have one GeoDataFrame which contains two geometry fields - one is polygon and one is the polygon centroids. The table has also other fields. I have run spatial join between the gdf and another ...
27 views

### Distance from one city to others by a mutual ID

I don't understand spatial.data at all. I have been studying but I'm missing something. What I have: data.frame enterprises with the columns: id, parent_subsidiary, city_cod. What I need: the mean and ...
187 views

### Getting lat/long for centroids using QGIS

I have a series of polygons (lakes) in Kansas, Oklahoma and a few in Texas. I created centroids of each lake, which I need for distance measurements. These centroids have derived lat/long information ...
71 views

### How do I create centroids inside polygons in Python?

When creating centroids from polygons, ArcMap has an option to placing the centroids inside (within the bounds of) the polygons. I am attempting to create centroids in Python. I have tried: df['...
25 views

### Determining the centroid of the thickness calculation used in Zonal Geometry

I have a need to determine the coordinates at the centroid of the "deepest" point within an irregular polygon feature. I have done some researching and found that Zonal Geometry calculates ...
23 views

### Cut linestring segment at centroid in PostGIS

In a table of linestring three segments are connected. first--second--third could Postgis generate the centroid of second segment and merge first and third at center? Is it possible? first--...
97 views

### Get longitude and latitude from a shapefile with Leaflet in R

I've been trying to map with leaflet to add addCircles() but my shapefile doesn't seem to have the latitude lat and longitude lng parameters so I got the centroids for each city as is the code below ...
65 views

### Distance Matrix between centroids QGIS

I'm using QGIS and I would like to measure the distance between the centroid of King County in the US and the centroids of all other US counties. I have imported the shapefile and I have executed the "...
90 views

### Calculate irregular polygon center-point that falls within the polygon boundary

I have an SDE.ST_GEOMETRY polygon FC in an Oracle 18c/10.7.1 geodatabase. I can calculate the X and Y of the polygon centroids using the SDE.ST_GEOMETRY ST_Centroid function: sde.st_x(sde....
42 views

### Find centroid of a set of points [duplicate]

I have a set of points in 2 dimension plan : A(x1,y1), B(x2,y2), C(x3,y3) .... How can I know which point of these points (A,B,C, ...) is the centroid of the other points
82 views

### Creating ellipse with SatScan output using QGIS

I need to use QGIS to create an ellipse employing a SatScan output with information on spatial risk clusters for the occurrence of an. The output contains the coordinates of the centroid point of ...
186 views

### Finding the centroid of a merged polygon using shapely function

I have a polygon shapefile and I want to find the centroid of the polygon, and output the centroid as a new shapefile before I geocode. How I should do this with Python functions shapely and Fiona and ...
49 views

### Workaround for Mean Coordinates in graphical modeler

I am searching for a workaround to build mean coordinates in graphical modeler since I have noticed a bug which I have reported here: https://github.com/qgis/QGIS/issues/35385 Basically, I just need ...
33 views

### Find one centroid instead of multiple centroids?

I'm trying to find the centroid (center of mass) for several IUCN species range maps. Using the code below I've run into an issue in R. library(rgdal) library(rgeos) shp <- readOGR("/Documents/...
42 views

### Create centroids from point layer based on unique field names

I have a point layer in QGIS, which I want to filter by attribute values of a specific attribute column. For each unique attribute value, a centroid should be calculated from the respective features. ...
52 views

### Difference between grid and its centroid

Recently I was download GPCC gridded precipitation data. I plot them on Matlab and it gives me pixels. then I tried to plot them on the ArcMap and saw there are lots of points instead of pixels. What ...
68 views

### Generate N polygon centroids based on attribute in QGIS

I have a number of polygons with an integer value in a field. I would like to create N number of centroid points for each polygon where N corresponds to the value in the polygon's field. So sort of ...
112 views

### Auto-generate Grid Reference for Point and Polygon features within existing Shapefile, QGIS

I have various point and polygon layers (shapefiles) which I use regularly in QGIS (3.6.3), and often need to work out their location as an 8 figure grid reference (British co-ordinates, EPSG-code ...
144 views

### Centroid of multiple polygons based on value in attribute table

I have a (polygon) shapefile with multiple zones. Now, I would like to calculate the centroid of groups of these zones. The zones have to be grouped based on a value in the attribute table: AreaNr ...
99 views

### Creating convex hull by expression by aggregating points

I would like to recieve the centroid of a convex hull of a group of points in a layer, grouped by its name. This needs to be done by expressions, available in QGIS 3.4. E.g. I have this list of points:...
484 views

### QGIS Point on Surface

As far as I can tell, the option to "Create point on surface for each part" in the QGIS Centroid tool is not returning the correct geometry when activated in QGIS (version 3.8.1-Zanzibar/GDAL v 2.2.3 ...
267 views

### Get midpoint of SDE.ST_GEOMETRY polylines?

I have a polyline SDE.ST_GEOMETRY feature class in an Oracle 12c geodatabase (10.7.1). I want to create a view on the feature class that has X and Y columns that contain the coordinates of the ...
128 views

### Getting polyline midpoint coordinates using ArcGIS REST API

I have an ArcGIS 10.7.1 feature service that integrates polyline GIS assets to a work order management system. In the work order management system, I want to retrieve the midpoint coordinates of the ...
68 views

### PostGIS - How to extract polygons in a rectangle by their centroid?

I'm new to PostGIS and I'm amazed what can be done with it! Currently I'm running a query from a large database where I need to split the extracts into smaller chunks so that I'm not bouncing at the ~...
13 views

### Calculate centroid of points (group point) [duplicate]

I am new to PostGIS and I need to calculate the centroid of a group of points that have a cluster identifier (id_cluster). I need to get the latitude and longitude of the cluster centroid.
56 views

### Speedup function to calculate distance from centroid of building to river segment in PostgreSQL

I am trying to measure the distance from the centroid of a building to a river segment using the following function. CREATE OR REPLACE FUNCTION river_foo_mapper () RETURNS trigger LANGUAGE plpgsql AS ...
124 views

### Finding coordinates of centroids?

I have a few thousands of polygons, which I found the centroid for each one of them. Now I want to find the coordinates of each centroid. But for some reason the x and y columns are empty and I don't ...
43 views

### Real Centroids plugin QGis 3.4.4 Inavlid Geometry?

The plugin gives on a specific feature the following error message: "Invalid or empty geometries found". Is the following topology not supported?
85 views

### Spatial Join Polygon to Polygon with Centroids Inside features

I have a parcel feature class with +5M features. I want to spatially join it to a feature class of regions to check if the regional code matches that in the parcel data. I've tried using "have their ...
82 views

### Making path between polygon using QGIS?

I am trying to draw a line (vector layer) of a certain length that that tries as much as possible to dodge the green polygons. Assuming a starting point, is there some sort of line centroid ...
245 views

### Combining st_snaptogrid with st_centroid and group by using PostGIS?

I have a table of devices, each of them has a field 'location' that is a postGis geometry(Point,4326) I need to operate a GROUP BY based of the placement on a grid, I'd use ST_SnapToGrid and then I ...
149 views

### Displaying a legend for a centroid, simple marker with size overwrite?

I am new to QGIS and can't figure out how to display a legend for the dot size of a centroid, simple marker. The size of the dot is dependent on a value from a CSV linked to a layer map of Europe. I ...
376 views

### Geoserver SLD: How to get CENTROID of result of INTERSECTION?

In my GeoServer SLD I need to place a symbol (particularly a piechart) exactly on Centroid of the result of Intersection of 2 geometry: geom field from my PostGIS table AND environment variable ...
28 views

### How is the Point on surface tool calculated in QGIS [duplicate]

I am interested to know how the Point on surface tool works in QGIS 3. I am choosing to use this rather than the Centroids tool which works of the "center of mass" methodology because this creates a ...
4k views

### Creating centerline of river in QGIS? [duplicate]

I made two river bank lines and I want to associate them. I want to make a centerline using two rows as a base. I managed to make the centre line with a lot of work creating several lines from one ...
72 views

### Centroids: Based on travel distance/time and not straight line distances

I am working on a Sales Person Deployment project and quite often come across requests for calculating centroid of a territory where work is distributed across 1000s of ZIP codes. Increasingly we get ...
168 views

### Calculate weighted centroid of a raster layer using GRASS?

I'm trying to calculate the weighted centroid of some raster layers I have, which are basically patches of positive values in a sea of null values. I know I could convert thoses patches to binary ...
40 views

### NHGIS census files get lat/lon from polygon

I've never worked with shapefiles before and I'm having a lot of trouble with something that I think should be pretty simple. So I have the census tract files from NHGIS for 1980 and the structure ...
49 views

### How to compare centrality of points in different shaped and sized polygons

Suppose I have several polygons of varying shape and size, each containing a single point. I want to compare the centrality of each point, and determine which point is more central to its polygon. I'm ...
79 views

### Calculating centroid for polygon layer with several features?

I need only 1 centroid point for the whole layer (more than one polygon) instead of 1 centroid point per feature that you get with the menu -> Vector -> Geometry tools -> polygon centroid tool. Its ...
370 views

### Centroid value extraction of Landsat image collection in Google Earth Engine

I have an NDVI collection wich I have created from the combination of different collections Landsat5 and 7. How can I exctract the NDVI values of the centroids of each pixel, of each image from my ...