{"__v":16,"_id":"5501ecbaf2ef1e0d0031171d","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-12T19:44:58.229Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"To import your data first you need to create a database and some collections. But, you can be cloning public data (**Shared Collections**) available on the **goGeo** platform and offered by community users. The **goGeo** platform provides some tools to perform these tasks, you can use the Console or access some API endpoints. The follows enumerated sections describe ways to clone shared collection:\n\n1. [Cloning a Shared Collection by Console](/v1.0/docs/cloning-shared-collection#cloning-a-shared-collection-by-console);\n2. [Cloning a Shared Collection by API](/v1.0/docs/cloning-shared-collection#cloning-a-shared-collection-by-api).\n\nLet's try it right now.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Cloning a Shared Collection by Console\"\n}\n[/block]\nThe **goGeo** has a Data Store through which a third party who works as a data provider can share (for free or paid) their database over goGeo's API to motivate developers build more inovative and advanced GIS Applications. For while, all Shared Collections are read-only. So, you can use them to develop Geo Services, but you cannot change their attributes and geometries. \n\nIn order to understand how a Collection shared by a data provider can be used in your application, open the goGeo's console and select databases option. Click on \"Add Public Colletion\" icon on the upper right corner of the databases box as ilustrated in Figure 1. As you can see, it's not necessary to upload or insert any data. You just need add a Shared Collection in your Database and start exploring it as you want within your application.\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Figure 1 - Adding public collection.\",\n      \"image\": [\n        \"https://files.readme.io/p5LptygSeVZOVI0QL1jQ_001_fig12.png\",\n        \"001_fig12.png\",\n        \"650\",\n        \"387\",\n        \"#4878b2\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nJust to show how easy it is, we are going to use a collection shared by goGeo with 4 million of companies in USA. Select the collection called *companies_4m* and click on *add* link, as shown in Figure 2.\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Figure 2 - Select collection to publish.\",\n      \"image\": [\n        \"https://files.readme.io/vNLkbWwhSj6DIKJpcgnB_001_fig13.png\",\n        \"001_fig13.png\",\n        \"1076\",\n        \"451\",\n        \"#8f2626\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNext you can choose the database, change the collection name and description (Figure 3).\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Figure 3 - Form to publish collection.\",\n      \"image\": [\n        \"https://files.readme.io/XM6Yg24qS1WI8IO6Pfgc_001_fig14.png\",\n        \"001_fig14.png\",\n        \"612\",\n        \"406\",\n        \"#4c94d3\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNote that the collection has an icon besides its name which indicates that it is a read-only shared collection.\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Figure 4 - List collection after publish.\",\n      \"image\": [\n        \"https://files.readme.io/tChbjtjnRQ2MpT448OgD_001_fig15.png\",\n        \"001_fig15.png\",\n        \"658\",\n        \"405\",\n        \"#3970b0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Cloning a Shared Collection by API\"\n}\n[/block]\nTo clone a shared collection via API, you will first need your API-KEY and MAP-KEY. You will need to get in the Console.\n\nYou'll also need to know which are the public collections. That can do done with a GET request.\n\nWith the API-KEY in hands, you just need do a GET/POST requests. You can do this using some tools. Below we can see example(s).\n\n### cURL\nOpen a terminal;\n\nExecute the following command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k --user {apikey}: -H \\\"Content-Type: application/json\\\" -XGET \\\\\\n  \\\"https://api.gogeo.io/1.0/collections/shared\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nYou'll receive as response a list of public collection. The response will be likely the example below. Rebember to change the *{apikey}* by your own API-KEY. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"database_id\\\": \\\"my_database\\\",\\n    \\\"description\\\": \\\"\\\",\\n    \\\"origin\\\": \\\"\\\",\\n    \\\"public\\\": true,\\n    \\\"username\\\": \\\"goGeo\\\",\\n    \\\"id\\\": \\\"987328932\\\",\\n    \\\"collection_name\\\": \\\"shared_collection_1\\\"\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nNow, with the **id** of a public collection, you must clone this like was creating a new one. The diference will be the parameters passed. Execute the following command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k --user {apikey}: -H \\\"Content-Type: application/json\\\" -XPOST \\\\\\n\\\"https://api.gogeo.io/1.0/databases/{database_name}/collections\\\" \\\\\\n-d '\\n  {\\n    \\\"collection_name\\\": \\\"{collection_name}\\\",\\n    \\\"origin\\\": \\\"987328932\\\"\\n  }'\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThis will create a collection. Just replace *{apikey}* by your own API-KEY, *{database_name}* by the name of database that will contain your new collection, and *{collection_name}* by the name you want to the new collection.\n\nCongratulations, you already have your collection cloned.\n\nNote that we use as *origin* the *id* of a public collection (shared_collection_1). You will need to choice a real one that will appear on the first GET 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-forward'> \\n  <a href='/v1.0/docs/creating-a-database'>\\n    Next &raquo; </div>\\n  </a>\\n</div>\\n\\n<style>\\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":"Enjoy the public data available on the platform.","slug":"cloning-shared-collection","type":"basic","title":"Cloning shared collection"}

Cloning shared collection

Enjoy the public data available on the platform.

To import your data first you need to create a database and some collections. But, you can be cloning public data (**Shared Collections**) available on the **goGeo** platform and offered by community users. The **goGeo** platform provides some tools to perform these tasks, you can use the Console or access some API endpoints. The follows enumerated sections describe ways to clone shared collection: 1. [Cloning a Shared Collection by Console](/v1.0/docs/cloning-shared-collection#cloning-a-shared-collection-by-console); 2. [Cloning a Shared Collection by API](/v1.0/docs/cloning-shared-collection#cloning-a-shared-collection-by-api). Let's try it right now. [block:api-header] { "type": "basic", "title": "Cloning a Shared Collection by Console" } [/block] The **goGeo** has a Data Store through which a third party who works as a data provider can share (for free or paid) their database over goGeo's API to motivate developers build more inovative and advanced GIS Applications. For while, all Shared Collections are read-only. So, you can use them to develop Geo Services, but you cannot change their attributes and geometries. In order to understand how a Collection shared by a data provider can be used in your application, open the goGeo's console and select databases option. Click on "Add Public Colletion" icon on the upper right corner of the databases box as ilustrated in Figure 1. As you can see, it's not necessary to upload or insert any data. You just need add a Shared Collection in your Database and start exploring it as you want within your application. [block:image] { "images": [ { "caption": "Figure 1 - Adding public collection.", "image": [ "https://files.readme.io/p5LptygSeVZOVI0QL1jQ_001_fig12.png", "001_fig12.png", "650", "387", "#4878b2", "" ] } ] } [/block] Just to show how easy it is, we are going to use a collection shared by goGeo with 4 million of companies in USA. Select the collection called *companies_4m* and click on *add* link, as shown in Figure 2. [block:image] { "images": [ { "caption": "Figure 2 - Select collection to publish.", "image": [ "https://files.readme.io/vNLkbWwhSj6DIKJpcgnB_001_fig13.png", "001_fig13.png", "1076", "451", "#8f2626", "" ] } ] } [/block] Next you can choose the database, change the collection name and description (Figure 3). [block:image] { "images": [ { "caption": "Figure 3 - Form to publish collection.", "image": [ "https://files.readme.io/XM6Yg24qS1WI8IO6Pfgc_001_fig14.png", "001_fig14.png", "612", "406", "#4c94d3", "" ] } ] } [/block] Note that the collection has an icon besides its name which indicates that it is a read-only shared collection. [block:image] { "images": [ { "caption": "Figure 4 - List collection after publish.", "image": [ "https://files.readme.io/tChbjtjnRQ2MpT448OgD_001_fig15.png", "001_fig15.png", "658", "405", "#3970b0", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Cloning a Shared Collection by API" } [/block] To clone a shared collection via API, you will first need your API-KEY and MAP-KEY. You will need to get in the Console. You'll also need to know which are the public collections. That can do done with a GET request. With the API-KEY in hands, you just need do a GET/POST requests. You can do this using some tools. Below we can see example(s). ### cURL Open a terminal; Execute the following command: [block:code] { "codes": [ { "code": "curl -k --user {apikey}: -H \"Content-Type: application/json\" -XGET \\\n \"https://api.gogeo.io/1.0/collections/shared\"", "language": "curl" } ] } [/block] You'll receive as response a list of public collection. The response will be likely the example below. Rebember to change the *{apikey}* by your own API-KEY. [block:code] { "codes": [ { "code": "[\n {\n \"database_id\": \"my_database\",\n \"description\": \"\",\n \"origin\": \"\",\n \"public\": true,\n \"username\": \"goGeo\",\n \"id\": \"987328932\",\n \"collection_name\": \"shared_collection_1\"\n }\n]", "language": "json" } ] } [/block] Now, with the **id** of a public collection, you must clone this like was creating a new one. The diference will be the parameters passed. Execute the following command: [block:code] { "codes": [ { "code": "curl -k --user {apikey}: -H \"Content-Type: application/json\" -XPOST \\\n\"https://api.gogeo.io/1.0/databases/{database_name}/collections\" \\\n-d '\n {\n \"collection_name\": \"{collection_name}\",\n \"origin\": \"987328932\"\n }'", "language": "curl" } ] } [/block] This will create a collection. Just replace *{apikey}* by your own API-KEY, *{database_name}* by the name of database that will contain your new collection, and *{collection_name}* by the name you want to the new collection. Congratulations, you already have your collection cloned. Note that we use as *origin* the *id* of a public collection (shared_collection_1). You will need to choice a real one that will appear on the first GET 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-forward'> \n <a href='/v1.0/docs/creating-a-database'>\n Next &raquo; </div>\n </a>\n</div>\n\n<style>\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]