Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ckanext/geodatagov/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ def translate_spatial(old_spatial):
min, max = geometry
params = {"minx": min[0], "miny": min[1], "maxx": max[0], "maxy": max[1]}
new_spatial = geojson_tpl.format(**params)
# assert it is valid JSON
json.loads(new_spatial)
return new_spatial
else:
# If we already have a good geometry, use it
Expand Down
10 changes: 10 additions & 0 deletions ckanext/geodatagov/tests/test_update_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@ def test_translations(self):
assert translate_spatial('not exists') is None
assert translate_spatial('1.0,3.0') is None
assert translate_spatial('US, Virginia, Fairfax, Reston') is None
assert translate_spatial(
'["CARTESIAN", [{"WestBoundingCoordinate": -69.864167, "NorthBoundingCoordinate": 70.843889, '
'"EastBoundingCoordinate": -69.864167, "SouthBoundingCoordinate": 70.843889}, '
'{"WestBoundingCoordinate": -68.156667, "NorthBoundingCoordinate": 70.313889, '
'"EastBoundingCoordinate": -68.156667, "SouthBoundingCoordinate": 70.313889}, '
'{"WestBoundingCoordinate": -70.52, "NorthBoundingCoordinate": 69.846667, '
'"EastBoundingCoordinate": -70.52, "SouthBoundingCoordinate": 69.846667}, '
'{"WestBoundingCoordinate": -70.52007, "NorthBoundingCoordinate": 70.843889, '
'"EastBoundingCoordinate": -68.15668, "SouthBoundingCoordinate": 69.84673}]]'
) is None
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="ckanext-geodatagov",
version="0.3.5",
version="0.3.6",
description="",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
Loading