The base Geometry field -- maps to the OpenGIS Specification Geometry type.
| 224 | |
| 225 | |
| 226 | class GeometryField(BaseSpatialField): |
| 227 | """ |
| 228 | The base Geometry field -- maps to the OpenGIS Specification Geometry type. |
| 229 | """ |
| 230 | |
| 231 | description = _( |
| 232 | "The base Geometry field — maps to the OpenGIS Specification Geometry type." |
| 233 | ) |
| 234 | form_class = forms.GeometryField |
| 235 | # The OpenGIS Geometry name. |
| 236 | geom_type = "GEOMETRY" |
| 237 | geom_class = None |
| 238 | |
| 239 | def __init__( |
| 240 | self, |
| 241 | verbose_name=None, |
| 242 | dim=2, |
| 243 | geography=False, |
| 244 | *, |
| 245 | extent=(-180.0, -90.0, 180.0, 90.0), |
| 246 | tolerance=0.05, |
| 247 | **kwargs, |
| 248 | ): |
| 249 | """ |
| 250 | The initialization function for geometry fields. In addition to the |
| 251 | parameters from BaseSpatialField, it takes the following as keyword |
| 252 | arguments: |
| 253 | |
| 254 | dim: |
| 255 | The number of dimensions for this geometry. Defaults to 2. |
| 256 | |
| 257 | extent: |
| 258 | Customize the extent, in a 4-tuple of WGS 84 coordinates, for the |
| 259 | geometry field entry in the `USER_SDO_GEOM_METADATA` table. Defaults |
| 260 | to (-180.0, -90.0, 180.0, 90.0). |
| 261 | |
| 262 | tolerance: |
| 263 | Define the tolerance, in meters, to use for the geometry field |
| 264 | entry in the `USER_SDO_GEOM_METADATA` table. Defaults to 0.05. |
| 265 | """ |
| 266 | # Setting the dimension of the geometry field. |
| 267 | self.dim = dim |
| 268 | |
| 269 | # Is this a geography rather than a geometry column? |
| 270 | self.geography = geography |
| 271 | |
| 272 | # Oracle-specific private attributes for creating the entry in |
| 273 | # `USER_SDO_GEOM_METADATA` |
| 274 | self._extent = extent |
| 275 | self._tolerance = tolerance |
| 276 | |
| 277 | super().__init__(verbose_name=verbose_name, **kwargs) |
| 278 | |
| 279 | def deconstruct(self): |
| 280 | name, path, args, kwargs = super().deconstruct() |
| 281 | # Include kwargs if they're not the default values. |
| 282 | if self.dim != 2: |
| 283 | kwargs["dim"] = self.dim |
no outgoing calls