{"id":15697157,"url":"https://github.com/jexp/panama-map","last_synced_at":"2025-04-30T07:08:03.787Z","repository":{"id":66743992,"uuid":"69859885","full_name":"jexp/panama-map","owner":"jexp","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-05T14:07:12.000Z","size":491,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T07:08:00.568Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/jexp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-03T10:10:09.000Z","updated_at":"2024-07-19T20:19:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd91ddb3-e5f7-438f-ae00-fd4ace2bb9a8","html_url":"https://github.com/jexp/panama-map","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/jexp%2Fpanama-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fpanama-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fpanama-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fpanama-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jexp","download_url":"https://codeload.github.com/jexp/panama-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658208,"owners_count":21622820,"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-03T19:13:11.398Z","updated_at":"2025-04-30T07:08:03.765Z","avatar_url":"https://github.com/jexp.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## panama-graph-map\n\nThis is a very simple demo on how to visualize locations of Addresses from the #PapamaPapers using MapBox.\n\nThe code was shamelessly stolen from [legis-graph-spatial](https://github.com/legis-graph/legis-graph-spatial) thanks [Will Lyon](http://twitter.com/lyonwj)!\n\n### Tools used\n\n* Neo4j\n* Cypher\n* Bolt Javascript Driver\n* APOC procedures (geocode)\n* MapBox\n\n\u003cimg src=\"panama_map.jpg\" width=\"400\"/\u003e\n\n### Download the Database from ICIJ\n\nTake the #PanamaPapers Neo4j database from the ICIJ's download site: https://offshoreleaks.icij.org/pages/database\n\nUnzip and run the database following the instructions in the readme.\n\n### GeoCode Addresses\n\nFirst geocode addresses of a country, like Denmark (DNK).\n\nIt uses the [apoc procedure library](https://github.com/neo4j-contrib/neo4j-apoc-procedures) with is coming out of the box with the ICIJ database download.\n\nJust run in your Neo4j Browser:\n\n```\nMATCH (a:Address) WHERE a.country_codes = \"DNK\" \nCALL apoc.spatial.geocodeOnce(a.address) YIELD location\nSET a += location\n```\n\n### Run this Project\n\nNow you can run this project (which is currently pinned to Denmark).\n\nE.g. by using `python -m SimpleHTTPServer` and then open http://localhost:8000\n\nClick on the country and the addresses are queried from Neo4j and rendered on the map with additional information taken from the graph.\n\n### Spatial Query\n\n```\n// graph pattern we're looking for\nMATCH (a:Address)\u003c--(officer:Officer)-[role]-\u003e(entity:Entity)\n\n// in this country with a location\nWHERE a.country_codes = {country} AND exists(a.longitude) AND \n\n// and in this distance from the click point\ndistance(point({pos}), point(a)) \u003c ({distanceInKm} * 1000)\n\n// return positions and information from the graph pattern\nRETURN a.latitude, a.longitude, \n{officer : officer.name, entity: entity.name, role: type(role),  \n address : a.address,   country: entity.country_codes} AS data\n```\n\n### Working with Mapbox\n\n~~~ javascript\n\nL.mapbox.accessToken = MB_API_TOKEN;\nvar map = L.mapbox.map('map', 'mapbox.streets')\n  .setView([39.8282, -98.5795], 5);\n\nmap.on('click', function(e) {\n  clearMap(map);\n  getAddresses(\"DNK\",e.latlng, 50)\n});\n\n~~~\n\n**Create the map and define a click handler for the map.**\n\n~~~ javascript\n\nfunction getAddresses(country, pos, distance) {\n    \n    var addressParams = {\n        \"country\": country,\n        \"longitude\": pos.lng, \n        \"latitude\": pos.lat,\n        \"distanceInKm\": distance || 50\n    }\n\n    session\n        .run(addressQuery, addressParams)\n        .then(function(result){\n            result.records.forEach(function(record) {\n                addAddress(record.get(\"latitude\"),record.get(\"longitude\"),\n                           record.get(\"text\"));\n            });\n\n        })\n}\n\n\n~~~\n\n\n#### Rendering Addresses On Map \n\n~~~ javascript\n\nfunction addAddress(lat,lon, data) {\n   L.marker([lat,lon],{title:JSON.stringify(data)}).addTo(map);\n}\n\n~~~\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjexp%2Fpanama-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjexp%2Fpanama-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjexp%2Fpanama-map/lists"}