Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
21 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 ...
3
votes
1answer
34 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 ...
0
votes
0answers
20 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 ...
1
vote
0answers
24 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 ...
1
vote
1answer
35 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 ...
0
votes
1answer
42 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 ...
0
votes
1answer
60 views

Using centroid point to generate polygon using ArcPy? [closed]

Is this possible to generate polygons from points (which are centroids of future polygon)? I got shapefile with ~250 points + they have got two attributes: length and width. I don't need complete ...
1
vote
2answers
40 views

QGIS Rasterize PolygonZM

I have a triangulated DEM PolygonZM shape and would like to Rasterize it in QGIS (3.2). I couldn´t find an option to use the geometry´s z value so i tried to create a field and calculate the centroid´...
0
votes
0answers
26 views

Generate Markers from WFS via turf.centroid() with Popups

I have successfully made a map that computes points from a WFS consisting of polygons and generates them as markers. The calculation is carried out by turf.js. However, I do not get all the properties ...
2
votes
1answer
41 views

How do I center a polygon on specific co-ordinates?

I need to place a set of polygons onto a set of points, so that each polygon is centered on its corresponding point - any ideas? In MapInfo I can just manually edit the co-ordinates of the center, but ...
0
votes
1answer
84 views

Is there a way to create pixel centroids inside polygons with PostGIS ?

I am trying to find a solution to do the function of the QGIS-tool 'Generate points(pixel centroids) inside polygons' in PostGIS. In the picture below you can see the output. Is there a way to do it ...
1
vote
0answers
51 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 ...
3
votes
1answer
143 views

Spatial Join In PostGIS where centroid of a polygon is inside another polygon

I have two overlapping polygon layers as shown in figure below. One with small grid polygons and another with a large irregular polygon. I want to join them such that attributes of the large polygon ...
2
votes
0answers
91 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 ...
1
vote
1answer
55 views

PostGIS Centroid coordinates (E, N)

