{"__v":5,"_id":"5501d20f0459bd3700770e1e","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-12T17:51:11.513Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"In this tutorial you will learn how to group and count your data by some field. In **goGeo**, this feature is called Geo Aggregation.\n\nTo demonstrate the use of this feature, the sample app below shows the collection 2 millions companies in Brazil. Additionally is showed on the gray box on left botton the highest 10 states in number of companies on the current visible map area. Let's see how it is possible to get those information using **goGeo**'s Geo Aggregation service.\n[block:html]\n{\n  \"html\": \"<div class=\\\"panel panel-default\\\">\\n  <div class=\\\"panel-body\\\">\\n    <iframe width=\\\"100%\\\" height=\\\"500px\\\" frameborder=\\\"0\\\" seamless=\\\"seamless\\\" scrolling=\\\"no\\\" src=\\\"http://demos.gogeo.io/tutorials/geoaggregation\\\"></iframe>\\n  </div>\\n</div>\"\n}\n[/block]\nIn this sample application we load on the map the OpenStreetMaps base layer and the companies_2m collection (2 million companies in Brazil). Additionally we dynamically call the Geo Aggregation service to show the 10 greater Brazilian states in number of companies on the visible map area (aggregation on state attribute). For any map change (i.e., zoom or pan), the Geo Aggregation service is called to update aggregation information.\n[block:html]\n{\n  \"html\": \"<a href=\\\"http://cssdeck.com/labs/wuwz3iq9\\\" target=\\\"_blank\\\">LET'S EXPLORE AND UNDERSTAND THE CODE? CLICK HERE!</a>\"\n}\n[/block]\nTo know the other Geo Aggregation services and understand the other parameters that we don't use in this tutorial, see [Geo Aggregation API Reference](doc:geo-aggregation-request).\n\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/thematic-maps'>\\n    &laquo; Back \\n  </a>\\n</div>\\n\\n<div class='div-forward'> \\n  <a href='/v1.0/docs/using-geoservices'>\\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":"Creating a Simple Geo Aggregation App.","slug":"using-geoaggregation","type":"basic","title":"Using geoAggregation"}

Using geoAggregation

Creating a Simple Geo Aggregation App.

In this tutorial you will learn how to group and count your data by some field. In **goGeo**, this feature is called Geo Aggregation. To demonstrate the use of this feature, the sample app below shows the collection 2 millions companies in Brazil. Additionally is showed on the gray box on left botton the highest 10 states in number of companies on the current visible map area. Let's see how it is possible to get those information using **goGeo**'s Geo Aggregation service. [block:html] { "html": "<div class=\"panel panel-default\">\n <div class=\"panel-body\">\n <iframe width=\"100%\" height=\"500px\" frameborder=\"0\" seamless=\"seamless\" scrolling=\"no\" src=\"http://demos.gogeo.io/tutorials/geoaggregation\"></iframe>\n </div>\n</div>" } [/block] In this sample application we load on the map the OpenStreetMaps base layer and the companies_2m collection (2 million companies in Brazil). Additionally we dynamically call the Geo Aggregation service to show the 10 greater Brazilian states in number of companies on the visible map area (aggregation on state attribute). For any map change (i.e., zoom or pan), the Geo Aggregation service is called to update aggregation information. [block:html] { "html": "<a href=\"http://cssdeck.com/labs/wuwz3iq9\" target=\"_blank\">LET'S EXPLORE AND UNDERSTAND THE CODE? CLICK HERE!</a>" } [/block] To know the other Geo Aggregation services and understand the other parameters that we don't use in this tutorial, see [Geo Aggregation API Reference](doc:geo-aggregation-request). --- [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/thematic-maps'>\n &laquo; Back \n </a>\n</div>\n\n<div class='div-forward'> \n <a href='/v1.0/docs/using-geoservices'>\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]