# Tagged Questions

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

62 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 ...
789 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 ...
51 views

### Transforming polygons centroids in order to make hexbin map in QGIS? [closed]

I want to make a hexbin map of a particular kind. Hexbins can be used to embrace several points in the same area, like in this example : With this method, a large city can be covered by one hexagon,...
33 views

### Finding the overall weighted centroid from other centroids [closed]

I'm new to python, and I'm trying to find the overall weighted population centroid of a state, using the unweighted centroid from counties. These unweighted centroids already have a popualtion field ("...
51 views

### How to get mean coordinates of features from a point layer?

I have a vector layer containing several points and I would like to generate the mean coordinates of these points, using QGIS only if possible. I'm looking for something similar to centroids, but for ...
43 views

### ST_Distance between ST_Centroid and ST_Y

I'm trying to make a ST_Distance between a ST_Centroid and a ST_Y... But ST_Centroid is a geometry and ST_Y is a float. How can I make this? My query: SELECT ST_Distance(ST_Centroid(ST_Collect(...
57 views

### How to implement a shoelace formula into Python 2.7.8 [closed]

Here's the image of the equation I'm using, it is a shoelace formula. I need help to point out what each variable represents and how to apply this in python script, math is not my strong-suit! From ...
45 views

### Find centroids of rows with Multipoint Geometry

I wish to find the centroid of a set of given points. The points will be rows of my SpatiaLite database and have Multipoint geometry. I checked the SpatiaLite manual but the ST_Centroid function I ...
50 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 ...
33 views

### Averaging multiple values to a single value by common field ID

I want to see how accurate/representative a centroid's datapoint value is compared to averaged multiple datapoints values for the same polygon. There are MANY polygons in the same shapefile. I have a ...
60 views

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

I have a shape file 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, ...
1k views

### How do I get the centroid of line with OGR

Can somebody explain how to get the centroid of a feature with ogr? I have no idea what the centroid() function itself does. >>> linelyr = lineshp.GetLayer() >>> f = linelyr....
47 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 ...
48 views

### Calculating population statistics for postcode centroids

Perhaps this isn't really specifically a GIS question, but I've been using ArcMap to measure distances from the access points of green spaces in Bristol to postcode centroids and would like to use ...
80 views

### How to assign polygon attributes to grid cells using centroids in QGIS?

I am relatively new using QGIS. Unfortunately I can´t figure out the following yet. I have two polygon shapefiles, one is a grid I have created using QGIS 2.12.3-Lyon (Creat graticule) and the ...
55 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 ...
215 views

### How to connect centroids of lines sharing the same intersection in QGIS?

I'm looking for a big help to accomplish the following task: I have this street network of the center of Turin (IT), composed by lines representing streets, and black points representing ...
49 views

### Polygon Torque Map- problem changing polygons to points

I'm trying to alter my data on cartodb map to get maritime emissions over about 20 years- by country. Hence trying get a torque map for polygons, and by changing polygons to points based on a ...
58 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-...
19k views

### How to determine the centroid of polygons?

I have a polygon vector and I want to quickly attain the centroid of this polygon for insertion in a text document. I am working with QGIS. I searched through other questions and although some are ...
70 views

### How to compute the distance from the current polygon centroid to another in QGIS field calculator?

There is layer with polygons. I want to save in new field distance of every polygon's centroid to centroid of one particular polygon. To do this I should write some expression like this: distance(...
60 views

### Positioning labels in center of clipped polygons?

I am using ArcMap 10.1 and would like to label a polygon layer that i have clipped. It appears that the label is set for the geometric center of the polygon that falls outside of the clipping.
4k views

### Polygon Centroid Options and Appropriateness (FeatureToPoint, Labels, etc)?

I've found a couple of other Stack Exchange questions related to this, but they were not satisfying. For example: How does ArcGIS Desktop calculate INSIDE point for Feature to Point? does not tell ...
192 views

### How to find multiple centers of gravity?

Say I have a number of customers in a geographical area, marked "c": Each customer has a Lat/Long. I would like to find x number of points, in the same space, that best serve the customers, ie. ...
173 views

### Calculate The Minimum Distance from Polygon Centroid to Edge

I am looking to calculate the minimum distance from the Center of a polygon (A crescent shaped polygon would have a center inside the polygon) to its edge. I have parcel data and I am trying to ...
152 views

### Obtaining Centroid from Polygon in SQL Server 2008 R2

I have several spatial layers created in QGIS that are held as spatial data in SQL Server 2008 R2. What I want to do is to find the centroid (OS Easting and Northing) of the polygon from the geometry. ...
128 views

### How to select centroid of multiple nearby points with same attribute

This question is very similar to #131823, that is not solved yet. I want to merge several points like bus stops into one single point in the centroid of all selected points. The bus stops have a ...
158 views

### How to automate calculation of distance between a zip code (centroid) and an address within one line of data?

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 ...
624 views

### How exactly is the centroid of polygons calculated?

I would like to know how exactly QGIS Geometry tools -> polygon centroid is calculating the point coordinates. For example does it divide the boarder of the polygon into small points, take two pairs ...
50k views

### Where can I obtain an up-to-date list of US ZIP Codes with Latitude and Longitude Geocodes?

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 ...
26k views

### How to add Lat/long columns to a point layer which is not in WGS84?

I need to extract the Lat/long coordinates of the centroids of districts. My QGIS project SCR and the different layers have all been set on "WGS 84 / UTM zone 18N". I've created the centroids using ...
348 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 = ...
46 views

### Referencing a raster by center coordinate

I'm concerned with producing mosaics from UAV thermal IR video frames. I exported several several frames containing the temperature values in a matrix (.csv). From camera specifications and flight ...
42 views

### Identify polygons greater than n-th percentile and perform further analyses using arcpy

My goal is to identify tracts that are above the 99 percentile of a variable (xvar), to dissolve contiguous tracts by summing a variable (yvar), and to get the coordinates of the centroids (...
311 views

### Coordinates of cities and villages in The Gambia/Senegal

I am looking for sources of geo-referenced data on villages and cities (or all other things there are) in The Gambia (and Senegal if available). One issue with geocoding in rural West Afrika is the ...
281 views

### Zip + 4 Centroids

I have a data set with ZIP +4 codes, and ideally, I'd like to map them (their centroids) as points. I'm not interested in their boundaries (since they're not really geographies anyway). Does anyone ...
160 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 ...
4k views

### How does ArcGIS Desktop calculate INSIDE point for Feature to Point?

Let me back up and say that from what I understand there are two common ways to calculate the centroid of a polygon in ArcGIS Desktop: Using Calculate Geometry on fields within the attribute table ...
37 views

### how to assign the same centroid to polygons grouped by ID , R

I have a SpatialPolygonDataFrame object from a shapefile of different zip codes in New York state, many zip codes are represented by several polygons( for different reasons) so I want to assign the ...
81 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 ...
444 views

### Distance to nearest hub output not correct

In QGIS 2.6, I'm working with two point layers: center of the population per census tract and stores that accept food stamps. I'm using "distance to nearest hub" to calculate nearest food stamp outlet ...
26 views

### Error adding feature to centroids in QGIS [closed]

I want to map forest stands. I have the compartments as centroids and I am trying to add a feature by snapping to them and creating polygons. Each time I click, however, it displays a box titled "...
864 views

### How to move a point shapefile to the centroid of a polygon?

I have this point shapefiles on top of a bounded polygon. I would like to move each point to the centroid of each bounded polygon. Is there an automatic way in ArcGis 10.1 of solving this? Like in the ...
3k 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 ...
2k views

### Combining different geometry types into same feature class?

I've searched the question in this blog. Maybe I don't use the right words but anyway my problem is not present in any post so I'll try to explain my question by opening a new one. I have a polygon ...
183 views

### Why does qgis give 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 ...
752 views

### Arc - how do I find the coordinates of the centroid of a raster?

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