{"id":19668843,"url":"https://github.com/andrerav/geohash.polyhasher","last_synced_at":"2026-06-12T19:31:12.766Z","repository":{"id":78459093,"uuid":"413203553","full_name":"andrerav/Geohash.PolyHasher","owner":"andrerav","description":"A .NET library and command line tool that converts geometries such as polygons and linestrings to optimized sets of geohashes.","archived":false,"fork":false,"pushed_at":"2021-10-15T19:41:53.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T04:18:22.869Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/andrerav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-10-03T21:41:56.000Z","updated_at":"2024-09-12T06:22:36.000Z","dependencies_parsed_at":"2023-04-23T19:33:17.708Z","dependency_job_id":null,"html_url":"https://github.com/andrerav/Geohash.PolyHasher","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/andrerav%2FGeohash.PolyHasher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerav%2FGeohash.PolyHasher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerav%2FGeohash.PolyHasher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerav%2FGeohash.PolyHasher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrerav","download_url":"https://codeload.github.com/andrerav/Geohash.PolyHasher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240978009,"owners_count":19887786,"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-11T16:37:55.660Z","updated_at":"2026-06-12T19:31:12.753Z","avatar_url":"https://github.com/andrerav.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geohash.PolyHasher\n\n# Introduction\nGeohash.Polyhasher is a .NET library and command line tool that converts geometries such as polygons and linestrings to optimized sets of geohashes. Try it out over at [https://lab.ramn.no/Tools/PolyHasher](https://lab.ramn.no/Tools/PolyHasher).\n\n# Download\n| Package | Link | Description |\n| ------- | ---- | ----------- |\n| Geohash.Polyhasher | [![image](https://img.shields.io/nuget/v/Geohash.Polyhasher.svg)](https://www.nuget.org/packages/Geohash.Polyhasher/) | Use this package to install Polyhasher as a library in your C#/.NET project. |\n| Geohash.Polyhasher.CLI | [![image](https://img.shields.io/nuget/v/Geohash.Polyhasher.CLI.svg)](https://www.nuget.org/packages/Geohash.Polyhasher.CLI/) | Use this package to install Polyhasher as a dotnet command line tool (see [CLI quickstart](#command-line-quickstart) below). You can install this tool using the command `dotnet tool install --global Geohash.Polyhasher.CLI`. |\n\n# Description\nGeohash.Polyhasher is a tool that can convert geometries such as linestrings, polygons, multipolygons and more to well-optimized sets of geohashes. If you are not familiar with the concept of geohashing, then you may want to familiarize yourself with the concept of geohashes first, and then come back here.\n\nTo understand what this library does, please look at this illustration that shows the input and output from this library:\n\n_TODO_\n\n# What can you do with Polyhasher?\nThis library is useful if you are working with spatial data and need to make computations such as finding all points within a polygon, but without using a spatial database and still retaining excellent performance. By encoding geometries as geohashes and using a prefix tree for lookup, you can achieve performance that is on par or better than using geospatial databases. \n\n# API Quickstart\n\nThe following example can be pasted directly into Program.cs in a .NET 6.0 or newer console application:\n\n```csharp\nusing Geohash.Polyhasher;\nusing NetTopologySuite.IO;\n\n// Define the polygon we wish to encode\nvar polygon = new WKTReader().Read(\"MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), \" +\n                                   \"((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), \" +\n                                   \"(30 20, 20 25, 20 15, 30 20)))\");\n\n// Create a new polyhasher instance\nvar polyhasher = new Polyhasher();\n\n// Returns a HashSet\u003cstring\u003e of 27 geohashes which encodes the multipolygon specified above\nvar geohashes = polyhasher.Encode(polygon, 2, PolyhasherMode.Intersects);\n```\n\nAlso see the provided [example project](https://github.com/andrerav/Geohash.PolyHasher/tree/main/src/Geohash.Polyhasher/Geohash.Polyhasher.Example).\n\n\n## API documentation\n\n[The full API documentation is available here](https://github.com/andrerav/Geohash.PolyHasher/tree/main/docs/MANUAL.md).\n\n# Command line quickstart\n\nInstall the CLI as a global .NET tool:\n\n```bash\ndotnet tool install --global Geohash.Polyhasher.CLI\n```\n\nCheck the available options:\n\n```bash\npolyhasher --help\n```\n\nEncode a polygon from standard input (WKT):\n\n```bash\necho \"POLYGON ((10 10, 12 10, 12 12, 10 12, 10 10))\" | polyhasher -p 6 -m Intersects -e Planar\n```\n\nEncode from a file instead of stdin:\n\n```bash\npolyhasher -f polygon.wkt -p 6 -m Intersects -e Planar\n```\n\nUse `Contains` mode (only hashes fully contained by the geometry):\n\n```bash\npolyhasher -f polygon.wkt -p 6 -m Contains -e Planar\n```\n\nUse geodesic edge handling (useful for large or long-distance geometries on the globe):\n\n```bash\npolyhasher -f polygon.wkt -p 6 -m Intersects -e Geodesic\n```\n\nUse densified edge handling (linearly densifies edges before relation checks):\n\n```bash\npolyhasher -f polygon.wkt -p 6 -m Intersects -e Densified\n```\n\nOutput geohashes together with each hash cell geometry as CSV:\n\n```bash\npolyhasher -f polygon.wkt -p 6 -m Intersects -e Planar -g true -h true -s \";\"\n```\n\nNotes:\n\n- Supported input format is WKT.\n- If `-f` is omitted, input is read from standard input.\n- Precision (`-p`) must be between 1 and 12.\n- Edge handling (`-e`) supports `Planar`, `Densified`, and `Geodesic`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrerav%2Fgeohash.polyhasher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrerav%2Fgeohash.polyhasher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrerav%2Fgeohash.polyhasher/lists"}