0

I wan't to use GeoCouch but it seems I can't get the setup right

setup:

  • Ubuntu 14.10

  • CouchDB 1.6.1, built from source

  • GeoCouch: I couldn't build it from the newvtree branch as indicated in the README, so I tried with the couchdb1.3.x branch as in this gist (+commentary) adapted to 1.6.1

the data comes from here and is passed in a db with this design doc:

{
   "_id": "_design/geotest",
   "_rev": "7-6e930896b441ace3dc1d46ff1dd4f09e",
   "language": "javascript",
   "spatial": {
       "points": "function(doc){ if (doc.latitude && doc.longitude){emit([doc.latitude, doc.longitude], null)}}"
   }
}

curl $DB/_design/geotest/_spatial/points?bbox=46,16,48.2,16.4 gives me an Empty reply from server while this is what appears in the logs:

[Mon, 21 Sep 2015 18:55:12 GMT] [info] [<0.32.0>] Apache CouchDB has started on http://0.0.0.0:5984/
[Mon, 21 Sep 2015 18:57:40 GMT] [info] [<0.304.0>] Opening index for db: geoexample idx: _design/geotest sig: "ad4c001590440653d6856cc41edf57d5"
[Mon, 21 Sep 2015 18:57:40 GMT] [info] [<0.308.0>] Starting index update for db: geoexample idx: _design/geotest
[Mon, 21 Sep 2015 18:57:41 GMT] [error] [emulator] Error in process <0.314.0> with exit value: {function_clause,[{couch_spatial_updater,process_result,[[[3.317463e+01,-1.173577e+02],null]],[{file,"src/geocouch/couch_spatial_updater.erl"},{line,286}]},{couch_spatial_updater,'-merge_results/3-lc$^1/1-1-',1,[{file,"src/geocouch/couch_sp... 


[Mon, 21 Sep 2015 18:57:41 GMT] [error] [<0.120.0>] {error_report,<0.31.0>,
                     {<0.120.0>,crash_report,
                      [[{initial_call,
                         {mochiweb_acceptor,init,
                          ['Argument__1','Argument__2','Argument__3']}},
                        {pid,<0.120.0>},
                        {registered_name,[]},
                        {error_info,
                         {error,badarg,
                          [{erlang,list_to_binary,
                            [[{couch_spatial_updater,process_result,
                               [[[33.174628,-117.357673],null]],
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,286}]},
                              {couch_spatial_updater,
                               '-merge_results/3-lc$^1/1-1-',1,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,189}]},
                              {couch_spatial_updater,
                               '-merge_results/3-lc$^0/1-0-',1,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,189}]},
                              {couch_spatial_updater,merge_results,3,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,189}]},
                              {lists,foldl,3,[{file,"lists.erl"},{line,1261}]},
                              {couch_spatial_updater,merge_results,4,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,180}]},
                              {couch_spatial_updater,write_results,2,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,155}]}]],
                            []},
                           {couch_httpd,error_info,1,
                            [{file,"couch_httpd.erl"},{line,818}]},
                           {couch_httpd,send_error,2,
                            [{file,"couch_httpd.erl"},{line,925}]},
                           {couch_httpd,handle_request_int,5,
                            [{file,"couch_httpd.erl"},{line,353}]},
                           {mochiweb_http,headers,5,
                            [{file,"mochiweb_http.erl"},{line,94}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,239}]}]}},
                        {ancestors,
                         [couch_httpd,couch_secondary_services,
                          couch_server_sup,<0.32.0>]},
                        {messages,[]},
                        {links,[<0.104.0>,#Port<0.2715>]},
                        {dictionary,
                         [{mochiweb_request_qs,[{"bbox","46,16,48.2,16.4"}]},
                          {couch_rewrite_count,0},
                          {mochiweb_request_cookie,[]}]},
                        {trap_exit,false},
                        {status,running},
                        {heap_size,6772},
                        {stack_size,27},
                        {reductions,6588}],
                       []]}}

I tried variations on this setup, but the closest answer I found related to this kind of error invites to install a version of CouchDB that stopped being even available on Apache mirrors, while apparently some people did make GeoCouch work with CouchDB 1.6.1, at least on OS X, so I guess it is just that I'm doing something wrong, but what?!? Thank in advance for any clue

4

1 回答 1

0

如果您使用 couchdb1.3.x 分支,则需要发出 GeoJSON 几何。所以在你的情况下,这将是:

发射({“类型”:“点”,“坐标”:[doc.longitude,doc.latitude]},null);

于 2015-09-23T16:04:36.450 回答