I would like to add two new columns in the table (E, N), fill in the coordinates of a polygon centroid using PostGIS SQL code and have the column upadated as soon as I save the edit of a drawing in ...
1
vote
0answers
79 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(...
0
votes
1answer
50 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="...
3
votes
1answer
331 views

Real centroid plugin QGIS3

I am looking to use realcentroid where I'm assuming it puts all points within the polygons rather than the tool in QGIS Vector -> geom -> centroid tool, which in my result some bendier polygons have ...
0
votes
2answers
131 views

Calculate centroids using PyQGIS

I am trying to calculate the centroids of polygons using PyQGIS. When I calculate the centroids with the interface (Vector --> Geometry Tools --> Polygon Centroids) everything works out. However, I ...
2
votes
1answer
304 views

Using Polygon centroids tool - points aren't always inside polygon, can I fix that?

When I use Polygon centroid tool, points aren't always inside polygon, because some polygons have weird shape with holes inside them. I have big amount of polygons and I need to use this tool and I ...
0
votes
0answers
31 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 ...
8
votes
1answer
137 views

Getting dual graph from QGIS?

I have a .shp file, and I need to get the dual graph from this file (that is to say, each polygon centroid should become a vertex, and two vertices are linked if their associated polygons are adjacent)...
1
vote
2answers
456 views

Centroids in QGIS 3.0 not using Python? [duplicate]

How do you calculate centroids in QGIS 3.0? In previous versions, there was an easily accessible tool in the vector geometry toolbar, but it is gone. I've seen ways to do it with Python on Stack ...
2
votes
2answers
135 views

How to select centroids within buffer range?

I want to select the red circled centroids. These centroids must be within the blue buffer.
1
vote
0answers
182 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 ...
1
vote
1answer
345 views

How to obtain geometric centroid for DataFrame where each row is a unique vertex?

I have looked at several related questions, but have not found a working solution beginning with a DataFrame of vertices for multiple polygons. There are existing solutions that address shapefiles ...
0
votes
1answer
70 views

Generating polygons from centroids with rotation and dimensions [closed]

I found this from @crmackey at Creating rectangles on centroid points in ArcPy? It is exactly what I was looking for and works great, however I need to add rotation to the polygons. How could I add ...
4
votes
1answer
94 views

Distance to Multiple Neighboring Sectors

I have two shapefiles - one of neighborhood polygons and another of centroids within those neighborhoods: For each centroid I would like to calculate: Distance to the next closest neighborhood (and ...
1
vote
1answer
866 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(...
1
vote
0answers
79 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 ...
1
vote
1answer
64 views

Calculate nearest town for 2900 lot centroids

I have 16 town point shapefiles. I have a layer of 2900 centroids for lots. I need to determine the nearest town for each of the centroids. The option I came up with is to Split by Attribute by ...
2
votes
1answer
239 views

How to use ST_Contains() with ST_ClusterWithin()

I need to write a spatial query which will return centroids of clusters which are within a bounding box or polygon. The query I have now is: SELECT ST_NumGeometries(unnest(ST_ClusterWithin(...
2
votes
2answers
306 views

QGIS weighted centroid of polygons with weights from raster layer

I am a total novice with GIS and using QGIS as that is what is available to me. I have a vector layer of polygons (about 3500) and a raster layer of light intensity. What I'm working with looks like ...
6
votes
2answers
629 views

Сalculate polygon centroids with 'point on surface' function

I want to calculate centroid coordinates X_center and Y_center for every polygon in layer so that in case polygon has not simple shape (e.g. with holes or like in the picture below) centroid will be ...
3
votes
1answer
92 views

mean coordinates and measurement of distances

I am trying to find a location that minimises the total distance to a series of points, and compare it with the distance to an existing location. I used the QGIS tool mean coordinate(s) to calculate ...
1
vote
1answer
249 views

Aggregate by date-time and compute a centroid as an output?

(I would prefer using R if possible) I have a table with coordinates (in latitude, longitude), time information (YYYY-mm-dd HH:MM:SS) and ID information (example provided). I sometimes have multiple ...
0
votes
1answer
790 views

Compute centroids and buffers for multiple polygons in Google Earth Engine

I have a dataset with many polygons that come from a fusion table ('xxxxx'): var polygons = ee.FeatureCollection('xxxxx'); I want to compute the centroid and a buffer of Z meters for each of these ...
2
votes
1answer
93 views

Controling polygons centroids alignment in QGIS?

I am using Polygons Centroids feature in QGIS and it does an amazing job. My goal though is to set the points on the left side of the polygon and not in the center. Is there a way to control the ...
3
votes
1answer
1k views

Bind polygon centroid to polygon attribute data

I am trying to bind a dataframe containing polygon centroids to the polygon attributes. Here's what I've done so far to create the centroids: library(rgdal) library(PBSmapping) library(maptools) ...
1
vote
0answers
98 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,...
0
votes
1answer
1k views

Plot points by longitude and latitude on a map created by centroids

I'm searching for a way to plot some points for which I have the longitude and latitude (using Google Maps API) on a map created with centroids. I succeeded to do it by using functions such as ...
13
votes
2answers
2k views

Centroid coordinates for odd-shaped polygons

I have a problem in computing the centroids of certain polygons in QGIS (via the geometry tools): for certain polygons - with a strange and rather long shape - the centroids computed are off the ...
4
votes
2answers
1k views

Getting centroids for multiple lines?

Is there a possibility to get the centroid of each line? When using VECTOR ==> ANALYSIS TOOLS ==> MEAN COORDINATS I always get a centroid of the whole lines. What I need is the centroid of each line ...
2
votes
1answer
91 views

Centroids highest density areas

Is there a way to find the centroids of highest density areas in the density raster (red areas in the figure) created with the Optimized Hot Spot Analysis in ArcMap10.3. Theoretically I think I should ...
1
vote
1answer
387 views

Generate Tessellation & Centroids using ArcGIS Pro?

I first generated a square tessellation (using Generate Tesselation) using the following: arcpy.GenerateTessellation_management(Output_Feature_Class="/File Location Removed", Extent="371935.1483 ...
0
votes
1answer
302 views

Calculating centroids in decimal degrees using ArcPy without reprojecting vector data?

I have vector data not in geographical coordinate system (i.e. not in WGS 1984). How to calculate object's centroids using arcpy without reprojecting the data itself? I have tried to do this but it ...
4
votes
0answers
580 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) # ...
3
votes
1answer
84 views

Ordering polygon centroid points in a row(s)

I have a image from a field, where I converted the plants to polygons, and then I found the centroid of those polygons (attached image). The numbers displaying on the image are the FID numbers. I am ...
2
votes
1answer
135 views

Calculating center of custom tiles?

Problem How to calculate center of each custom tile as a point (x,y) or (x,y,z) where z is zoom level, in a projection: EPSG:3857? What I know about the tiles Originally they are served as TMS They ...
2
votes
1answer
163 views

Find centroid of disolved buffer zones

I've put a 20m buffer on all of my points (144,000 observations), dissolving all overlapping buffers. How do I then take the centroid of the dissolved buffers in QGIS? I want to reduce all ...