miguelbgouveia
miguelbgouveia

Reputation: 2973

Ckan spatial queries using solr doesn't work

I install the ckanext-spatial into a working ckan instance running in a debian8 virtual machine in virtualbox.

I create some example data with geoJson information and test the spatial query and everything was working ok.

A day after, I initialize the debian virtual machine and try the spatial query but they return no results. Analyzing the problem I found that the solr data was not include the spatial parameters like bbox_area, maxx, maxy, minx and miny. In the solr logs I can see the queries that the system is using and they include the spatial parameters like this:

...max(0, sub(min(32.9694995329, maxy)))...

It seems that the problem is in the data in the solr service that not include the spatial information.

I try creating new data sets with geojson information in ckan but again it results in data in the solr system without the spatial information. I also reinstall postGIS but the problem maintains.

Finally I run the paster command:

paster --plugin=ckan search-index rebuild --config=/etc/ckan/default/development.ini

In order to reindex solr data and I get the following error:

ERROR [ckanext.spatial.plugin] solr backend only support bboxes, ignoring geometry { "type": "Polygon", "coordinates": [ [ [ -17.3035, 32.8807 ], [ -16.6635, 32.8807 ], [ -16.6635, 32.6075 ], [ -17.3035, 32.6075 ] ] ] }

How can I resolve this problem? Why the process of sending spatial information to the solr system doesn't work? There are some formatting problems with my spatial data?

Upvotes: 1

Views: 382

Answers (1)

miguelbgouveia
miguelbgouveia

Reputation: 2973

The problem is that I was defining the geojson information wrong. I was only defining 4 points for the Polygon when is necessary 5 points.

Wrong:

{ "type": "Polygon", 
  "coordinates": [ [ [ -17.3035, 32.8807 ], 
                     [ -16.6635, 32.8807 ], 
                     [ -16.6635, 32.6075 ], 
                     [ -17.3035, 32.6075 ] 
                 ] ] 
} 

Ok:

{ "type": "Polygon", 
  "coordinates": [ [ [ -17.3035, 32.8807 ], 
                     [ -16.6635, 32.8807 ], 
                     [ -16.6635, 32.6075 ], 
                     [ -17.3035, 32.6075 ],
                     [ -17.3035, 32.8807 ]
                 ] ] 
} 

I just don't understand how can this ever work if I was always define the Polygons with 4 points!

Upvotes: 2

Related Questions