{"id":20400334,"url":"https://github.com/fschutt/street_index","last_synced_at":"2025-04-12T13:51:04.277Z","repository":{"id":57668793,"uuid":"143482292","full_name":"fschutt/street_index","owner":"fschutt","description":"Street index to CSV converter","archived":false,"fork":false,"pushed_at":"2018-09-24T19:03:14.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T23:07:11.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/fschutt.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}},"created_at":"2018-08-03T23:34:23.000Z","updated_at":"2023-09-17T04:36:52.000Z","dependencies_parsed_at":"2022-08-27T01:40:51.740Z","dependency_job_id":null,"html_url":"https://github.com/fschutt/street_index","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/fschutt%2Fstreet_index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschutt%2Fstreet_index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschutt%2Fstreet_index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschutt%2Fstreet_index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fschutt","download_url":"https://codeload.github.com/fschutt/street_index/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248575694,"owners_count":21127246,"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-15T04:39:37.078Z","updated_at":"2025-04-12T13:51:04.256Z","avatar_url":"https://github.com/fschutt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# street_index\n\n[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Build Status Linux / macOS](https://travis-ci.org/fschutt/street_index.svg?branch=master)](https://travis-ci.org/fschutt/street_index)\n[![Build status Windows](https://ci.appveyor.com/api/projects/status/0579ea95rbpliyhi?svg=true)](https://ci.appveyor.com/project/fschutt/street-index)\n[![Rust Compiler Version](https://img.shields.io/badge/rustc-1.26%20stable-blue.svg)]()\n\nThis library contains utility functions for generating a street index.\nHow it works is fairly simple: You give it a grid (right now limited \nto a rectangular grid) on a page, and add `StreetNameRect`s. Each \n`StreetNameRect` contains the String for the street / road name as well\nas the extents of the laid out String on the map.\n\nThe `Grid` takes care of assigning a grid position to your street name \nsuch as `\"Canterbury Road =\u003e A2\"`. Since usually maps have the problem\nof having duplicated road names (which is not what you'd want in a street \nindex), you can create a `DeduplicatedRoadNames::from_streets`, which will\ndeduplicate all road names.\n\nThe problem generally arises when street names are ambigouus. For example,\na street that appears in two locations on the map (such as a city having \nthe same street name as a neighbouring city). Because of this, street name\nprocessing can't be fully automated, since there are always weird edge cases \nto worry about. However, 90% of roads aren't like that.\n\nBecause of this limitation `DeduplicatedRoadNames::process()` gives you\ntwo types of roads back: `ProcessedRoadName` is for roads that span only\n1 or 2 grid cells (i.e. `\"Canterbury Road\" =\u003e A9`, `\"Canterbury Road\" =\u003e A9-A10`).\nIn these cases (which cover 90% of street index names), the mapping is not\nambigouus.\n\n`UnprocessedRoadName` is for anything else (e.g. `\"Canterbury Road\" =\u003e [A9, A10, E1, E2]`. \nUsually these roads need to be manually reviewed - it could likely be that \nthere are two roads `\"Canterbury Road\" =\u003e A9-10;E1-E2`, but it could also\nbe that the road is just one road and part of it is just clipped off the map,\nin which case you'd write `\"Canterbury Road\" =\u003e A9-E2`.  \n\nFor cartographic purposes, usually you want the output in CSV format, so\nthat your graphic designer can paste the street index into InDesign / \nIllustrator for the final map layout. Both `UnprocessedRoads` and \n`ProcessedRoads` have a simple `.to_csv` function for easy export.\n\n## Example\n\n```rust\nextern crate street_index;\n\nuse street_index::prelude::*;\n\nfn main() {\n\t// Create a grid, with the page extensions being 200 x 200 millimeter\n\t// Each cell is 20x20 millimeter large (usually 50x50 is recommended, though)\n    let mut grid = Grid::new(\n            Bbox { \n                width: Millimeter(200.0), \n                height: Millimeter(200.0) \n            },\n            GridConfig {\n                cell_width: Millimeter(20.0),\n                cell_height: Millimeter(20.0),\n            });\n\n    // You will have to calculate the street name boundaries yourself, i.e. \n    // using FreeType or RustType. Often times this will come as a side-effect \n    // of your map rendering / layouting program.\n    //\n    // The position is relative to the top left of the grid.\n    grid.insert_street(StreetNameRect {\n        street_name: String::from(\"Canterbury Road\"),\n        x_from_left: Millimeter(30.0),\n        width: Millimeter(50.0),\n        y_from_top: Millimeter(30.0),\n        height: Millimeter(8.0),\n    });\n\n    // We deduplicate the roads, i.e.:\n    //\n    // ```\n    // \"Canterbury Road\" =\u003e A3\n    // \"Canterbury Road\" =\u003e A4\n    // ```\n    // \n    // becomes:\n    // \n    // ```\n    // \"Canterbury Road\" =\u003e [A3, A4]\n    // ```\n    let deduplicated = DeduplicatedRoads::from_streets(\u0026grid.street_names());\n\n    // As described above, we get both processed and unprocessed \n    // road names back\n    let (processed, unprocessed) = deduplicated.process();\n\n    // In this case, \"Canterbury Road\" spans from B1-B2, so we get a \n    // `ProcessedRoad` back, delimited by a TAB character.\n    // \n \t// You can then write this to a CSV file if you want.\n    println!(\"processed:\\r\\n{}\", processed.to_csv(\"\\t\"));\n    println!(\"unprocessed:\\r\\n{}\", unprocessed.to_csv(\"\\t\"));\n}\n```\n\n## License\n\nThis library is licensed under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffschutt%2Fstreet_index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffschutt%2Fstreet_index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffschutt%2Fstreet_index/lists"}