from django.contrib.gis.gdal import OGRGeometry point = OGRGeometry.from_point((37.7328, -122.5031)) print(point)
POINT (37.7328 -122.5031)
from django.contrib.gis.gdal import OGRGeometry polygon = OGRGeometry.from_bbox((37.7528, -122.4671, 37.7078, -122.4329)) print(polygon)
POLYGON ((37.7078 -122.4671, 37.7078 -122.4329, 37.7528 -122.4329, 37.7528 -122.4671, 37.7078 -122.4671))
from django.contrib.gis.gdal import OGRGeometry from myapp.models import MyModel point = OGRGeometry.from_point((37.7328, -122.5031)) my_query = MyModel.objects.filter(point_geom__contains=point)Here, we are using the `filter()` method to query the `MyModel` table and retrieve records where the `point_geom` field contains the specified `point` object. Overall, django.contrib.gis.gdal library provides powerful tools for working with geospatial data types and can be used to solve complex spatial analysis problems.