Select to view content in your preferred language

Polygon centroids are not aligned with their own lat/long when created using XY Table to Point despite being in the same coordinate system

558
6
08-01-2025 03:41 PM
Labels (1)
S_Rastegar
Occasional Contributor

I am working with polygons whose centroids I found using Feature to Point to make sure the centroids fall INSIDE the polygon. However, when I transfer the coordinates of the very same centroids into a csv file which has the bulk of my data which I need to map, some (not all) of the mapped centroids do not align with the actual polygon centroids. I've checked and rechecked (and redone the entire process multiple times) to make sure the coordinate systems are the same. They are both GCS WGS 1984. 

S_Rastegar_0-1754087621650.png

For context, the red hollow hexagons and the black dots should align. In some polygons this is the case but in others they're not aligned, and it even falls outside the polygon causing double data for one polygon and none for the adjacent. (If this makes any difference, I'm trying to associate timeseries data to each polygon. Which is why I created a centroid of the polygon, in reality the exact location does not matter, just as long as it falls INSIDE the polygon which is currently not the case with my failed attempts).

What am I doing wrong here?! And what should I do to correct it?

I've tried XY Table to Point from the csv table in my gdb as well as straight Create points from table -->XY Table to Point from the standalone csv table. Both methods yield the same (partially incorrect) results.

I've also tried reprojecting using the Project tool to no avail. Creating a shapefile and using that to map the data didn't work either. 

0 Kudos
6 Replies
JoshuaBixby
MVP Esteemed Contributor

Unless there is a known defect and someone finds a reference to it, responses will be limited unless you can share either sample or representative data that generates the same results.

S_Rastegar
Occasional Contributor

Thanks for the guidance. When I was trying to troubleshoot it with ESRI's AI chatbot (feel free to laugh at my effort here...lol) it did tell me that there are known bugs with placing coordinates on the map using XY table to point. The suggested resolution was to make sure I have the latest version of Pro (which I do).

Here's a sample subset of the data which is giving me issues. I'm working with Hydrologic Unit Code polygons, the centroids of which all appear inside the polygons. However, when I use the very same coordinates for the HUCs in my timeseries data the coordinates do not necessarily align with the centroids. 

P.S. I would save you a step and send you the file with HUC polygon centroids for a subset of my data, but when I attempted a sanity check, the XY table to point from the same csv that was created from the proper centroid coordinates places (some of) them in spots that are not the polygons' centroids. For this reason, I'm also attaching the HUC polygons file. I've checked and rechecked that all is in the same coordinate system of GCS WGS 1984.

I'd much appreciate any insight as to how to go about this.

Thanks

Sara

 

DavidPike
MVP Notable Contributor

I may not be entirely understanding your process of exporting to a csv then re-adding what you already have..  It might be best to state what you want to achieve and someone could advise a better methodology.  

You may have old x and y coordinates in the attribute table which you're mistaking for the actual geometry x and y.

I'd ensure you save as a feature class - not a shapefile, and run the following to get your X and Y
Add Geometry Attributes (Data Management)—ArcGIS Pro | Documentation

If interested, I've also found what I believe to be a slight issue with centroid calculations of polygons in WGS84/GCS.  

Re: Creating multiple non-overlapping buffers - Esri Community
Re: Centroid of polygon stored in a Geographic Coo... - Esri Community

0 Kudos
S_Rastegar
Occasional Contributor

This is very insightful, thank you. The master polygon boundary feature class has a projected coordinate system WGS_1984_Web_Mercator_Auxiliary_Sphere. In creating a subset of the polygon boundary I'd specified the coordinate system to GCS WGS 1984 and it shows as such in the new feature class's properties. But when I went about to mapping the data something just does not add up. The majority of the points are mapped correctly on the centroid, some are offset from the centroid which I'm cool with. But the trouble arises when one polygon ends up with two data points and the adjacent polygon is left with no data. It's a very large dataset so I'm not sure if I'd be able to detect all such instances manually and fix them. 

I essentially need to assign numeric values from a timeseries dataset (csv file) onto their respective locations on the map. Because it's a timeseries, if I were to use a spatial join, it only stores the very first data for any given location. This is why I'd resorted to using the polygon's centroid. This has worked for County polygons seamlessly, but the hydrologic unit code (HUC12) polygons are not as cooperative. 

I've also tried projecting the final data to WGS_1984_Web_Mercator_Auxiliary_Sphere but the output does not look any different at all. 

0 Kudos
BrennanSmith1
Frequent Contributor

Running the Calculate Geometry tool on the polygon with different coordinate systems (or centroid vs. central point) might provide some insight into how the different points are being generated.

0 Kudos
S_Rastegar
Occasional Contributor

I had initially used the calculate geometry tool to find the centroid of the polygons. However, I realized that some of polygon centroids are placed outside of the polygons.  That's when I resorted to using feature to point tool to make sure the points are inside the polygons. 

The results I get from calculate geometry is identical to what XY table to point gives me. Somewhere in the background something doesn't match up but I'm at a loss on how to fix it.  

0 Kudos