{"id":17285625,"url":"https://github.com/severo/pesticides_website_data","last_synced_at":"2026-07-16T20:30:16.749Z","repository":{"id":48021182,"uuid":"175952440","full_name":"severo/pesticides_website_data","owner":"severo","description":"Optimized data of Brazil municipalities borders","archived":true,"fork":false,"pushed_at":"2021-08-10T22:35:00.000Z","size":1591,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T21:17:25.549Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/severo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-16T09:34:03.000Z","updated_at":"2023-05-16T03:41:49.000Z","dependencies_parsed_at":"2022-08-12T16:50:52.530Z","dependency_job_id":null,"html_url":"https://github.com/severo/pesticides_website_data","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/severo%2Fpesticides_website_data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/severo%2Fpesticides_website_data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/severo%2Fpesticides_website_data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/severo%2Fpesticides_website_data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/severo","download_url":"https://codeload.github.com/severo/pesticides_website_data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240612488,"owners_count":19829026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T09:57:01.643Z","updated_at":"2026-07-16T20:30:16.699Z","avatar_url":"https://github.com/severo.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\nOptimized data of Brazil municipalities borders.\n\nUsed in the\n[Você bebe agrotóxicos? Descubra se a água da sua torneira foi contaminada](http://portrasdoalimento.info/agrotoxico-na-agua/)\ndata visualization, on pesticides in Brazil.\n\n![Concentration of pesticides in Brazilian drinking water](./dataviz_screenshot.png)\n\n## Data\n\n- [data/br-px-topo.json](./data/br-px-topo.json): optimized Brazil geometries\n  for municipalities in Brazil.\n\n  ```json\n  {\n    \"type\":\t\"Topology\",\n    \"bbox\": {\n      \"0\": 5.684341886080802e-14,\n      \"1\": 47.00178093080447,\n      \"2\": 960,\n      \"3\": 912.9982190691954\n    },\n    \"transform\"\t: {\n      \"scale\":\t[…],\n      \"translate\":\t[…]\n    },\n    \"objects\": {\n      \"municipalities\": {\n        \"type\":\t\"GeometryCollection\",\n        \"geometries\":\t[…]},\n      \"republic\":\t{…},\n      \"federative-units\":\t{…},\n      \"internal-federative-units\":\t{…}\n    },\n    \"arcs\":\t[…]\n  }\n  ```\n\n### Municipalities\n\nThe data contain the geographic limits of the Brazil municipalities, as defined\nby the official Brazilian institute (IPGE), as well as some metadata. For\nexample, for the Abadia de Goiás municipality:\n\n```\ncat data/br-px-topo.json | jq '.objects.municipalities.geometries[0]'\n{\n  \"type\": \"Polygon\",\n  \"arcs\": [\n    [\n      0,\n      1,\n      2,\n      3,\n      4\n    ]\n  ],\n  \"properties\": {\n    \"ibgeCode\": \"520005\",\n    \"fu\": \"GO\",\n    \"fuCode\": \"52\",\n    \"name\": \"Abadia de Goiás\",\n    \"population\": \"8207\"\n  }\n}\n```\n\nwith:\n\n- \"type\": the type of spatial data as defined in\n  [topojson](https://github.com/topojson/topojson-specification)\n- \"arcs\": the arcs of the topological data used to define the border (see the\n  [topojson specification](https://github.com/topojson/topojson-specification#213-arcs))\n- \"ibgeCode\": municipality identifier given by IBGE\n- \"fu\": two-letter federal unit (state) identifier given by IBGE\n- \"fuCode\": two-number federal unit (state) identifier given by IBGE\n- \"name\": name of the municipality\n- \"population\": estimated population (source IBGE 2018)\n\n### States\n\nTo get access to the states data:\n\n```bash\ncat data/br-px-topo.json | jq '.objects[\"federative-units\"].geometries[0]'\n```\n\n```json\n{\n  \"type\": \"MultiPolygon\",\n  \"arcs\": [\n    [\n      [\n        7417,\n        -14108,\n        ...\n      ],\n      [\n        15582,\n        11956\n      ],\n      [\n        3820,\n        17112\n      ]\n    ]\n  ],\n  \"id\": \"52\",\n  \"properties\": {\n    \"fu\": \"GO\",\n    \"fuCode\": \"52\"\n  }\n}\n```\n\nThe metadata only include the state identifiers.\n\nNote that the internal borders between states, ie. excluding the national\nfrontier, are also provided (to be used for graphical purposes) by:\n\n```bash\ncat data/br-px-topo.json | jq '.objects[\"internal-federative-units\"].geometries[0]'\n```\n\nThe national frontier is also available as a MULTIPOLYGON with:\n\n```bash\ncat data/br-px-topo.json | jq '.objects[\"republic\"].geometries[0]'\n```\n\n## Rebuild the data\n\nTo update the [data/br-px-topo.json](./data/br-px-topo.json) file, first install\nthe required Node.js packages:\n\n```bash\nnpm install\n```\n\nthen launch the Makefile\n\n```bash\nmake all\n```\n\nUse `make clean` to remove files.\n\nAlternately, use the npm scripts:\n\n```bash\nnpm run clean\nnpm run build\n```\n\n## Methodology\n\nThe methodology is described in the Makefile comments.\n\n- get and unzip the municipalities spatial data from IBGE ftp (shapefile)\n- convert shapefile to GeoJSON\n- project GeoJSON to EPSG:5530, so treatments are done in pixels, in a 960x960\n  px square, instead of steradians\n- convert JSON to ND JSON for easier manipulation\n- add IBGE code property\n- on another side, convert [inputs/population.csv](./inputs/population.csv) file\n  to ND JSON format\n- merge population data with spatial data, adding the `ibgeCode`, `fu`,\n  `fuCode`, `name` and `population` properties\n- convert ND JSON to TopoJSON, with geometries in `municipalities` topology\n  object\n- simplify the geometry (in order to reduce the size of the file), removing the\n  \"triangle areas\" below 1px² (see\n  [Line Simplification](https://bost.ocks.org/mike/simplify/))\n- quantize the values, removing useless decimals (in order to reduce the size of\n  the file)\n- add `republic`, `federative-units` (states) and `internal-federative-units`\n  geometries\n\n### Technology used\n\n- npm to install the required packages: [d3-dsv](https://github.com/d3/d3-dsv),\n  [d3-geo-projection](https://github.com/d3/d3-geo-projection/),\n  [ndjson-cli](https://github.com/mbostock/ndjson-cli),\n  [shapefile](https://github.com/mbostock/shapefile) and\n  [topojson](https://github.com/topojson/topojson)\n- Makefile to coordinate the data building processes\n\n### Based on the work by\n\n- Mike Bostock,\n  https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c\n  parts 1, 2, 3 and 4.\n- Carolina Bigonha, https://github.com/carolinabigonha/br-atlas/\n- Philippe Rivière, https://observablehq.com/@fil/epsg-5530\n- IBGE, ftp://geoftp.ibge.gov.br/organizacao_do_territorio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevero%2Fpesticides_website_data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsevero%2Fpesticides_website_data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevero%2Fpesticides_website_data/lists"}