{"id":18739551,"url":"https://github.com/springmeyer/utfgrid-example-writers","last_synced_at":"2025-06-30T21:05:39.719Z","repository":{"id":2412496,"uuid":"3380436","full_name":"springmeyer/utfgrid-example-writers","owner":"springmeyer","description":"Simple reference implementations for creating UTGGrid tiles","archived":false,"fork":false,"pushed_at":"2012-02-12T18:37:28.000Z","size":341,"stargazers_count":17,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T21:25:36.309Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/springmeyer.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":"2012-02-07T19:06:45.000Z","updated_at":"2019-12-20T23:18:50.000Z","dependencies_parsed_at":"2022-09-09T17:11:47.940Z","dependency_job_id":null,"html_url":"https://github.com/springmeyer/utfgrid-example-writers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/springmeyer/utfgrid-example-writers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Futfgrid-example-writers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Futfgrid-example-writers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Futfgrid-example-writers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Futfgrid-example-writers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/springmeyer","download_url":"https://codeload.github.com/springmeyer/utfgrid-example-writers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Futfgrid-example-writers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262850259,"owners_count":23374352,"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-07T15:36:20.628Z","updated_at":"2025-06-30T21:05:39.668Z","avatar_url":"https://github.com/springmeyer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UTFGrid Example Writers\n\nSample implementations for writing UTFGrids.\n\nFor details on the UTFGrid spec see:\n\nhttps://github.com/mapbox/utfgrid-spec\n\n\n## Background\n\nThese examples are designed to be simple and with few dependencies.\n\nThey demonstrate how to author UTFGrids, but not how to serve them. For server implementations see:\n\nhttps://github.com/mapbox/utfgrid-spec/wiki/Implementations\n\nCurrently the only production-ready write implementation for UTFGrids is found inside Mapnik's\n[grid_renderer](https://github.com/mapnik/mapnik/tree/master/include/mapnik/grid) which\nwhich uses AGG rendering to quickly render a feature hit grid in a single pass over geometries.\nMapnik's [python](https://github.com/mapnik/mapnik/blob/master/bindings/python/python_grid_utils.hpp)\nor [node.js](https://github.com/mapnik/node-mapnik/blob/master/src/js_grid_utils.hpp)\nbindings can then be used to encode to UTFGrid format as JSON objects.\n\nBecause this Mapnik implementation is complex, and written in C++, simpler examples are needed\nthat prioritize simplicity and ease of understanding over rendering speed.\n\n\n## Reference Implementations\n\n1) ogr_renderer.py\n\nThis uses the [OGR library](http://www.gdal.org/ogr) and its python bindings to query\na polygon shapefile, build a pixel buffer of feature ids, and then encode those\nids in UTFGrid format.\n\nView a sample grid in your terminal by doing:\n\n    python ogr_renderer.py\n\nAnd pretty print the json like:\n\n    python ogr_renderer.py | python -mjson.tool\n\n2) mapnik_renderer.py\n\nThis sample matches the ogr example, but uses Mapnik's AGG-based scanline rendering of grid ids, which is sensitive to the exact styles applied to geometries - allowing it to work equally well for encoding interactive pixels of both points, lines, polygons, text, and svg/png symbols (their shape).\n\nThis example requires Mapnik \u003e= 2.0.0.\n\nView the sample output like:\n\n    python mapnik_renderer.py | python -mjson.tool\n\n\n3) fiona_rtree_renderer.py\n\nThis one uses an in memory rtree index to speed up the loop creating the grid, and a fiona collection to read the shapefile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringmeyer%2Futfgrid-example-writers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringmeyer%2Futfgrid-example-writers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringmeyer%2Futfgrid-example-writers/lists"}