Skip to content

Commit

Permalink
support queries across anti-meridian line
Browse files Browse the repository at this point in the history
- the envelope query would have values above 180, which is not valid CQL
  • Loading branch information
ebuckley committed Oct 3, 2018
1 parent 8f7d23d commit 5315a69
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ckanext/spatial/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ def _params_for_solr_spatial_field_search(self, bbox, search_params):
+spatial_geom:"Intersects(ENVELOPE({minx}, {miny}, {maxx}, {maxy}))
'''
if bbox['maxx'] > 180:
bbox['maxx'] = -180 + (bbox['maxx'] - 180)

search_params['fq_list'] = search_params.get('fq_list', [])
search_params['fq_list'].append('+spatial_geom:"Intersects(ENVELOPE({minx}, {maxx}, {maxy}, {miny}))"'
.format(minx=bbox['minx'], miny=bbox['miny'], maxx=bbox['maxx'], maxy=bbox['maxy']))
Expand Down

0 comments on commit 5315a69

Please sign in to comment.