{"id":30824091,"url":"https://github.com/julianrojas87/tree-geocoder","last_synced_at":"2026-06-23T03:31:14.119Z","repository":{"id":41783839,"uuid":"257273579","full_name":"julianrojas87/tree-geocoder","owner":"julianrojas87","description":"A Node.js CLI and library for geocoding based on GeoNames data and the TREE traversal approach","archived":false,"fork":false,"pushed_at":"2022-12-11T02:39:21.000Z","size":263,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-19T15:10:37.275Z","etag":null,"topics":["geocoding","geonames","hypermedia","tree"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/julianrojas87.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":"2020-04-20T12:27:33.000Z","updated_at":"2020-10-20T11:49:00.000Z","dependencies_parsed_at":"2023-01-26T14:30:31.516Z","dependency_job_id":null,"html_url":"https://github.com/julianrojas87/tree-geocoder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/julianrojas87/tree-geocoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianrojas87%2Ftree-geocoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianrojas87%2Ftree-geocoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianrojas87%2Ftree-geocoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianrojas87%2Ftree-geocoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julianrojas87","download_url":"https://codeload.github.com/julianrojas87/tree-geocoder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianrojas87%2Ftree-geocoder/sbom","scorecard":{"id":541953,"data":{"date":"2025-08-11","repo":{"name":"github.com/julianrojas87/tree-geocoder","commit":"c7c88781d5b334b373d08e123115d6f4378c8419"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-7gc6-qh9x-w6h8","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r","Warn: Project is vulnerable to: GHSA-92xj-mqp7-vmcj","Warn: Project is vulnerable to: GHSA-wxgw-qj99-44c2","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-q674-xm3x-2926","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv","Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q","Warn: Project is vulnerable to: GHSA-crh6-fp67-6883"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T08:24:26.544Z","repository_id":41783839,"created_at":"2025-08-20T08:24:26.544Z","updated_at":"2025-08-20T08:24:26.544Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34674702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["geocoding","geonames","hypermedia","tree"],"created_at":"2025-09-06T11:12:19.532Z","updated_at":"2026-06-23T03:31:14.078Z","avatar_url":"https://github.com/julianrojas87.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tree-geocoder\n\n[![npm](https://img.shields.io/npm/v/tree-geocoder.svg?style=popout)](https://npmjs.com/package/tree-geocoder)\n\nA command line tool and library for geocoding based on the [TREE](https://github.com/TREEcg/specification#%E1%B4%9B%CA%80%E1%B4%87%E1%B4%87) traversal approach over [GeoNames](https://www.geonames.org/) and [OSMNames](https://osmnames.org/download/) data. The tool matches GeoNames and OSMNames entities using either **prefix** or **suffix-based** approaches. To foster interoperability, data entities are modeled using a [JSON-LD](https://www.w3.org/TR/json-ld11/) seralization based on the [GeoNames Ontology](http://www.geonames.org/ontology/ontology_v3.2.rdf) and the [OpenStreetMap Vocabulary](https://w3id.org/openstreetmap/terms#) respectively.\n\nPrefix-based geocoding means that, querying for `gent` will result in entities like Geonames's [`Gent`](https://sws.geonames.org/2797657/), [`Gentinnes`](https://sws.geonames.org/2797650/), [`Gentbrugge`](https://sws.geonames.org/2797652/) and OSM's [`Gent`](http://www.openstreetmap.org/relation/2524008), [`Genté`](http://www.openstreetmap.org/relation/111318), [`Gentil`](http://www.openstreetmap.org/node/702808885)  etc. On the other hand, suffix-based geocoding for `terdam` will result in entities such as [`Rotterdam`](https://sws.geonames.org/2747891), [`Amsterdam`](https://sws.geonames.org/2759794), [`Achterdam`](http://www.openstreetmap.org/way/6601361) and also fuzzy matched results like [`Overdam`](https://sws.geonames.org/2789433) and [`Veerdam`](http://www.openstreetmap.org/way/7098952). \n\nThe tool assigns a `score` to every matched entity based on the [Sørensen–Dice coefficient](https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient), which is calculated using the [`string-similarity`](https://www.npmjs.com/package/string-similarity) library. \n\nResults can be obtained as soon as possible in a streaming and unsorted way using the `--streaming` option (see example below) or can be awaited for a complete answer that will be sorted by `score`.\n\n Furthermore, this tool supports filtering options based on the minimum accepted score (e.g., `--minScore 0.7`) and entity properties (e.g., only entities that represent administrative regions:  `--filter \"geonames:featureClass geonames:A, osm:boundary osm:Administrative\"` ) .\n\n## Requirements\n\nThis tool requires [Node.js](https://nodejs.org/en/) v12.x or superior.\n\n## Geographic coverage\n\nUp until now, we support the following countries to perform geocoding queries:\n\n* **Prefix queries**: Austria, Belgium, Denmark, France, Germany, Great Britain, Greece, Italy, Luxembourg, Spain, Switzerland, The Netherlands and USA.\n* **Suffix queries**: Belgium, France and The Netherlands.\n\n## Command line interface\n\nInstall it:\n\n```bash\nnpm install -g tree-geocoder\n```\n\nUse the help option `-h` to see what are the possible uses:\n\n```bash\ntree-geocoder -h\nUsage: tree-geocoder [options] \u003cquery\u003e\n\nOptions:\n  --maxResults, \u003cmaxResults\u003e  Maximum amount of desired results\n  --minScore \u003cminScore\u003e       Minimum accepted score (based on Dice's coefficient) for matched results (value between 0 and 1)\n  --mode, \u003cmode\u003e              Select \"prefix\" or \"suffix\" for specific matching mode. Suffix-based matching will be done by default\n  --filter, \u003cfilter\u003e          Enter \"predicate object\" pairs (within double quotes and separated by comma) that would be matched over found entities. E.g., \"geonames:featureClass geonames:A, osm:boundary osm:Administrative, osm:hasTag 'addr:country=BE'\"\n  --streaming                 Get streaming results. Sorting by string similarity cannot be guaranteed with streaming results\n  -h, --help                  display help for command\n```\n\nUse it for a **prefix-based** geocoding query:\n\n```bash\ntree-geocoder --mode prefix --maxResults 5 your_query\n```\n\nUse it for a **suffix-based** geocoding query:\n\n```bash\ntree-geocoder --maxResults 10 your_query\n```\n\nGet results in a **streaming** way and pipe them into other applications:\n\n```bash\ntree-geocoder --streaming your_query | other_awesome_application\n```\n\n**Filter results** based on entity properties and string similarity. In this example we filter to have only streets and roads (of all kinds) having a `score` of 0.6 or higher:\n\n```bash\ntree-geocoder --minScore 0.6 --filter \"geonames:featureClass geonames:R, osm:highway '*'\" your_query\n```\n\nA **more specific filter** for only GeoNames water streams and OSM residential roads in France:\n\n```bash\ntree-geocoder --filter \"geonames:featureCode geonames:H.STM, geonames:countryCode geonames:FR, osm:highway osm:Residential, osm:hasTag 'addr:country=FR'\" your_query\n```\n\nRefer to the documentation of [Geonames classes](https://www.geonames.org/export/codes.html) and [OSM tags](https://wiki.openstreetmap.org/wiki/Map_Features) for more information on what is possible in the filtering option.\n\nAs an example on how the **results** of a query look see the following query for `entbru` which will include the following:\n\n```bash\ntree-geocoder entbru\n[\n  {\n      \"@id\": \"http://www.openstreetmap.org/way/7523153\",\n      \"https://w3id.org/openstreetmap/terms#name\": \"Meentbrug\",\n      \"score\": 0.7692307692307693,\n      \"https://w3id.org/openstreetmap/terms#highway\": \"https://w3id.org/openstreetmap/terms#Unclassified\",\n      \"http://www.w3.org/2003/01/geo/wgs84_pos#lat\": 5.19221665E1,\n      \"http://www.w3.org/2003/01/geo/wgs84_pos#long\": 4.4825865E0,\n      \"http://www.opengis.net/ont/geosparql#asWKT\": \"POINT (4.4825865 51.9221665)\",\n      \"https://w3id.org/openstreetmap/terms#hasTag\": \"addr:country=NL\",\n      \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\": \"https://w3id.org/openstreetmap/terms#Way\"\n  },\n  {\n      \"@id\": \"https://sws.geonames.org/2797652\",\n      \"http://www.geonames.org/ontology#countryCode\": \"http://www.geonames.org/ontology#BE\",\n      \"score\": 0.7142857142857143,\n      \"http://www.geonames.org/ontology#featureClass\": \"http://www.geonames.org/ontology#P\",\n      \"http://www.geonames.org/ontology#featureCode\": \"http://www.geonames.org/ontology#P.PPL\",\n      \"http://www.geonames.org/ontology#name\": \"Gentbrugge\",\n      \"http://www.opengis.net/ont/geosparql#asWKT\": \"POINT (3.76509 51.03692)\",\n      \"http://www.w3.org/2000/01/rdf-schema#isDefinedBy\": \"https://sws.geonames.org/2797652/about.rdf\",\n      \"http://www.w3.org/2003/01/geo/wgs84_pos#lat\": 5.103692E1,\n      \"http://www.w3.org/2003/01/geo/wgs84_pos#long\": 3.76509E0,\n      \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\": \"http://www.geonames.org/ontology#Feature\"\n  }\n  ...\n]\n```\n\n## Library\n\nThis tool can be used both in the backend (Node.js) and in the browser by means of a tool such as Webpack.\n\nInstall it in your project `npm install tree-geocoder`.\n\nThe `TreeGeocoder` class exposes the [AsyncGenerator](https://tc39.es/ecma262/#sec-async-generator-function-definitions) function `geocode()`, which can be used as follows:\n\nUse it **synchronously** and get **sorted** (by `score`) results:\n\n```js\nconst TreeGeocoder = require(\"tree-geocoder\");\n\nasync function runQuery() {\n    const tgc = new TreeGeocoder();\n    const opts = {\n        query: \"your_query\",\n        minScore: 0.6 // Optional. Values between 0 and 1 (higher means more similar)\n        maxResults: 10, // Optional\n        mode: \"prefix\", // Or don't define to get suffix-based results\n        filter: { // Optional. Define the predicate-object pairs that will be matched against each type of entity\n            \"https://w3id.org/openstreetmap/terms#\": { // Rules for OSM entities\n                \"https://w3id.org/openstreetmap/terms#highway\": \"https://w3id.org/openstreetmap/terms#Motorway\",\n                \"https://w3id.org/openstreetmap/terms#hasTag\": \"addr:country=BE\"\n            },\n            \"http://www.geonames.org/ontology#\": { // Rules for GeoNames entities\n                \"http://www.geonames.org/ontology#featureClass\": \"http://www.geonames.org/ontology#P\",\n                \"http://www.geonames.org/ontology#countryCode\": \"http://www.geonames.org/ontology#BE\"\n            }\n        }\n    };\n\n    const results = (await tgc.geocode(opts).next()).value;\n    console.log(results);\n}\n\nrunQuery();\n```\n\nOr consume it as a **stream** and get (unsorted) results as soon as possible:\n\n```js\nconst TreeGeocoder = require(\"tree-geocoder\");\n\nasync function runQuery() {\n    const tgc = new TreeGeocoder();\n    const opts = {\n        query: \"your_query\",\n        minScore: 0.6, // Optional. Values between 0 and 1 (higher means more similar)\n        maxResults: 100, // Optional\n        streaming: true,\n        filter: { // Optional. Define the predicate-object pairs that will be matched against each type of entity\n            \"https://w3id.org/openstreetmap/terms#\": { // Rules for OSM entities\n                \"https://w3id.org/openstreetmap/terms#highway\": \"https://w3id.org/openstreetmap/terms#Motorway\",\n                \"https://w3id.org/openstreetmap/terms#hasTag\": \"addr:country=BE\"\n            },\n            \"http://www.geonames.org/ontology#\": { // Rules for GeoNames entities\n                \"http://www.geonames.org/ontology#featureClass\": \"http://www.geonames.org/ontology#P\",\n                \"http://www.geonames.org/ontology#countryCode\": \"http://www.geonames.org/ontology#BE\"\n            }\n        }\n    };\n\n    for await (const result of tgc.geocode(opts)) {\n        console.log(result);\n    }\n}\n\nrunQuery();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianrojas87%2Ftree-geocoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulianrojas87%2Ftree-geocoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianrojas87%2Ftree-geocoder/lists"}