{"id":14036537,"url":"https://github.com/consbio/Leaflet.Geonames","last_synced_at":"2025-07-27T03:32:15.546Z","repository":{"id":25043110,"uuid":"28462883","full_name":"consbio/Leaflet.Geonames","owner":"consbio","description":"A GeoNames powered search control for Leaflet","archived":false,"fork":false,"pushed_at":"2020-08-09T17:19:23.000Z","size":90,"stargazers_count":35,"open_issues_count":0,"forks_count":9,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-04T07:46:22.715Z","etag":null,"topics":["geonames","leaflet"],"latest_commit_sha":null,"homepage":"http://consbio.github.io/Leaflet.Geonames/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/consbio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2014-12-24T21:52:23.000Z","updated_at":"2025-05-28T20:36:12.000Z","dependencies_parsed_at":"2022-08-23T15:40:21.706Z","dependency_job_id":null,"html_url":"https://github.com/consbio/Leaflet.Geonames","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/consbio/Leaflet.Geonames","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2FLeaflet.Geonames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2FLeaflet.Geonames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2FLeaflet.Geonames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2FLeaflet.Geonames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/consbio","download_url":"https://codeload.github.com/consbio/Leaflet.Geonames/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2FLeaflet.Geonames/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267294180,"owners_count":24065343,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"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":["geonames","leaflet"],"created_at":"2024-08-12T03:02:01.599Z","updated_at":"2025-07-27T03:32:15.297Z","avatar_url":"https://github.com/consbio.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Leaflet.Geonames\n\nA [GeoNames](http://www.geonames.org/) powered geocoding search control for Leaflet.\n\nIt allows you to enter a placename, display a list of search results using GeoNames,\nand select a placename to zoom to.\n\nLocation markers remain on the map until the search field is cleared.\nClick on icon to open / close unless `alwaysOpen` is set to true (in which case clicking on the icon does nothing).\n\nSee [examples](http://consbio.github.io/Leaflet.Geonames/examples/basic.html).\n\n\n\\*Tested with Leaflet 1.1.0\n\n## Install\n\nFrom NPM:\n\n```bash\nnpm install leaflet-geonames\n```\n\n## Usage\n\nInclude the CSS:\n\n```html\n\u003clink rel=\"stylesheet\" href=\"L.Control.Geonames.css\" /\u003e\n```\n\nThis control uses [Google Material Icons](https://design.google.com/icons) by default.\n\nInclude the JavaScript:\n\n```html\n\u003cscript src=\"L.Control.Geonames.min.js\"\u003e\u003c/script\u003e\n```\n\nExample usage:\n\n```javascript\nvar control = L.control.geonames({\n    //position: 'topcenter', // In addition to standard 4 corner Leaflet control layout, this will position and size from top center.\n    position: 'topleft',\n    geonamesSearch: 'https://secure.geonames.org/searchJSON', // Override this if using a proxy to get connection to geonames.\n    geonamesPostalCodesSearch: 'https://secure.geonames.org/postalCodeSearchJSON', // Override this if using a proxy to get connection to geonames.\n    username: '', // Geonames account username.  Must be provided.\n    maxresults: 5, // Maximum number of results to display per search.\n    zoomLevel: null, // Max zoom level to zoom to for location. If null, will use the map's max zoom level.\n    className: 'leaflet-geonames-icon', // Class for icon.\n    workingClass: 'leaflet-geonames-icon-working', // Class for search underway.\n    featureClasses: ['A', 'H', 'L', 'P', 'R', 'T', 'U', 'V'], // Feature classes to search against.  See: http://www.geonames.org/export/codes.html.\n    baseQuery: 'isNameRequired=true', // The core query sent to GeoNames, later combined with other parameters above.\n    showMarker: true, // Show a marker at the location the selected location.\n    showPopup: true, // Show a tooltip at the selected location.\n    adminCodes: {}, // Filter results by the specified admin codes mentioned in `ADMIN_CODES`. Each code can be a string or a function returning a string. `country` can be a comma-separated list of countries.\n    bbox: {}, // An object in form of {east:..., west:..., north:..., south:...}, specifying the bounding box to limit the results to.\n    lang: 'en', // Locale of results.\n    alwaysOpen: false, // If true, search field is always visible.\n    enablePostalCodes: true, // If true, use postalCodesRegex to test user provided string for a postal code.  If matches, then search against postal codes API instead.\n    postalCodesRegex: POSTALCODE_REGEX_US, // Regex used for testing user provided string for a postal code.  If this test fails, the default geonames API is used instead.\n    title: 'Search by location name or postcode', // Search input title value.\n    placeholder: 'Enter a location name' // Search input placeholder text.\n});\nmap.addControl(control);\n```\n\nFor mobile responsive view, use `position: 'topcenter'` and `alwaysOpen: true` options.\nSee [mobile example](http://consbio.github.io/Leaflet.Geonames/examples/mobileview.html)\nusing a mobile device or emulator.\n\n## Events\n\n### Search Event\n\nThis control fires a `search` event with the value of search parameters:\n\n`control.on('search', function(e){console.log(e.params)});`\n\nresults in\n`{q: \"oregon\", lang: \"en\"}`\n\n### Select Event\n\nThis control fires a `select` event when an option was selected from list,\nwith the full response JSON from geonames:\n\n`control.on('select', function(e){console.log(e.geoname)});`\n\nresults in\n`{adminCode1: \"OR\", lng: \"-120.50139\", geonameId: 5744337, ...}`\n\n## Demos:\n\n-   [Basic](examples/basic.html)\n-   [Admin Codes](examples/adminCodes.html)\n-   [Bounding Box](examples/bbox.html)\n-   [Locale](examples/locale.html)\n-   [Events](examples/events.html)\n-   [Mobile View](examples/mobileview.html)\n-   [Postal Codes](examples/postCodes.html)\n\n## Changes\n\nSee [changelog](CHANGES.md)\n\n## Credits:\n\nDeveloped with support from the [South Atlantic Landscape Conservation Cooperative](http://www.southatlanticlcc.org/), and maintained with support from [Peninsular Florida LCC](http://peninsularfloridalcc.org/).\n\nSome ideas derived from [L.GeoSearch](https://github.com/smeijer/L.GeoSearch).\n\n## Contributors:\n\n-   [Brendan Ward](https://github.com/brendan-ward)\n-   [Kaveh Karimi-Asli](https://github.com/ka7eh)\n-   [Nik Molnar](https://github.com/nikmolnar)\n-   [Mike Moran](https://github.com/mikemoraned)\n-   [Natasha Anisimova](https://github.com/anisimon)\n-   [Adam Mertel](https://github.com/adammertel)\n-   [Simon Legner](https://github.com/simon04)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsbio%2FLeaflet.Geonames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsbio%2FLeaflet.Geonames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsbio%2FLeaflet.Geonames/lists"}