{"__v":42,"_id":"54fdff6bf7b1202100a25e07","category":{"__v":12,"_id":"54fdff31f7b1202100a25e06","pages":["54fdff6bf7b1202100a25e07","54fdff85f7b1202100a25e09","54fdffa1f7b1202100a25e0b","54fdffc25de33c2d0031127a","54fdffe5f7b1202100a25e0e","550199dc0459bd3700770d87","5501d14df2ef1e0d003116ba","5501d1e70459bd3700770e1c","5501d1f4f2ef1e0d003116bd","5501d20f0459bd3700770e1e","5501d2220459bd3700770e20","5501ecbaf2ef1e0d0031171d"],"project":"54d0fd1d095c470d00d1646d","version":"54d0fd1e095c470d00d16470","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-09T20:14:41.719Z","from_sync":false,"order":1,"slug":"tutorials","title":"Tutorials"},"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-03-09T20:15:39.132Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":10,"body":"The GeoSearch feature offers a way to apply simultaneously relational and spatial restrictions to your data. This tutorial shows how to use the GeoSearch features in a traditional way, and how to use it to provide new behavior to your applications:\n\n1. [Creating a Simple Geosearch App](/v1.0/docs/using-geoservices#creating-a-simple-geosearch-app);\n2. [Geosearch on a Map](/v1.0/docs/using-geoservices#geosearch-on-a-map). \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Creating a Simple Geosearch App\"\n}\n[/block]\nGeosearch is a feature for retrieving data in some region. Moreover is possible filter the data inside the region. \n\nThis filter can be done with the desired value (as full text search - which is much easier than learn how to do a relational query) or with [ElasticSearch](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) query. This service does not retrieve map image, but the data information. To do a geosearch you will use the [[geosearch](doc:geo-search)](doc:geo-search) endpoint. \n\nWe will use a collection with **2 million points** throughout Brazil to illustrate this feature.\n[block:html]\n{\n  \"html\": \"<div class=\\\"panel panel-default\\\">\\n  <div class=\\\"panel-body\\\">\\n    <iframe width=\\\"100%\\\" height=\\\"460px\\\" frameBorder=\\\"0\\\" seamless=\\\"seamless\\\" scrolling=\\\"no\\\" src=\\\"http://demos.gogeo.io/tutorials/geosearch-sample/\\\"></iframe>\\n  </div>\\n</div>\"\n}\n[/block]\n1. A spatial filter is applied on these data;\n 2. The data initially loaded into sample application results;\n 3. You can use the text field to aplly some filter (full text search).\n[block:html]\n{\n  \"html\": \"<a href=\\\"http://cssdeck.com/labs/njocjbla\\\" target=\\\"_blank\\\">LET'S EXPLORE AND UNDERSTAND THE CODE? CLICK HERE!</a>\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Geosearch on a Map\"\n}\n[/block]\nGeosearch, as said on [Creating a Simple Geosearch App](doc:creating-a-sample-geosearch-app) tutorial, just retrieves the a JSON with information data. \n\n##But how to use this on my map? \n\nIn the next example we explore this! We will use a collection with 2 million points throughout Brazil to illustrate this feature. \n\nTo do this we apply two (2) **goGeo** features: \n * *Map Rendering* with spatial and relational filter;\n * *Geosearch* using the same filters.\n[block:html]\n{\n  \"html\": \"<div class=\\\"panel panel-default\\\">\\n  <div class=\\\"panel-body\\\">\\n    <iframe width=\\\"100%\\\" height=\\\"520px\\\" frameBorder=\\\"0\\\" seamless=\\\"seamless\\\" scrolling=\\\"no\\\" src=\\\"http://demos.gogeo.io/tutorials/geosearch\\\"></iframe>\\n  </div>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<a href=\\\"http://cssdeck.com/labs/joiyhts4\\\" target=\\\"_blank\\\">LET'S EXPLORE AND UNDERSTAND THE CODE? CLICK HERE!</a>\"\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/using-geoaggregation'>\\n    &laquo; Back \\n  </a>\\n</div>\\n\\n<div class='div-forward'> \\n  <a href='/v1.0/docs/interactive-maps'>\\n    Next &raquo; </div>\\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":"Apply relational and spatial restrictions simultaneously.","slug":"using-geoservices","type":"basic","title":"Using geoSearch"}

Using geoSearch

Apply relational and spatial restrictions simultaneously.

The GeoSearch feature offers a way to apply simultaneously relational and spatial restrictions to your data. This tutorial shows how to use the GeoSearch features in a traditional way, and how to use it to provide new behavior to your applications: 1. [Creating a Simple Geosearch App](/v1.0/docs/using-geoservices#creating-a-simple-geosearch-app); 2. [Geosearch on a Map](/v1.0/docs/using-geoservices#geosearch-on-a-map). [block:api-header] { "type": "basic", "title": "Creating a Simple Geosearch App" } [/block] Geosearch is a feature for retrieving data in some region. Moreover is possible filter the data inside the region. This filter can be done with the desired value (as full text search - which is much easier than learn how to do a relational query) or with [ElasticSearch](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) query. This service does not retrieve map image, but the data information. To do a geosearch you will use the [[geosearch](doc:geo-search)](doc:geo-search) endpoint. We will use a collection with **2 million points** throughout Brazil to illustrate this feature. [block:html] { "html": "<div class=\"panel panel-default\">\n <div class=\"panel-body\">\n <iframe width=\"100%\" height=\"460px\" frameBorder=\"0\" seamless=\"seamless\" scrolling=\"no\" src=\"http://demos.gogeo.io/tutorials/geosearch-sample/\"></iframe>\n </div>\n</div>" } [/block] 1. A spatial filter is applied on these data; 2. The data initially loaded into sample application results; 3. You can use the text field to aplly some filter (full text search). [block:html] { "html": "<a href=\"http://cssdeck.com/labs/njocjbla\" target=\"_blank\">LET'S EXPLORE AND UNDERSTAND THE CODE? CLICK HERE!</a>" } [/block] [block:api-header] { "type": "basic", "title": "Geosearch on a Map" } [/block] Geosearch, as said on [Creating a Simple Geosearch App](doc:creating-a-sample-geosearch-app) tutorial, just retrieves the a JSON with information data. ##But how to use this on my map? In the next example we explore this! We will use a collection with 2 million points throughout Brazil to illustrate this feature. To do this we apply two (2) **goGeo** features: * *Map Rendering* with spatial and relational filter; * *Geosearch* using the same filters. [block:html] { "html": "<div class=\"panel panel-default\">\n <div class=\"panel-body\">\n <iframe width=\"100%\" height=\"520px\" frameBorder=\"0\" seamless=\"seamless\" scrolling=\"no\" src=\"http://demos.gogeo.io/tutorials/geosearch\"></iframe>\n </div>\n</div>" } [/block] [block:html] { "html": "<a href=\"http://cssdeck.com/labs/joiyhts4\" target=\"_blank\">LET'S EXPLORE AND UNDERSTAND THE CODE? CLICK HERE!</a>" } [/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/using-geoaggregation'>\n &laquo; Back \n </a>\n</div>\n\n<div class='div-forward'> \n <a href='/v1.0/docs/interactive-maps'>\n Next &raquo; </div>\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]