Skip to content

Commit a3cde3f

Browse files
committed
refactor: Simplify coordinate transformation documentation and logic in ExportGeoJSONAnnotations
1 parent c31957f commit a3cde3f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

coralnet_toolbox/IO/QtExportGeoJSONAnnotations.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,10 @@ def convert_annotation_to_polygon(self, annotation):
382382
return []
383383

384384
def transform_coordinates(self, coords, src_transform, src_crs):
385-
"""
386-
Transform pixel coordinates to Geographic coordinates.
387-
1. Apply Affine transform (Pixels -> Image CRS)
388-
2. If WGS84 requested, Apply Warp (Image CRS -> EPSG:4326)
389-
"""
385+
"""Transform coordinates from pixel space to geographic coordinates."""
386+
if not src_crs and self.pixel_checkbox.isChecked():
387+
return coords
388+
390389
# 1. Pixels to Source CRS
391390
projected_coords = []
392391
for x, y in coords:
@@ -410,9 +409,6 @@ def transform_coordinates(self, coords, src_transform, src_crs):
410409
except Exception as e:
411410
raise ValueError(f"Reprojection failed: {str(e)}")
412411

413-
if not src_crs and self.pixel_checkbox.isChecked():
414-
return coords
415-
416412
return projected_coords
417413

418414
def create_geojson_feature(self, annotation, image_path, transform, crs):

0 commit comments

Comments
 (0)