function (doc) {
if (doc.geometry) {
emit(doc.geometry, null);
}
}
I’ve verified that it’s caused by the geometry being too large. I’ve generated Polygons (squares) with an increasing number of points, and beyond a certain amount, the queries fail.
Is there a documented limit on how big the geometry can be for spatial queries? Is there a workaround, or at least the ability to ignore geometries that are too large, instead of failing completely?
Quick update. I can reproduce it. There should be an error in the mapreduce.log. Something like:
[mapreduce_errors:error,2015-04-09T23:31:17.597,couchdb_n_0@127.0.0.1:<0.1684.0>:couch_set_view_updater:-do_maps/3-fun-0-:783]Bucket `default`, main group `_design/dev_foo`, error mapping document `doc-428` for view `baz`: too long key emitted: 4099 bytes
It of course isn’t right as it should evaluate the size of the key after the geometry was processed. Let’s hope it’s easy to do
A workaround for the current version would be that you calculate the bounding box before you emit it and use it as a key. Though you then won’t have the original geometry in the result expect if you emit it as a key.