{"__v":0,"_id":"54db69411a14312100313978","category":{"__v":7,"_id":"54fdad6e660db63700c23b82","pages":["55fbef82af72eb0d0007df93","55fbf623e013770d008fcba8","5617bd3a26e3db230054fba4","5617c4a6f8c9632100ac74f5","561ed6fd0a04340d00d8a0b0","562156adf4e0352100cbf268","562a5c846049f20d0032520b"],"project":"54d0fd1d095c470d00d1646d","version":"54d0fd1e095c470d00d16470","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-09T14:25:50.133Z","from_sync":false,"order":2,"slug":"api-reference","title":"API Reference"},"editedParams":true,"editedParams2":true,"project":"54d0fd1d095c470d00d1646d","user":"54db5301eb78f13900cf108b","version":{"__v":20,"_id":"54d0fd1e095c470d00d16470","project":"54d0fd1d095c470d00d1646d","createdAt":"2015-02-03T16:53:50.090Z","releaseDate":"2015-02-03T16:53:50.090Z","categories":["54d0fd1e095c470d00d16471","54d8b5e68934140d00496544","54db6361c6a4d40d0034b8f7","54db638208ea010d00ab1fdd","54db639008ea010d00ab1fde","54db6547c6a4d40d0034b8fd","54db83482092743700ea6ee1","54db84afc6a4d40d0034b93c","54db8805c6a4d40d0034b93f","54db8de9c6a4d40d0034b961","54db931ac6a4d40d0034b96d","54e49219e4365521006fd9ee","54e74fcc652d7c1900cbe737","54e74ffd3c1e111700d05762","54e77e0a523b1b2f00e6f313","54e784affdabe62500fcddcf","54e784fa523b1b2f00e6f319","54e785de8ae8911900cd42c5","54fdad6e660db63700c23b82","54fdff31f7b1202100a25e06"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-11T14:37:53.973Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"[\n  {\n    \"tags\": \"chicago-marketing-company internet-marketing web-design graphic-design\",\n    \"category\": \"Professional\",\n    \"address\": \"305 N Eric Drive Suite E\",\n    \"website\": \"http://www.integraphix.com\",\n    \"location\": \"42.116329,-88.051652\",\n    \"subcategory\": \"Business Services\",\n    \"name\": \"Integraphix Design\",\n    \"postcode\": \"60067\",\n    \"type\": \"Services\",\n    \"country\": \"US\",\n    \"city\": \"Palatine\",\n    \"id\": \"24fd6853-ef01-4273-b286-e13cbbd1bfa3\"\n  },\n  {\n    \"tags\": \"wine restaraunt ipad inventory-management\",\n    \"category\": \"Professional\",\n    \"address\": \"200 Fleet Street Suite 2A\",\n    \"website\": \"http://winepicks.com\",\n    \"location\": \"40.421246,-80.048694\",\n    \"subcategory\": \"Computer Services\",\n    \"name\": \"WinePicks\",\n    \"postcode\": \"15220\",\n    \"type\": \"Services\",\n    \"country\": \"US\",\n    \"city\": \"Pittsburgh\",\n    \"id\": \"ef0b8579-2ae8-4ba8-b089-ef87e1f94075\"\n  },\n  {\n    \"tags\": \"facebook social-commerce ecommerce word-of-mouth-marketing\",\n    \"category\": \"Professional\",\n    \"address\": \"1325 remington Rd\",\n    \"website\": \"http://www.piosocial.com\",\n    \"location\": \"42.053227,-88.051541\",\n    \"subcategory\": \"Advertising\",\n    \"name\": \"PIO Social\",\n    \"postcode\": \"60173\",\n    \"type\": \"Services\",\n    \"country\": \"US\",\n    \"city\": \"Schaumburg\",\n    \"id\": \"3b7e0ecd-8a3a-4814-97ad-f9e72d95de83\"\n  }\n]","language":"json","status":200}]},"settings":"","auth":"never","params":[{"_id":"54db69411a14312100313983","ref":"","in":"path","required":true,"desc":"Database name.","default":"","type":"string","name":"database_name"},{"_id":"54db69411a14312100313982","ref":"","in":"path","required":true,"desc":"Collection name.","default":"","type":"string","name":"collection_name"},{"_id":"54db69411a14312100313981","ref":"","in":"body","required":true,"desc":"Your mapkey.","default":"","type":"string","name":"mapkey"},{"_id":"54db69411a14312100313980","ref":"","in":"body","required":true,"desc":"Spatial restriction on GeoJSON format (types supported: Point, LineString or Polygon).","default":"","type":"string","name":"geom"},{"_id":"54db69411a1431210031397f","ref":"","in":"body","required":false,"desc":"Returned fields. If it is not informed, 10 random columns from the collection will be choosed.","default":"","type":"array_string","name":"fields"},{"_id":"54db69411a1431210031397e","ref":"","in":"body","required":false,"desc":"Terms (words) used to full text search. Can not be used together to \"query\" parameter","default":"","type":"array_string","name":"terms"},{"_id":"54db69411a1431210031397d","ref":"","in":"body","required":false,"desc":"Relational filter from ElasticSearch. Can't be used together with \"terms\" parameter","default":"","type":"string","name":"q"},{"_id":"54db69411a1431210031397c","ref":"","in":"body","required":false,"desc":"Number of the recovered page. It must be greater than 1. If the page number is greater than the total number of pages, it is returned to first page. The total number of pages is calculated from the parameter limit (Number of documents / limit)","default":"1","type":"int","name":"page"},{"_id":"54db69411a1431210031397b","ref":"","in":"body","required":false,"desc":"Number of objects recovered per page. It must be greater than 1 and less than 30.","default":"10","type":"int","name":"limit"},{"_id":"54db69411a1431210031397a","ref":"","in":"body","required":false,"desc":"A buffer to expand the area of the geom parameter.","default":"","type":"double","name":"buffer"},{"_id":"54db69411a14312100313979","ref":"","in":"body","required":false,"desc":"Measure used by buffer. Possible values: meter, kilometer, degree.","default":"kilometer","type":"string","name":"measure_buffer"}],"url":"/geosearch/:database_name/:collection_name"},"isReference":false,"order":47,"body":"### Sample Request - Simple search\n\nIn this sample a GeoSearch is done with just the required parameters limiting the result in 3. This is the easiest way to use this feature.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\\\" -d '\\n{\\n  \\\"mapkey\\\": \\\"MAP-KEY\\\",\\n  \\\"limit\\\": \\\"3\\\",\\n  \\\"geom\\\": {\\n    \\\"type\\\": \\\"Polygon\\\",\\n    \\\"coordinates\\\": [\\n      [\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ]\\n      ]\\n    ]\\n  }\\n}'\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Response\n\nBecause no *field* parameter was passed, 10 random attributes were retrieved. The 3 first documents in the area of geom were presented. It is possible to get other 3 documents on rank using the **page** parameter, for example, passing **page** parameter equals 6, the 3 documents retrieved will be the ones in the rank 18, 19 and 20.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"tags\\\": \\\"chicago-marketing-company internet-marketing web-design graphic-design\\\",\\n    \\\"category\\\": \\\"Professional\\\",\\n    \\\"address\\\": \\\"305 N Eric Drive Suite E\\\",\\n    \\\"website\\\": \\\"http://www.integraphix.com\\\",\\n    \\\"location\\\": \\\"42.116329,-88.051652\\\",\\n    \\\"subcategory\\\": \\\"Business Services\\\",\\n    \\\"name\\\": \\\"Integraphix Design\\\",\\n    \\\"postcode\\\": \\\"60067\\\",\\n    \\\"type\\\": \\\"Services\\\",\\n    \\\"country\\\": \\\"US\\\",\\n    \\\"city\\\": \\\"Palatine\\\",\\n    \\\"id\\\": \\\"24fd6853-ef01-4273-b286-e13cbbd1bfa3\\\"\\n  },\\n  {\\n    \\\"tags\\\": \\\"wine restaraunt ipad inventory-management\\\",\\n    \\\"category\\\": \\\"Professional\\\",\\n    \\\"address\\\": \\\"200 Fleet Street Suite 2A\\\",\\n    \\\"website\\\": \\\"http://winepicks.com\\\",\\n    \\\"location\\\": \\\"40.421246,-80.048694\\\",\\n    \\\"subcategory\\\": \\\"Computer Services\\\",\\n    \\\"name\\\": \\\"WinePicks\\\",\\n    \\\"postcode\\\": \\\"15220\\\",\\n    \\\"type\\\": \\\"Services\\\",\\n    \\\"country\\\": \\\"US\\\",\\n    \\\"city\\\": \\\"Pittsburgh\\\",\\n    \\\"id\\\": \\\"ef0b8579-2ae8-4ba8-b089-ef87e1f94075\\\"\\n  },\\n  {\\n    \\\"tags\\\": \\\"facebook social-commerce ecommerce word-of-mouth-marketing\\\",\\n    \\\"category\\\": \\\"Professional\\\",\\n    \\\"address\\\": \\\"1325 remington Rd\\\",\\n    \\\"website\\\": \\\"http://www.piosocial.com\\\",\\n    \\\"location\\\": \\\"42.053227,-88.051541\\\",\\n    \\\"subcategory\\\": \\\"Advertising\\\",\\n    \\\"name\\\": \\\"PIO Social\\\",\\n    \\\"postcode\\\": \\\"60173\\\",\\n    \\\"type\\\": \\\"Services\\\",\\n    \\\"country\\\": \\\"US\\\",\\n    \\\"city\\\": \\\"Schaumburg\\\",\\n    \\\"id\\\": \\\"3b7e0ecd-8a3a-4814-97ad-f9e72d95de83\\\"\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Request - Selecting the returned fields\n\nIn this sample just 3 attributes are selected to be presented and the response is limited to 2.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\\\" -d '\\n{\\n  \\\"mapkey\\\": \\\"MAP-KEY\\\",\\n  \\\"fields\\\": [ \\\"id\\\", \\\"name\\\", \\\"city\\\" ],\\n  \\\"limit\\\": \\\"2\\\",\\n  \\\"geom\\\": {\\n    \\\"type\\\": \\\"Polygon\\\",\\n    \\\"coordinates\\\": [\\n      [\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ]\\n      ]\\n    ]\\n  }\\n}'\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Response\n\nIn the response we can see the three attributes of the two documents in the geom area.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"city\\\": \\\"Cleveland\\\",\\n    \\\"id\\\": \\\"0d6fee8f-ee0c-4f6e-b896-651b5e84c931\\\",\\n    \\\"name\\\": \\\"Ocular Concepts\\\"\\n  },\\n  {\\n    \\\"city\\\": \\\"Cincinnati\\\",\\n    \\\"id\\\": \\\"f23b9161-b913-4acc-bec5-69a02e16f884\\\",\\n    \\\"name\\\": \\\"Megabotix \\\"\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Request - Constraining by terms\n\nIn this sample, two terms were used to restrict the data presented (*computer* or *services*). Just  the documents that has any of terms in some attribute and is in geom area will be retrieved. Also, some attributes were selected and limit was set to 2.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\\\" -d '\\n{\\n  \\\"mapkey\\\": \\\"MAP-KEY\\\",\\n  \\\"fields\\\": [ \\\"id\\\", \\\"name\\\", \\\"subcategory\\\" ],\\n  \\\"terms\\\": [ \\\"computer\\\", \\\"services\\\" ],\\n  \\\"limit\\\": \\\"2\\\",\\n  \\\"geom\\\": {\\n    \\\"type\\\": \\\"Polygon\\\",\\n    \\\"coordinates\\\": [\\n      [\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ]\\n      ]\\n    ]\\n  }\\n}'\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Sample Response\"\n}\n[/block]\n### Sample Response\n\nJust two documents were retrieved due to the **limit** parameter.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"subcategory\\\": \\\"Computer Services\\\",\\n    \\\"name\\\": \\\"PcCareSupport\\\",\\n    \\\"id\\\": \\\"a545d038-a1fc-4212-9185-9c0391dde78c\\\"\\n  },\\n  {\\n    \\\"subcategory\\\": \\\"Computer Services\\\",\\n    \\\"name\\\": \\\"Metadigm Services\\\",\\n    \\\"id\\\": \\\"2ef94b6c-e56a-4ef1-8c87-6a13c974eb5f\\\"\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Request - Constraining by query\n\nIn this sample a query was used to restrict the data presented (*{\"fields\" : [\"id\", \"name\", \"subcategory\"], \"query\": { \"match_phrase\" : {\"subcategory\" : \"Computer Services\"}}}*). Just  the documents that match with the query and are in the geom area will be retrieved. Also, some attributes were selected and the limit was set to 2.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\\\" -d '\\n{\\n  \\\"mapkey\\\": \\\"MAP-KEY\\\",\\n  \\\"fields\\\": [ \\\"id\\\", \\\"name\\\", \\\"subcategory\\\" ],\\n  \\\"query\\\": \\\"{\\\\\\\"fields\\\\\\\" : [\\\\\\\"id\\\\\\\", \\\\\\\"name\\\\\\\", \\\\\\\"subcategory\\\\\\\"], \\\\\\\"query\\\\\\\": { \\\\\\\"match_phrase\\\\\\\" : { \\\\\\\"subcategory\\\\\\\" : \\\\\\\"Computer Services\\\\\\\" } } }\\\",\\n  \\\"limit\\\": \\\"2\\\",\\n  \\\"geom\\\": {\\n    \\\"type\\\": \\\"Polygon\\\",\\n    \\\"coordinates\\\": [\\n      [\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ]\\n      ]\\n    ]\\n  }\\n}'\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Response\n\nJust 2 documents were retrieved due the **limit** parameter.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"subcategory\\\": \\\"Computer Services\\\",\\n    \\\"name\\\": \\\"PcCareSupport\\\",\\n    \\\"id\\\": \\\"a545d038-a1fc-4212-9185-9c0391dde78c\\\"\\n  },\\n  {\\n    \\\"subcategory\\\": \\\"Computer Services\\\",\\n    \\\"name\\\": \\\"Metadigm Services\\\",\\n    \\\"id\\\": \\\"2ef94b6c-e56a-4ef1-8c87-6a13c974eb5f\\\"\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Request - Using as interactive map\n\nIn this sample the GeoSearch feature is used as an interactive map service, that is, click in a point and retrieve the data near this point. For this purpose, a *Point* is passed as the **geom** parameter and a small **buffer** creates a circle around this point and limit the result in 1.\nAlso, some attributes was selected.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\\\" -d '\\n{\\n  \\\"mapkey\\\": \\\"MAP-KEY\\\",\\n  \\\"fields\\\": [ \\\"id\\\", \\\"name\\\", \\\"subcategory\\\", \\\"location\\\"],\\n  \\\"buffer\\\": 0.1,\\n  \\\"limit\\\": \\\"1\\\",\\n  \\\"geom\\\": {\\n      \\\"type\\\": \\\"Point\\\",\\n      \\\"coordinates\\\": [-42.02500600814819,-88.01107756511059]\\n    }\\n}'\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nIt is almost impossible to click exactly at the point where the document is, because the position has many decimals, so using the **buffer** parameter the platform search documents near of area formed by geometry passed in **geom** parameter. Note that the location of the document retrieved is not the same of the point passed in **geom** parameter.\n\n### Sample Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"subcategory\\\": \\\"Computer Services\\\",\\n    \\\"name\\\": \\\"PcCareSupport\\\",\\n    \\\"location\\\": \\\"42.053227,-88.051541\\\",\\n    \\\"id\\\": \\\"a545d038-a1fc-4212-9185-9c0391dde78c\\\"\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Request - Error on use query and terms simultaneously\n\nThis feature does **not** accept use both constraint parameters (*terms* and *query*). This will return an error message.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\\\" -d '\\n{\\n  \\\"mapkey\\\": \\\"MAP-KEY\\\",\\n  \\\"terms\\\": [ \\\"computer\\\", \\\"services\\\" ],\\n  \\\"query\\\": \\\"{ \\\\\\\"fields\\\\\\\" : [\\\\\\\"id\\\\\\\", \\\\\\\"name\\\\\\\", \\\\\\\"subcategory\\\\\\\"], \\\\\\\"query\\\\\\\": { \\\\\\\"match_phrase\\\\\\\" : { \\\\\\\"subcategory\\\\\\\" : \\\\\\\"Computer Services\\\\\\\" } } }\\\",\\n  \\\"geom\\\": {\\n    \\\"type\\\": \\\"Polygon\\\",\\n    \\\"coordinates\\\": [\\n      [\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          47.754097979680026\\n        ],\\n        [\\n          -75.9375,\\n          30.600093873550072\\n        ],\\n        [\\n          -120.9375,\\n          30.600093873550072\\n        ]\\n      ]\\n    ]\\n  }\\n}'\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Sample Response\n\nThe error message returned due to being passed both the *terms* and *query* parameters.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"error\\\" : \\\"The query and terms parameters can not be used simultaneously.\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"panel panel-info teste\\\" >\\n  <div class=\\\"panel-body\\\">\\n    This endpoint requires a MAP key. See <a href=\\\"basic-auth\\\">Basic Authentication</a> for more information about the goGeo authentication system.\\n    <br><br>\\n    If you don't have an access key yet, <a href=\\\"https://console.gogeo.io/signup\\\">sign up</a> and grab yours!\\n  </div>\\n</div>\\n\"\n}\n[/block]\n---\n[block:html]\n{\n  \"html\": \"<div class='div-middle'> \\n  <a href='#'>\\n    Top page &spades; </div>\\n  </a>\\n</div>\\n\\n<div class='div-back'> \\n  <a href='/v1.0/docs/geo-search'>\\n    &laquo; Back \\n  </a>\\n</div>\\n\\n<style>\\n\\t.div-back {\\n  \\tpadding-left: 15px;\\n\\t\\tmargin-top: -20px;\\n  }\\n  \\n  .div-middle {\\n  \\ttext-align: center;\\n\\t\\tmargin-top: -15px;\\n  }\\n  \\n  .div-forward {\\n  \\tfloat: right;\\n    padding-right: 15px;\\n\\t\\tmargin-top: -20px;\\n  }\\n</style>\"\n}\n[/block]","excerpt":"GeoSearch feature offers a way to apply relational and spatial restrictions to your data.","slug":"geosearch-query","type":"post","title":"GeoSearch query"}

