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.

Filter by
Sorted by
Tagged with
10
votes
2answers
3k 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 ...
0
votes
1answer
737 views

How to get, then export as .csv the lat lon centroids from shapefile layer

I have a shapefile with a whole lot of regions on it. I need to find the centroids for each of these regions in the shapefile (as latlons) and export this as a .csv I have done extensive research, ...
8
votes
1answer
160 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
651 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 ...
13
votes
2answers
3k 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 ...
2
votes
2answers
176 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
304 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
482 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 ...
2
votes
2answers
301 views

QGIS polygon centriods - How are they created?

I have been using QGIS to analyses spatial data and I created polygon centroids with the vector geometry tools. Now for a report I have to explain how these centroids were created. I have not been ...
6
votes
2answers
1k views

Identifying cluster centroids using ArcGIS Desktop?

I have a data set of points which are grouped into clusters like so: I'd like to use ArcGIS or Python to create a point layer of the centroids of each cluster but I can't seem to find the right tools....
0
votes
1answer
157 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 ...
5
votes
1answer
110 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 ...
2
votes
3answers
345 views

Buffering points bounded within polygons

I'm using arcGIS 10.1 on an i5 win7 machine with 16g RAM. Not a xeon but have never had big problems even with large datasets. Here's what I'm doing: I have point data representing locations within ...
1
vote
0answers
109 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
600 views

Correct Projection for calculating centroids of a group of points?

I have a long list of points covering all of North America for which I would like to calculate the centroid (by grouping points based on the "Name" column). My approach is to take the WGS84 co-...
9
votes
3answers
9k views

Using Field Calculator in QGIS to update columns with centroid coordinates

In QGIS I would like to update two columns with the centroid easting and northing of my polygons. I am using the field calculator. I have tried using $x and $y but this only seems to work for points. ...
1
vote
1answer
123 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
298 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(...
6
votes
2answers
1k 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
145 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
300 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 ...
7
votes
1answer
384 views

Connecting centroids of lines sharing same intersection in QGIS?

I have this street network of the center of Turin (IT), composed by lines representing streets, and black points representing intersections. I have computed the centroids of each line and displayed ...
44
votes
11answers
97k views

Obtaining up-to-date list of US ZIP Codes with Latitude and Longitude Geocodes? [closed]

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 ...
1
vote
2answers
1k views

How to get a set of all buildings of an OpenStreetMap section in form of single points / Multiple polygons as one point

The objective is to get a set of all buildings of an OpenStreetMap section in form of single points in a shapefile. I downloaded the section from OSM. Imported the section into QGIS (and later ...
0
votes
1answer
1k 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
99 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
90 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 ...
0
votes
0answers
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. ...
3
votes
1answer
2k 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) ...
9
votes
1answer
3k 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 = ...
1
vote
0answers
136 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,...
3
votes
2answers
3k views

Finding coordinates of raster centroid? [duplicate]

How do I find the coordinates of the centre / centroid of a raster? I have tried Zonal Geometry but this does not give me the coordinates. I need to find the centroids of two rasters and create ...
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 ...
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
105 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 ...
0
votes
1answer
456 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 ...
1
vote
1answer
501 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 ...
8
votes
1answer
2k views

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

I have a road 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 resulting lines. This is for roads ...
0
votes
0answers
1k views

How to calculate a population weighted centroid using a raster and shapefile in QGIS?

I am very new to QGIS so please help me with a step by step answer. I have a raster file with population count and a shapefile based on a large population and shapefile. I have successfully created ...
12
votes
1answer
6k 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 ...
5
votes
2answers
916 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 ...
2
votes
1answer
165 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
204 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 ...
37
votes
1answer
34k views

Finding center of geometry of object?

Given a set of 2D or 3D points: How to find the center of geometry of an object? According to the following figure, the center of geometry differs from the center of mass if it is calculated in the ...
2
votes
1answer
880 views

How do I find the centroid of each patch in a raster?

I am trying to get the centroid of a several areas in a large raster data set. The output needs to be raster format, with one pixel representing the center of each patch, in the same resolution as ...
1
vote
1answer
2k views

Getting x,y of polygon in PyQGIS?

Is this the right way to get centroid x and y of a polygon. How do I get centroid x,y, of a polygon layerName = "INTERIOR" layer = QgsMapLayerRegistry.instance().mapLayersByName(layerName)[0] print ...
3
votes
0answers
634 views

Automating calculation of distance between zip code (centroid) and address within one line of data? [closed]

I have a large data set of federal contracts which includes two pieces of spatial data per entry (or line): the zip code in which the project took place and the address of the contractor. I am ...
5
votes
2answers
599 views

QGIS giving 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 ...
1
vote
2answers
137 views

Calculating centroids without adding field to table using ArcPy?

I haven't been able to find any bit of code that does this successfully. I need to delete some fields in a table that I'm modifying using a script I'm writing. I don't want the fields to be left on ...
1
vote
4answers
1k views

Calculating line centroids for 460,000 features in QGIS?

I have a large shapefile of lines, and want to run a mmqgis function (Plugins --> mmqgis --> Modify --> Convert Geometry Type.) The problem is the file is very large and crashes the program. What ...