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

29 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1k views

### Shapely polygons crossing the antimeridian

Sample data Consider the following WKT Polygon, crossing the international dateline (antimeridian): POLYGON((176 49,-65 49,-65 11,176 11,176 49)) And the following points: POINT(-140 32) # ...
77 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:...
263 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 ...
27 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?
324 views

### Finding center of circle given three points?

I have been trying to solve this problem for quite some time, but can't find a good solution. Given three sets of geographic coordinates how can I calculate the center point. By "center point" I mean ...
235 views

### QGIS : How to calculate centroid on polygons with holes

I try to compute the centroid of polygons with holes on qgis. I did not manage to do it directly, I had to make a conversion to convex hulls before extraction. I crashed my pgsql server trying to ...
347 views

### Centroid of the equator and a point

Suppose I already have a way to compute the centroids of different geometry types: Points (arithmetic mean of Cartesian coordinates). Linestrings (polylines) (weighted mean of segment mid-points in ...
42 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 ...
126 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 ...
38 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 ...
142 views

### Raster centroid and relationships with geoTIFF

I have a list (s) containing information on the probable locations of many animals in South America. For example, this is the type of stored information and what it looks like when plotted for the ...
207 views

### Polygon Centroids working for only some Polygons in PyQGIS?

I have a building Layer(Full of Polygons).I want to get centroids of polygons and save them as point layer.I am using python console within Qgis 3.0. I have tried below code.I got my Centroid Layer(...
344 views

### should ST_Centroid and ST_Transform be applied in a particular order?

I am a complete newbie using GIS, and particularly using postgresql-postgis. I have a table with administrative boundaries where limits are multipolygons defined in utm (EPSG:23030). I want to ...
2k views

### Centroids of each grid cell

I have a grid created by mean the following script: # My grid [using package 'sf'] worldGrid <- st_make_grid(x = worldMap, what = "polygons", cellsize = 10) worldGrid <- st_sf(idcell = 1:length(...
115 views

### Directions based on polygon centroid and average/median point of adjacent polygon's touching border

I have a layer containing multiple polygons, and I am trying to find a way to identify the directions of the adjacent polygons of a certain polygon. The directions would be based on the main polygon ...
144 views

### Creating new polygons from multiple points with centroid coordinates of polygons using ArcGIS Desktop?

How to Create from an Excel file or shapefile with multiple points with the coordinates of the centroids polygons, now I would like to create an amount x of polygons with the information of the points,...
68 views

### Postgis routes diagram point-to-point

I have a set of centroids to which are related a set of points characterized by linename. The table with the points contains these fields: id ¦ linename ¦ lat ¦ lon¦ I would like to make a diagram ...
518 views

### How can I find the center of the circle or ellipse I just created

I need to draw circles and ellipses with a certain length/width/ radius. I used the rectangles ovals digitizing plugin to create them, but only measured roughly the circles' radiuses. It would be ...
1k views

### Locating the centroid (center of mass) of spherical polygons

I'm trying to work out how best to locate the centroid of an arbitrary shape draped over a unit sphere, with the input being ordered (clockwise or anti-cw) vertices for the shape boundary. The density ...
32 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 ...
64 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 ...
46 views

### Computing center and zoom level for a set of points

I need to duplicate google's static map image API api on an internal server with no internet access using OpenStreetMaps. I did find the OSM Wiki Page covering this topic. I initially looked at OSM ...
45 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 ...
35 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 ...
144 views

### R sf extrapolate grid from centroids

I've got a grid/raster in R that is represented as centroids of the grid instead of polygons. I am trying to merge that with points. library(sf) nc <- st_read(system.file("shape/nc.shp", package="...
40 views

### K means clustering where centroid is a node

How would you approach a k mean clustering where the calculated centroids have to be on the same position as one of the nodes? as you can see we have 2 centroids which are arguably the center of each ...
142 views

### Routes through centroids and array functions

I have a table stopcentroids4 like in figure with the following fields: gid, routes, geom and i want to draw a line for each route that runs through centroids. In my code there is a mistake. ...