{"__v":10,"_id":"54dd1a3b08f6b61700a6920a","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"},"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-12T21:25:15.339Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":20,"body":"Importing data to the **goGeo** platform is performed following these steps:\n\n1. The user informs the *URL* of a data file;\n2. The platform performs the download of this file;\n3. If necessary, decompresses the file;\n4. So, insert the data on platform.\n\n### Obtaining URL\n\nThe *URL* must be a direct link to the file, below is described a command that you can use to test your *URL*.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -i \\\"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThe output of this command is presented below. The option *-i* of *curl* command denote that beyond getting the file, it should also show the request headers.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 302 FOUND\\nServer: nginx\\nDate: Tue, 01 Jul 2014 17:12:24 GMT\\nContent-Type: text/html; charset=utf-8\\nTransfer-Encoding: chunked\\nConnection: keep-alive\\nset-cookie: locale=en; expires=Sun, 30 Jun 2019 17:12:24 GMT; Path=/\\nset-cookie: gvc=MTI4MzcxMTY5NDQzOTUxNTA0NjIwOTAzNDgzMDQwMDMwNzE4NDAy; expires=Sun, 30 Jun 2019 17:12:24 GMT; Path=/; httponly\\nset-cookie: t=wcHe4MuHl3eGbpKDyYsyx6st; Domain=dropbox.com; expires=Thu, 31 Jul 2014 17:12:24 GMT; Path=/; secure; httponly\\nstrict-transport-security: max-age=2592000; includeSubDomains\\nlocation: https://dl.dropboxusercontent.com/content_link/yax0eY0B6wp0XnsFAZbOYbaJE91MZZLQi2d2Cj18zU7XwXHzTl6LMJiT9W9xDL12?dl=1\\npragma: no-cache\\ncache-control: no-cache\\nx-dropbox-http-protocol: None\\nx-frame-options: SAMEORIGIN\\nx-dropbox-request-id: 802dccfda8f76eb25c5307021004b37a\\n\\nHTTP/1.1 200 OK\\naccept-ranges: none\\ncache-control: max-age=0\\ncontent-disposition: attachment; filename=\\\"basic.csv\\\"\\nContent-Type: text/csv; charset=utf-8\\nDate: Tue, 01 Jul 2014 17:12:25 GMT\\netag: 18779d\\npragma: public\\nServer: nginx\\nset-cookie: uc_session=AnWRnwp57XXjKnYBWcZs0qDrgjZhrnOwTy8A9yfdrbs0QQgSicbS2YvuEtU8pV7s; Domain=dropboxusercontent.com; Path=/; secure; httponly\\nx-dropbox-request-id: 98b0fa34288788ba4231ae4150d144d2\\nx-robots-tag: noindex, nofollow\\nx-server-response-time: 153\\nContent-Length: 648\\nConnection: keep-alive\\n\\n\\\"code:text\\\";\\\"name:text\\\";\\\"street:text\\\";\\\"city:text\\\";\\\"state:text\\\";\\\"employees:int\\\";\\\"revenue:long\\\";\\\"lat:double\\\";\\\"lon:double\\\";\\\"the_geom:point\\\"\\n\\\"a1\\\";\\\"Company 1\\\";\\\"Street 1\\\";\\\"Goiânia\\\";\\\"GO\\\";\\\"100\\\";\\\"1500000\\\";\\\"-16.67\\\";\\\"-49.24\\\";\\\"POINT(-49.24 -16.67)\\\"\\n\\\"a2\\\";\\\"Company 2\\\";\\\"Street 2\\\";\\\"São Paulo\\\";\\\"SP\\\";\\\"200\\\";\\\"2500000\\\";\\\"-23.58\\\";\\\"-46.61\\\";\\\"POINT(-46.61 -23.58)\\\"\\n\\\"a3\\\";\\\"Company 3\\\";\\\"Street 3\\\";\\\"Sorocaba\\\";\\\"SP\\\";\\\"300\\\";\\\"4500000\\\";\\\"-23.47\\\";\\\"-47.43\\\";\\\"POINT(-47.43 -23.47)\\\"\\n\\\"a4\\\";\\\"Company 4\\\";\\\"Street 4\\\";\\\"Brasília\\\";\\\"DF\\\";\\\"400\\\";\\\"8500000\\\";\\\"-15.80\\\";\\\"-47.87\\\";\\\"POINT(-47.87 -15.80)\\\"\\n\\\"a5\\\";\\\"Company 5\\\";\\\"Street 5\\\";\\\"Porto Alegre\\\";\\\"RS\\\";\\\"500\\\";\\\"6000000\\\";\\\"-30.03\\\";\\\"-51.22\\\";\\\"POINT(-51.22 -30.03)\\\"\\n\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nAs can be observed, the *URL* used is [Dropbox.com](http://www.dropbox.com). [Copy.com](http://www.copy.com) also can be used to import data to the **goGeo**. Below was described an example of *URL* to a file on *Copy*.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -i \\\"https://copy.com/Hy8I0fOGWztc/basic.csv?download=1\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nBut these are not the only providers allowed to do the data import. In theory you can use any accessible file server on the internet. To check the validity of your favorite file server use the *curl* command showed above.\n\n###Format of files\n\n**goGeo** platform accepts two types of files on data importing, [CSV](<http://pt.wikipedia.org/wiki/Comma-separated_values>) and [shapefiles](<http://en.wikipedia.org/wiki/Shapefile>).\nWhen inserting a CSV file, a metadata JSON is used to inform the format of your file. Details like field names, separators and typing are defined in this metadata. The [CSV Metadata](/v1.0/docs/data-insertion#csv-metadata) section explains how the metadata parameters.\n\nA dataset in shapefile format is, in fact, compose by at least 3 files. All them with the same name but distinct extension (**.dbf**, **.shx** and **.shp**). Thus, is required compress these files together to perform the data import on **goGeo** platform.\n\nYou can compress the **.csv** files to decrease the size of them, too. This decreases the download/upload time.\n\nThe compressed formats accepted by the platform are: **.zip**, **.rar**, **.tar** and **.tar.bz2**.\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\\n<div class='div-forward'> \\n  <a href='/v1.0/docs/import-data'>\\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":"","slug":"data-import","type":"basic","title":"Data Import"}
Importing data to the **goGeo** platform is performed following these steps: 1. The user informs the *URL* of a data file; 2. The platform performs the download of this file; 3. If necessary, decompresses the file; 4. So, insert the data on platform. ### Obtaining URL The *URL* must be a direct link to the file, below is described a command that you can use to test your *URL*. [block:code] { "codes": [ { "code": "curl -L -i \"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\"", "language": "curl" } ] } [/block] The output of this command is presented below. The option *-i* of *curl* command denote that beyond getting the file, it should also show the request headers. [block:code] { "codes": [ { "code": "HTTP/1.1 302 FOUND\nServer: nginx\nDate: Tue, 01 Jul 2014 17:12:24 GMT\nContent-Type: text/html; charset=utf-8\nTransfer-Encoding: chunked\nConnection: keep-alive\nset-cookie: locale=en; expires=Sun, 30 Jun 2019 17:12:24 GMT; Path=/\nset-cookie: gvc=MTI4MzcxMTY5NDQzOTUxNTA0NjIwOTAzNDgzMDQwMDMwNzE4NDAy; expires=Sun, 30 Jun 2019 17:12:24 GMT; Path=/; httponly\nset-cookie: t=wcHe4MuHl3eGbpKDyYsyx6st; Domain=dropbox.com; expires=Thu, 31 Jul 2014 17:12:24 GMT; Path=/; secure; httponly\nstrict-transport-security: max-age=2592000; includeSubDomains\nlocation: https://dl.dropboxusercontent.com/content_link/yax0eY0B6wp0XnsFAZbOYbaJE91MZZLQi2d2Cj18zU7XwXHzTl6LMJiT9W9xDL12?dl=1\npragma: no-cache\ncache-control: no-cache\nx-dropbox-http-protocol: None\nx-frame-options: SAMEORIGIN\nx-dropbox-request-id: 802dccfda8f76eb25c5307021004b37a\n\nHTTP/1.1 200 OK\naccept-ranges: none\ncache-control: max-age=0\ncontent-disposition: attachment; filename=\"basic.csv\"\nContent-Type: text/csv; charset=utf-8\nDate: Tue, 01 Jul 2014 17:12:25 GMT\netag: 18779d\npragma: public\nServer: nginx\nset-cookie: uc_session=AnWRnwp57XXjKnYBWcZs0qDrgjZhrnOwTy8A9yfdrbs0QQgSicbS2YvuEtU8pV7s; Domain=dropboxusercontent.com; Path=/; secure; httponly\nx-dropbox-request-id: 98b0fa34288788ba4231ae4150d144d2\nx-robots-tag: noindex, nofollow\nx-server-response-time: 153\nContent-Length: 648\nConnection: keep-alive\n\n\"code:text\";\"name:text\";\"street:text\";\"city:text\";\"state:text\";\"employees:int\";\"revenue:long\";\"lat:double\";\"lon:double\";\"the_geom:point\"\n\"a1\";\"Company 1\";\"Street 1\";\"Goiânia\";\"GO\";\"100\";\"1500000\";\"-16.67\";\"-49.24\";\"POINT(-49.24 -16.67)\"\n\"a2\";\"Company 2\";\"Street 2\";\"São Paulo\";\"SP\";\"200\";\"2500000\";\"-23.58\";\"-46.61\";\"POINT(-46.61 -23.58)\"\n\"a3\";\"Company 3\";\"Street 3\";\"Sorocaba\";\"SP\";\"300\";\"4500000\";\"-23.47\";\"-47.43\";\"POINT(-47.43 -23.47)\"\n\"a4\";\"Company 4\";\"Street 4\";\"Brasília\";\"DF\";\"400\";\"8500000\";\"-15.80\";\"-47.87\";\"POINT(-47.87 -15.80)\"\n\"a5\";\"Company 5\";\"Street 5\";\"Porto Alegre\";\"RS\";\"500\";\"6000000\";\"-30.03\";\"-51.22\";\"POINT(-51.22 -30.03)\"\n", "language": "http" } ] } [/block] As can be observed, the *URL* used is [Dropbox.com](http://www.dropbox.com). [Copy.com](http://www.copy.com) also can be used to import data to the **goGeo**. Below was described an example of *URL* to a file on *Copy*. [block:code] { "codes": [ { "code": "curl -L -i \"https://copy.com/Hy8I0fOGWztc/basic.csv?download=1\"", "language": "curl" } ] } [/block] But these are not the only providers allowed to do the data import. In theory you can use any accessible file server on the internet. To check the validity of your favorite file server use the *curl* command showed above. ###Format of files **goGeo** platform accepts two types of files on data importing, [CSV](<http://pt.wikipedia.org/wiki/Comma-separated_values>) and [shapefiles](<http://en.wikipedia.org/wiki/Shapefile>). When inserting a CSV file, a metadata JSON is used to inform the format of your file. Details like field names, separators and typing are defined in this metadata. The [CSV Metadata](/v1.0/docs/data-insertion#csv-metadata) section explains how the metadata parameters. A dataset in shapefile format is, in fact, compose by at least 3 files. All them with the same name but distinct extension (**.dbf**, **.shx** and **.shp**). Thus, is required compress these files together to perform the data import on **goGeo** platform. You can compress the **.csv** files to decrease the size of them, too. This decreases the download/upload time. The compressed formats accepted by the platform are: **.zip**, **.rar**, **.tar** and **.tar.bz2**. --- [block:html] { "html": "<div class='div-middle'> \n <a href='#'>\n Top page &spades; </div>\n </a>\n</div>\n\n\n<div class='div-forward'> \n <a href='/v1.0/docs/import-data'>\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]