postGeoSearch query

GeoSearch feature offers a way to apply relational and spatial restrictions to your data.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

database_name:
required
string
Database name.
collection_name:
required
string
Collection name.

Body Params

mapkey:
required
string
Your mapkey.
geom:
required
string
Spatial restriction on GeoJSON format (types supported: Point, LineString or Polygon).
fields:
array of strings
Returned fields. If it is not informed, 10 random columns from the collection will be choosed.
terms:
array of strings
Terms (words) used to full text search. Can not be used together to "query" parameter
q:
string
Relational filter from ElasticSearch. Can't be used together with "terms" parameter
page:
integer1
Number of the recovered page. It must be greater than 1. If the page number is greater than the total number of pages, it is returned to first page. The total number of pages is calculated from the parameter limit (Number of documents / limit)
limit:
integer10
Number of objects recovered per page. It must be greater than 1 and less than 30.
buffer:
double
A buffer to expand the area of the geom parameter.
measure_buffer:
stringkilometer
Measure used by buffer. Possible values: meter, kilometer, degree.

Result Format


Documentation

### Sample Request - Simple search In this sample a GeoSearch is done with just the required parameters limiting the result in 3. This is the easiest way to use this feature. [block:code] { "codes": [ { "code": "curl -k -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\" -d '\n{\n \"mapkey\": \"MAP-KEY\",\n \"limit\": \"3\",\n \"geom\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -120.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 30.600093873550072\n ]\n ]\n ]\n }\n}'", "language": "json" } ] } [/block] ### Sample Response Because no *field* parameter was passed, 10 random attributes were retrieved. The 3 first documents in the area of geom were presented. It is possible to get other 3 documents on rank using the **page** parameter, for example, passing **page** parameter equals 6, the 3 documents retrieved will be the ones in the rank 18, 19 and 20. [block:code] { "codes": [ { "code": "[\n {\n \"tags\": \"chicago-marketing-company internet-marketing web-design graphic-design\",\n \"category\": \"Professional\",\n \"address\": \"305 N Eric Drive Suite E\",\n \"website\": \"http://www.integraphix.com\",\n \"location\": \"42.116329,-88.051652\",\n \"subcategory\": \"Business Services\",\n \"name\": \"Integraphix Design\",\n \"postcode\": \"60067\",\n \"type\": \"Services\",\n \"country\": \"US\",\n \"city\": \"Palatine\",\n \"id\": \"24fd6853-ef01-4273-b286-e13cbbd1bfa3\"\n },\n {\n \"tags\": \"wine restaraunt ipad inventory-management\",\n \"category\": \"Professional\",\n \"address\": \"200 Fleet Street Suite 2A\",\n \"website\": \"http://winepicks.com\",\n \"location\": \"40.421246,-80.048694\",\n \"subcategory\": \"Computer Services\",\n \"name\": \"WinePicks\",\n \"postcode\": \"15220\",\n \"type\": \"Services\",\n \"country\": \"US\",\n \"city\": \"Pittsburgh\",\n \"id\": \"ef0b8579-2ae8-4ba8-b089-ef87e1f94075\"\n },\n {\n \"tags\": \"facebook social-commerce ecommerce word-of-mouth-marketing\",\n \"category\": \"Professional\",\n \"address\": \"1325 remington Rd\",\n \"website\": \"http://www.piosocial.com\",\n \"location\": \"42.053227,-88.051541\",\n \"subcategory\": \"Advertising\",\n \"name\": \"PIO Social\",\n \"postcode\": \"60173\",\n \"type\": \"Services\",\n \"country\": \"US\",\n \"city\": \"Schaumburg\",\n \"id\": \"3b7e0ecd-8a3a-4814-97ad-f9e72d95de83\"\n }\n]", "language": "json" } ] } [/block] ### Sample Request - Selecting the returned fields In this sample just 3 attributes are selected to be presented and the response is limited to 2. [block:code] { "codes": [ { "code": "curl -k -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\" -d '\n{\n \"mapkey\": \"MAP-KEY\",\n \"fields\": [ \"id\", \"name\", \"city\" ],\n \"limit\": \"2\",\n \"geom\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -120.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 30.600093873550072\n ]\n ]\n ]\n }\n}'", "language": "json" } ] } [/block] ### Sample Response In the response we can see the three attributes of the two documents in the geom area. [block:code] { "codes": [ { "code": "[\n {\n \"city\": \"Cleveland\",\n \"id\": \"0d6fee8f-ee0c-4f6e-b896-651b5e84c931\",\n \"name\": \"Ocular Concepts\"\n },\n {\n \"city\": \"Cincinnati\",\n \"id\": \"f23b9161-b913-4acc-bec5-69a02e16f884\",\n \"name\": \"Megabotix \"\n }\n]", "language": "json" } ] } [/block] ### Sample Request - Constraining by terms In this sample, two terms were used to restrict the data presented (*computer* or *services*). Just the documents that has any of terms in some attribute and is in geom area will be retrieved. Also, some attributes were selected and limit was set to 2. [block:code] { "codes": [ { "code": "curl -k -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\" -d '\n{\n \"mapkey\": \"MAP-KEY\",\n \"fields\": [ \"id\", \"name\", \"subcategory\" ],\n \"terms\": [ \"computer\", \"services\" ],\n \"limit\": \"2\",\n \"geom\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -120.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 30.600093873550072\n ]\n ]\n ]\n }\n}'", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Sample Response" } [/block] ### Sample Response Just two documents were retrieved due to the **limit** parameter. [block:code] { "codes": [ { "code": "[\n {\n \"subcategory\": \"Computer Services\",\n \"name\": \"PcCareSupport\",\n \"id\": \"a545d038-a1fc-4212-9185-9c0391dde78c\"\n },\n {\n \"subcategory\": \"Computer Services\",\n \"name\": \"Metadigm Services\",\n \"id\": \"2ef94b6c-e56a-4ef1-8c87-6a13c974eb5f\"\n }\n]", "language": "json" } ] } [/block] ### Sample Request - Constraining by query In this sample a query was used to restrict the data presented (*{"fields" : ["id", "name", "subcategory"], "query": { "match_phrase" : {"subcategory" : "Computer Services"}}}*). Just the documents that match with the query and are in the geom area will be retrieved. Also, some attributes were selected and the limit was set to 2. [block:code] { "codes": [ { "code": "curl -k -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\" -d '\n{\n \"mapkey\": \"MAP-KEY\",\n \"fields\": [ \"id\", \"name\", \"subcategory\" ],\n \"query\": \"{\\\"fields\\\" : [\\\"id\\\", \\\"name\\\", \\\"subcategory\\\"], \\\"query\\\": { \\\"match_phrase\\\" : { \\\"subcategory\\\" : \\\"Computer Services\\\" } } }\",\n \"limit\": \"2\",\n \"geom\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -120.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 30.600093873550072\n ]\n ]\n ]\n }\n}'", "language": "json" } ] } [/block] ### Sample Response Just 2 documents were retrieved due the **limit** parameter. [block:code] { "codes": [ { "code": "[\n {\n \"subcategory\": \"Computer Services\",\n \"name\": \"PcCareSupport\",\n \"id\": \"a545d038-a1fc-4212-9185-9c0391dde78c\"\n },\n {\n \"subcategory\": \"Computer Services\",\n \"name\": \"Metadigm Services\",\n \"id\": \"2ef94b6c-e56a-4ef1-8c87-6a13c974eb5f\"\n }\n]", "language": "json" } ] } [/block] ### Sample Request - Using as interactive map In this sample the GeoSearch feature is used as an interactive map service, that is, click in a point and retrieve the data near this point. For this purpose, a *Point* is passed as the **geom** parameter and a small **buffer** creates a circle around this point and limit the result in 1. Also, some attributes was selected. [block:code] { "codes": [ { "code": "curl -k -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\" -d '\n{\n \"mapkey\": \"MAP-KEY\",\n \"fields\": [ \"id\", \"name\", \"subcategory\", \"location\"],\n \"buffer\": 0.1,\n \"limit\": \"1\",\n \"geom\": {\n \"type\": \"Point\",\n \"coordinates\": [-42.02500600814819,-88.01107756511059]\n }\n}'", "language": "json" } ] } [/block] It is almost impossible to click exactly at the point where the document is, because the position has many decimals, so using the **buffer** parameter the platform search documents near of area formed by geometry passed in **geom** parameter. Note that the location of the document retrieved is not the same of the point passed in **geom** parameter. ### Sample Response [block:code] { "codes": [ { "code": "[\n {\n \"subcategory\": \"Computer Services\",\n \"name\": \"PcCareSupport\",\n \"location\": \"42.053227,-88.051541\",\n \"id\": \"a545d038-a1fc-4212-9185-9c0391dde78c\"\n }\n]", "language": "json" } ] } [/block] ### Sample Request - Error on use query and terms simultaneously This feature does **not** accept use both constraint parameters (*terms* and *query*). This will return an error message. [block:code] { "codes": [ { "code": "curl -k -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/geosearch/my_database/my_collection\" -d '\n{\n \"mapkey\": \"MAP-KEY\",\n \"terms\": [ \"computer\", \"services\" ],\n \"query\": \"{ \\\"fields\\\" : [\\\"id\\\", \\\"name\\\", \\\"subcategory\\\"], \\\"query\\\": { \\\"match_phrase\\\" : { \\\"subcategory\\\" : \\\"Computer Services\\\" } } }\",\n \"geom\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -120.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 47.754097979680026\n ],\n [\n -75.9375,\n 30.600093873550072\n ],\n [\n -120.9375,\n 30.600093873550072\n ]\n ]\n ]\n }\n}'", "language": "json" } ] } [/block] ### Sample Response The error message returned due to being passed both the *terms* and *query* parameters. [block:code] { "codes": [ { "code": "{\n \"error\" : \"The query and terms parameters can not be used simultaneously.\"\n}", "language": "json" } ] } [/block] [block:html] { "html": "<div class=\"panel panel-info teste\" >\n <div class=\"panel-body\">\n This endpoint requires a MAP key. See <a href=\"basic-auth\">Basic Authentication</a> for more information about the goGeo authentication system.\n <br><br>\n If you don't have an access key yet, <a href=\"https://console.gogeo.io/signup\">sign up</a> and grab yours!\n </div>\n</div>\n" } [/block] --- [block:html] { "html": "<div class='div-middle'> \n <a href='#'>\n Top page &spades; </div>\n </a>\n</div>\n\n<div class='div-back'> \n <a href='/v1.0/docs/geo-search'>\n &laquo; Back \n </a>\n</div>\n\n<style>\n\t.div-back {\n \tpadding-left: 15px;\n\t\tmargin-top: -20px;\n }\n \n .div-middle {\n \ttext-align: center;\n\t\tmargin-top: -15px;\n }\n \n .div-forward {\n \tfloat: right;\n padding-right: 15px;\n\t\tmargin-top: -20px;\n }\n</style>" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}