{"id":14036403,"url":"https://github.com/generalpiston/react-autosuggest-geocoder","last_synced_at":"2025-07-27T03:32:03.790Z","repository":{"id":79015628,"uuid":"77754553","full_name":"generalpiston/react-autosuggest-geocoder","owner":"generalpiston","description":"react-autosuggest with suggestions from pelias services, such as geocode.earth.","archived":false,"fork":false,"pushed_at":"2023-04-28T08:24:29.000Z","size":6569,"stargazers_count":15,"open_issues_count":4,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-25T14:26:04.542Z","etag":null,"topics":["address","address-autocomplete","autocomplete","autosuggest","demo","geocode-earth","mapzen","pelias","react","react-component"],"latest_commit_sha":null,"homepage":"https://abec.github.io/react-autosuggest-geocoder/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/generalpiston.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}},"created_at":"2016-12-31T20:06:58.000Z","updated_at":"2023-12-01T07:23:45.000Z","dependencies_parsed_at":"2024-04-16T06:48:00.389Z","dependency_job_id":null,"html_url":"https://github.com/generalpiston/react-autosuggest-geocoder","commit_stats":null,"previous_names":["abec/react-autosuggest-geocoder"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generalpiston%2Freact-autosuggest-geocoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generalpiston%2Freact-autosuggest-geocoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generalpiston%2Freact-autosuggest-geocoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generalpiston%2Freact-autosuggest-geocoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generalpiston","download_url":"https://codeload.github.com/generalpiston/react-autosuggest-geocoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214982087,"owners_count":15811653,"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":["address","address-autocomplete","autocomplete","autosuggest","demo","geocode-earth","mapzen","pelias","react","react-component"],"created_at":"2024-08-12T03:01:57.376Z","updated_at":"2024-08-12T03:04:37.554Z","avatar_url":"https://github.com/generalpiston.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# react-autosuggest-geocoder\n\n[react-autosuggest](https://github.com/moroshko/react-autosuggest) with suggestions from [pelias](https://github.com/pelias/pelias) services. Click [here](http://generalpiston.github.io/react-autosuggest-geocoder) to try it out.\n\n![react autosuggest example](https://generalpiston.github.io/react-autosuggest-geocoder/images/basic.gif)\n\nThank you to the team at [https://geocode.earth](https://geocode.earth) for lending a pelias service for the demo!\n\n## Setup / Usage\n\n### 1. Install react-autosuggest-geocoder\n\nThrough NPM:\n\n```\nnpm install --save react-autosuggest-geocoder\n```\n\nThrough Yarn:\n\n```\nyarn add react-autosuggest-geocoder\n```\n\n### 2. Create a react component that wraps react-autosuggest-geocoder\n\n```\nimport { ReactAutosuggestGeocoder } from 'react-autosuggest-geocoder'\n\nclass SearchPage extends React.Component {\n  constructor(props) {\n    super(props);\n\n    this.state = {\n      search: \"\",\n      latitude: Infinity,\n      longitude: Infinity\n    };\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cReactAutosuggestGeocoder\n          url='https://api.geocode.earth/v1'\n          apiKey='...'\n          onSuggestionSelected={(event, { search, suggestion, method }) =\u003e {\n            this.setState({\n              location: suggestion.properties.label,\n              latitude: suggestion.geometry.coordinates[1],\n              longitude: suggestion.geometry.coordinates[0]\n            })\n          }} /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n## Props\n\n| Prop | Type | Required | Default | Description |\n| :--- | :--- | :---: | :--- | :--- |\n| url | string | ✓ | https://api.geocode.earth/v1 | |\n| apiKey | string | ✓ | | Pelias service API key. Most useful with geocode.earth. See https://geocode.earth/ to get an API key. |\n| sources | string | ✓ | openaddresses | Filter data by data source. |\n| fetchDelay | number | ✓ | 150 | Debounce API requests with this delay (in milliseconds). |\n| center | object | | | Orient search results towards the provided center. |\n| bounds | array | | | Bounding box to limit search results. |\n| onSuggestionSelected | function | | | See https://github.com/moroshko/react-autosuggest#onSuggestionSelectedProp for details. |\n| onReverseSelected | function | | | Invoked after reverse geocoding is performed. |\n| getSuggestionValue | function | ✓ | Identity Function | See https://github.com/moroshko/react-autosuggest#getsuggestionvalue-required for details. |\n| renderSuggestion | function | ✓ | Div Wrapper Function | See https://github.com/moroshko/react-autosuggest#rendersuggestion-required for details. |\n| fetch | function | | `fetch` (from `node-fetch`) | Make the HTTP requests with this custom function\n\n## Ref Methods\n\n### reverseGeocode({ latitude, longitude })\n\nReverse geocode the given point into the component input text field.\n\n### update(newValue)\n\nUpdate the autocomplete input text field.\n\n### clear()\n\nClear the autocomplete input text field and deselect any previously selected values.\n\n### focus()\n\nBring browser focus to the autocomplete input text field.\n\n### blur()\n\nUnfocus browser from the autocomplete input text field.\n\n## License\n\nBSD-3\n\n## Special Thanks\n\nTo the folks at https://geocode.earth for their continued work on Pelias.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeneralpiston%2Freact-autosuggest-geocoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeneralpiston%2Freact-autosuggest-geocoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeneralpiston%2Freact-autosuggest-geocoder/lists"}