|
@@ -32,24 +32,27 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
|
|
|
return
|
|
|
|
|
|
pueblo_json = '{"type":"Point","coordinates":[-104.609252,38.255001]}'
|
|
|
- houston_json = (
|
|
|
+ houston_json = json.loads(
|
|
|
'{"type":"Point","crs":{"type":"name","properties":'
|
|
|
'{"name":"EPSG:4326"}},"coordinates":[-95.363151,29.763374]}'
|
|
|
)
|
|
|
- victoria_json = (
|
|
|
+ victoria_json = json.loads(
|
|
|
'{"type":"Point","bbox":[-123.30519600,48.46261100,-123.30519600,48.46261100],'
|
|
|
'"coordinates":[-123.305196,48.462611]}'
|
|
|
)
|
|
|
- chicago_json = (
|
|
|
+ chicago_json = json.loads(
|
|
|
'{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:4326"}},'
|
|
|
'"bbox":[-87.65018,41.85039,-87.65018,41.85039],"coordinates":[-87.65018,41.85039]}'
|
|
|
)
|
|
|
- # MySQL ignores the crs option.
|
|
|
- if mysql:
|
|
|
- houston_json = json.loads(houston_json)
|
|
|
+ # MySQL and Oracle ignore the crs option.
|
|
|
+ if mysql or oracle:
|
|
|
del houston_json['crs']
|
|
|
- chicago_json = json.loads(chicago_json)
|
|
|
del chicago_json['crs']
|
|
|
+ # Oracle ignores also the bbox and precision options.
|
|
|
+ if oracle:
|
|
|
+ del chicago_json['bbox']
|
|
|
+ del victoria_json['bbox']
|
|
|
+ chicago_json['coordinates'] = [-87.650175, 41.850385]
|
|
|
|
|
|
# Precision argument should only be an integer
|
|
|
with self.assertRaises(TypeError):
|
|
@@ -75,10 +78,10 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
|
|
|
# WHERE "geoapp_city"."name" = 'Houston';
|
|
|
# This time we include the bounding box by using the `bbox` keyword.
|
|
|
self.assertJSONEqual(
|
|
|
- victoria_json,
|
|
|
City.objects.annotate(
|
|
|
geojson=functions.AsGeoJSON('point', bbox=True)
|
|
|
- ).get(name='Victoria').geojson
|
|
|
+ ).get(name='Victoria').geojson,
|
|
|
+ victoria_json,
|
|
|
)
|
|
|
|
|
|
# SELECT ST_AsGeoJson("geoapp_city"."point", 5, 3) FROM "geoapp_city"
|