Is it possible to take a polygon shape and shift it to a different location? My use case is to duplicate a polygon and 'center' the new object on a point. For example, if I wanted to compare the size of California and Texas, I would create a new California with it's centroid located at Texas' centroid.
Solved! Go to Solution.
Hi @abrahamlauer, if you want to shift the location of a polygon you need to first calculate the X and Y difference from both centroids based on their lat, lon and then apply this shift on each point that creates the polygon you want to move. Here is how I did it.
@gabrielvilella this is fine if you want an overview of what a rough recreation of the polygon will look like overlayed in that position. However, a word of warning here that if we dive into the size of the recreated polygon vs the original with the spatial info tool, we can see that rebuilding the shape this way isn't actually accurate and in fact increases the size by a decent amount, so not great if a detailed comparison is needed:
@Feilpe_Rebeir0 - No, the use case is to create a new polygon at a different location, not to compare the areas of two different polygons. I could have worded my example better.
@abrahamlauer understood! So the workflow provided by gabriel with some modification that correct the error pointed by datanath probably is the best way to go
@gabrielvilella - Phenomenal. I was so engrossed in moving the polygon that I never considered breaking it into points. Thank you!
@DataNath - Good callout. The size difference is due to performing straight addition on the lat/lons rather than applying trig functions to account for the curvature of the earth. Note how moving the object south increases the size and moving it north decreases the size.
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |