{"id":20912494,"url":"https://github.com/fogleman/density","last_synced_at":"2025-05-13T08:30:56.205Z","repository":{"id":144202208,"uuid":"55721625","full_name":"fogleman/density","owner":"fogleman","description":"Render millions of points on a map.","archived":false,"fork":false,"pushed_at":"2019-12-28T16:30:12.000Z","size":21,"stargazers_count":147,"open_issues_count":2,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T20:12:13.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.michaelfogleman.com/static/density/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fogleman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-04-07T19:21:15.000Z","updated_at":"2024-02-14T10:48:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab0d3131-6cdd-4ec2-888c-6fdc8b394bd6","html_url":"https://github.com/fogleman/density","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/fogleman%2Fdensity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2Fdensity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2Fdensity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2Fdensity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fogleman","download_url":"https://codeload.github.com/fogleman/density/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253903648,"owners_count":21981727,"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-11-18T14:27:45.099Z","updated_at":"2025-05-13T08:30:55.911Z","avatar_url":"https://github.com/fogleman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# High-density Point Maps\n\nRender millions of points on a map.\n\n![Map](http://i.imgur.com/qhkUlAK.png)\n\n### Demo Site\n\nThis demo shows 77 million taxi pickups in NYC - from January to June 2015.\n\nhttps://www.michaelfogleman.com/static/density/\n\n### Dependencies\n\n  - Go\n  - Cassandra\n\n### Download\n\n    go get github.com/fogleman/density\n\n### Loading Data\n\nCassandra is used to store large amounts of data. Data is clustered by `(zoom, x, y)` so\nthat all of the points inside of a tile can quickly be fetched for rendering, even\nfaster than PostGIS with an index.\n\nFirst, create a new keyspace and table to house the data.\n\n    create keyspace density\n        with replication = {\n            'class': 'SimpleStrategy',\n            'replication_factor': 1\n        }\n        and durable_writes = false;\n\n    create table points (\n        zoom int,\n        x int,\n        y int,\n        lat double,\n        lng double,\n        primary key ((zoom, x, y), lat, lng)\n    );\n\nNext, load points into the database from a CSV file using the loader script.\n\n    go run loader/main.go \u003c input.csv\n\nSeveral command line options are available:\n\n| Flag | Default | Description |\n| --- | --- | --- |\n| -keyspace | density | Cassandra keyspace to load into |\n| -table | points | Cassandra table to load into |\n| -lat | 0 | CSV column index of latitude values |\n| -lng | 1 | CSV column index of longitude values |\n| -zoom | 18 | Zoom level to use for binning points |\n\nJust run the loader whenever you need to insert more data.\n\n### Serving Tiles\n\nOnce the data is loaded into Cassandra, the tile server can be run for rendering tiles on the fly.\n\n    go run server/main.go\n\n| Flag | Default | Description |\n| --- | --- | --- |\n| -keyspace | density | Cassandra keyspace to load from |\n| -table | points | Cassandra table to load from |\n| -zoom | 18 | Zoom level that was used for binning points |\n| -port | 5000 | Tile server port number |\n| -cache | cache | Directory for caching tile images |\n\n### Serving Maps\n\nA simple Leaflet map is provided to display a base map with the point tiles on top in a separate layer.\n\n    cd web\n    python -m SimpleHTTPServer\n\nThen visit [http://localhost:8000/](http://localhost:8000/) in your browser!\n\n### TODO\n\n- tile rendering options\n- multiple layers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2Fdensity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffogleman%2Fdensity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2Fdensity/lists"}