MCPcopy
hub / github.com/django/django / AsGeoJSON

Class AsGeoJSON

django/contrib/gis/db/models/functions.py:188–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186
187
188class AsGeoJSON(GeoFunc):
189 output_field = TextField()
190
191 def __init__(self, expression, bbox=False, crs=False, precision=8, **extra):
192 expressions = [expression]
193 if precision is not None:
194 expressions.append(self._handle_param(precision, "precision", int))
195 options = 0
196 if crs and bbox:
197 options = 3
198 elif bbox:
199 options = 1
200 elif crs:
201 options = 2
202 expressions.append(options)
203 super().__init__(*expressions, **extra)
204
205 def as_oracle(self, compiler, connection, **extra_context):
206 source_expressions = self.get_source_expressions()
207 clone = self.copy()
208 clone.set_source_expressions(source_expressions[:1])
209 return super(AsGeoJSON, clone).as_sql(compiler, connection, **extra_context)
210
211
212class AsGML(GeoFunc):

Callers 1

test_geojsonMethod · 0.90

Calls 1

TextFieldClass · 0.90

Tested by 1

test_geojsonMethod · 0.72