You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Keith Gable <zi...@gmail.com> on 2010/11/18 05:15:18 UTC

GeoCouch weird issue / won't index

I'm trying out GeoCouch right now and I'm coming across something I've
been banging my head on for an hour or two now. I got the examples to
work, but I can't get anything to actually work with my real data.

Here is my spatial function (which is design_doc["spatial"]["geocode"]
in case I have it in the wrong spot, but it DOES run, so I doubt this):

function(doc) {
 if (doc['couchrest-type'] == 'Place') {
  if (doc['geo'] && doc['geo'].length == 2) {
   log('geo on ' + doc['_id'] + ' = ' + doc['geo'][0] + ',' +
doc['geo'][1] );
   emit({ type: "Point", coordinates: [ doc['geo'][0],
doc['geo'][1] ] }, doc['_id']);
  } else {
   log('no geo on ' + doc['_id']);
  }
 }
}

Here is one of the documents:
{
   "_id": "000c02eb-3372-4071-b56d-928f154a3357",
   "_rev": "4-5a1c3fe5d45fd164c6dc4216672d3f58",
   "address": "710 E Ben White Blvd",
   "title": "McDonald's",
   "alcohol": [
   ],
   "postal_code": "78704",
   "url": "www.mcdonalds.com",
   "human_id": null,
   "fare": [
       "Fast Food",
       "American",
       "Burgers"
   ],
   "created_by": "_system",
   "tags": [
   ],
   "bitly_hash": null,
   "atmosphere": null,
   "parking": null,
   "geo": [
       30.218978,
       -97.75523
   ],
   "phone_number": "(512) 707-6838",
   "couchrest-type": "Place",
   "reservations": null,
   "credit_cards_accepted": [
   ],
   "features": [
       "Kid Friendly"
   ],
   "updated_by": "_system",
   "path": [
       "875de01b-edb9-47a4-aabc-7acd97ecde43",
       "ea46e21f-889c-4960-b0eb-3cf65a093a1c",
       "bfff92eb-d35c-4df3-ae8f-01e68c3f8fc6",
       "6a26a5fd-34ef-47de-9d0e-7c4bce509b1b",
       "000c02eb-3372-4071-b56d-928f154a3357"
   ],
   "hours": null,
   "description": null,
   "owned_by": "_system"
}

The correct coordinates get outputted by my log() functions, but it
seems like nothing gets emitted.

This spatial query returns nothing:

http://localhost:5984/macrodeck-development/_design/Place/_spatial/geocode?bbox=0,0,180,90

The log isn't really entirely helpful either since it doesn't seem to
tell me if there was a problem with the GeoJSON. I'm running version
"1.1.0a771dd47-git" (latest version as of a few minutes ago).

Any tips to help diagnose this? Maybe I've just made a stupid mistake
and it's going to be a simple fix... :)

Thanks for any help anyone can provide.


Re: GeoCouch weird issue / won't index

Posted by Keith Gable <zi...@gmail.com>.
On Thu, 2010-11-18 at 12:02 +0100, Volker Mische wrote:
> Hi Keith,
> 
> I only had a quick look, but the bounding box you are requesting seems to be
> outside your data. Try something like bbox=-180,-90,180,90
> 
> Cheers,
>   Volker.
> 

That was it. bbox=-90,-180,90,180 displays everything like it should.


Re: GeoCouch weird issue / won't index

Posted by Volker Mische <vo...@gmail.com>.
Hi Keith,

I only had a quick look, but the bounding box you are requesting seems to be
outside your data. Try something like bbox=-180,-90,180,90

Cheers,
  Volker.

Am 18.11.2010 04:16 schrieb "Keith Gable" <zi...@gmail.com>:

I'm trying out GeoCouch right now and I'm coming across something I've
been banging my head on for an hour or two now. I got the examples to
work, but I can't get anything to actually work with my real data.

Here is my spatial function (which is design_doc["spatial"]["geocode"]
in case I have it in the wrong spot, but it DOES run, so I doubt this):

function(doc) {
 if (doc['couchrest-type'] == 'Place') {
 if (doc['geo'] && doc['geo'].length == 2) {
  log('geo on ' + doc['_id'] + ' = ' + doc['geo'][0] + ',' +
doc['geo'][1] );
  emit({ type: "Point", coordinates: [ doc['geo'][0],
doc['geo'][1] ] }, doc['_id']);
 } else {
  log('no geo on ' + doc['_id']);
 }
 }
}

Here is one of the documents:
{
  "_id": "000c02eb-3372-4071-b56d-928f154a3357",
  "_rev": "4-5a1c3fe5d45fd164c6dc4216672d3f58",
  "address": "710 E Ben White Blvd",
  "title": "McDonald's",
  "alcohol": [
  ],
  "postal_code": "78704",
  "url": "www.mcdonalds.com",
  "human_id": null,
  "fare": [
      "Fast Food",
      "American",
      "Burgers"
  ],
  "created_by": "_system",
  "tags": [
  ],
  "bitly_hash": null,
  "atmosphere": null,
  "parking": null,
  "geo": [
      30.218978,
      -97.75523
  ],
  "phone_number": "(512) 707-6838",
  "couchrest-type": "Place",
  "reservations": null,
  "credit_cards_accepted": [
  ],
  "features": [
      "Kid Friendly"
  ],
  "updated_by": "_system",
  "path": [
      "875de01b-edb9-47a4-aabc-7acd97ecde43",
      "ea46e21f-889c-4960-b0eb-3cf65a093a1c",
      "bfff92eb-d35c-4df3-ae8f-01e68c3f8fc6",
      "6a26a5fd-34ef-47de-9d0e-7c4bce509b1b",
      "000c02eb-3372-4071-b56d-928f154a3357"
  ],
  "hours": null,
  "description": null,
  "owned_by": "_system"
}

The correct coordinates get outputted by my log() functions, but it
seems like nothing gets emitted.

This spatial query returns nothing:

http://localhost:5984/macrodeck-development/_design/Place/_spatial/geocode?bbox=0,0,180,90

The log isn't really entirely helpful either since it doesn't seem to
tell me if there was a problem with the GeoJSON. I'm running version
"1.1.0a771dd47-git" (latest version as of a few minutes ago).

Any tips to help diagnose this? Maybe I've just made a stupid mistake
and it's going to be a simple fix... :)

Thanks for any help anyone can provide.