Skip to content

Commit

Permalink
Added note to readme and small test for bbox_auto
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottEAdams committed Sep 11, 2013
1 parent caa6653 commit dafee34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Options are :
* **precision** : number of digit after comma
* **geometry_field** : name of geometry field (*default*: ``geom``)
* **srid** : projection (*default*: 4326, for WGS84)
* **bbox** : Allows you to set your own bounding box on feature collection level
* **bbox_auto** : True/False (default false). Will automatically generate a bounding box on a per feature level.


GeoJSON template filter
Expand Down
6 changes: 6 additions & 0 deletions djgeojson/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ class Empty(models.Model):
features = serializer.serialize([Empty()], crs=False)
self.assertEqual(features, '{"type": "FeatureCollection", "features": [{"geometry": null, "type": "Feature", "properties": {"id": null}}]}')

def test_bbox_auto(self):
serializer = Serializer()
features = serializer.serialize([{'geom': 'SRID=4326;LINESTRING (1 1, 3 3)'}], bbox_auto=True, crs=False)
self.assertEqual(features, '{"type": "FeatureCollection", "features": [{"geometry": {"type": "LineString", "coordinates": [[1.0, 1.0], [3.0, 3.0]]}, "type": "Feature", "properties": {}, "bbox": [1.0, 1.0, 3.0, 3.0]}]}')



class ForeignKeyTest(TestCase):
def setUp(self):
Expand Down

0 comments on commit dafee34

Please sign in to comment.