Repository: corteva/rioxarray

Issue:
BUG: `rio.reproject()` does not return 'x' and 'y' coordinates (GCPS)
I also find it surprising that `rio.reproject()` does not return 'x' and 'y' coordinates, I find myself doing the following and wondering if I've overlooked an easier way or the rationale for not doing this by default:

```python
from rioxarray.rioxarray import affine_to_coords
coords = affine_to_coords(daG.rio.transform(), daG.rio.width, daG.rio.height)
daG = daG.assign_coords(coords)
```

_Originally posted by @scottyhq in https://github.com/corteva/rioxarray/issues/515#issuecomment-1105879890_

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/corteva/rioxarray/pull/518?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva) Report
> Merging [#518](https://codecov.io/gh/corteva/rioxarray/pull/518?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva) (ec07342) into [master](https://codecov.io/gh/corteva/rioxarray/commit/7344ea34d7525a6be89fab7c020855108b3ea565?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva) (7344ea3) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##           master     #518   +/-   ##
=======================================
  Coverage   96.22%   96.22%           
=======================================
  Files          13       13           
  Lines        1590     1591    +1     
=======================================
+ Hits         1530     1531    +1     
  Misses         60       60           
```


| [Impacted Files](https://codecov.io/gh/corteva/rioxarray/pull/518?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva) | Coverage Δ | |
|---|---|---|
| [rioxarray/raster\_array.py](https://codecov.io/gh/corteva/rioxarray/pull/518/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva#diff-cmlveGFycmF5L3Jhc3Rlcl9hcnJheS5weQ==) | `97.16% <100.00%> (+<0.01%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/corteva/rioxarray/pull/518?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/corteva/rioxarray/pull/518?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva). Last update [7344ea3...ec07342](https://codecov.io/gh/corteva/rioxarray/pull/518?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva).

snowman2: Thanks @justingruca :+1: 

Patch:
diff --git a/docs/history.rst b/docs/history.rst
index 102f0f3c..8d23fd43 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -4,6 +4,7 @@ History
 Latest
 ------
 - BUG: Fix WarpedVRT param cache in :func:`rioxarray.open_rasterio` (issue #515)
+- BUG: Always generate coordinates in `rio.reproject` when GCPS|RPCS present (issue #517)
 
 0.11.0
 ------
diff --git a/rioxarray/raster_array.py b/rioxarray/raster_array.py
index 29cc8af6..db71fa27 100644
--- a/rioxarray/raster_array.py
+++ b/rioxarray/raster_array.py
@@ -438,7 +438,8 @@ class RasterArray(XRasterBase):
         if gcps:
             kwargs.setdefault("gcps", gcps)
 
-        src_affine = None if "gcps" in kwargs else self.transform(recalc=True)
+        gcps_or_rpcs = "gcps" in kwargs or "rpcs" in kwargs
+        src_affine = None if gcps_or_rpcs else self.transform(recalc=True)
         if transform is None:
             dst_affine, dst_width, dst_height = _make_dst_affine(
                 self._obj, self.crs, dst_crs, resolution, shape, **kwargs
@@ -480,7 +481,13 @@ class RasterArray(XRasterBase):
         xda = xarray.DataArray(
             name=self._obj.name,
             data=dst_data,
-            coords=_make_coords(self._obj, dst_affine, dst_width, dst_height),
+            coords=_make_coords(
+                src_data_array=self._obj,
+                dst_affine=dst_affine,
+                dst_width=dst_width,
+                dst_height=dst_height,
+                force_generate=gcps_or_rpcs,
+            ),
             dims=tuple(dst_dims),
             attrs=new_attrs,
         )


Test patch:
diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index 31923326..cbc7c1bf 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -1034,6 +1034,8 @@ def test_reproject__gcps_kwargs(tmp_path):
             2818720.0,
         )
     )
+    assert (rds.coords["x"].values > 11000).all()
+    assert (rds.coords["y"].values > 281700).all()
 
 
 def test_reproject_match(modis_reproject_match):