from django.contrib.gis.geos import Point from django.contrib.gis.gdal import OGRGeometry # Define a Point object in WGS84 point = Point(-122.419416, 37.774929, srid=4326) # Create an OGRGeometry object from the Point geom = OGRGeometry(point) # Transform the geometry to UTM zone 10N geom.transform(26910) # Print the transformed coordinates print(geom.coords)
from django.contrib.gis.geos import Polygon from django.contrib.gis.gdal import OGRGeometry # Define a Polygon object in UTM zone 10N polygon = Polygon(((100, 100), (200, 100), (200, 200), (100, 200), (100, 100)), srid=26910) # Create an OGRGeometry object from the Polygon geom = OGRGeometry(polygon) # Transform the geometry to WGS84 geom.transform(4326) # Print the transformed coordinates print(geom.coords)This example transforms a Polygon object from UTM zone 10N to WGS84.