{"id":20978035,"url":"https://github.com/longitude-one/geo-parser","last_synced_at":"2025-09-18T14:05:53.646Z","repository":{"id":227246480,"uuid":"770826822","full_name":"longitude-one/geo-parser","owner":"longitude-one","description":"Lexer and parser library for geographic point string values.","archived":false,"fork":false,"pushed_at":"2024-05-23T05:48:07.000Z","size":102,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T14:47:10.365Z","etag":null,"topics":["doctrine-orm","doctrine-spatial","geographic-data","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/longitude-one.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2024-03-12T08:28:15.000Z","updated_at":"2025-03-01T14:32:54.000Z","dependencies_parsed_at":"2024-04-27T07:42:53.483Z","dependency_job_id":"e71af5c0-5ad7-46a0-8ec4-ac1907b31198","html_url":"https://github.com/longitude-one/geo-parser","commit_stats":null,"previous_names":["longitude-one/geo-parser"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/longitude-one/geo-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longitude-one%2Fgeo-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longitude-one%2Fgeo-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longitude-one%2Fgeo-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longitude-one%2Fgeo-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longitude-one","download_url":"https://codeload.github.com/longitude-one/geo-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longitude-one%2Fgeo-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261632033,"owners_count":23187268,"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":["doctrine-orm","doctrine-spatial","geographic-data","php"],"created_at":"2024-11-19T05:03:33.599Z","updated_at":"2025-09-18T14:05:48.566Z","avatar_url":"https://github.com/longitude-one.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geographic parser: longitude-one/geo-parser\n\n![longitude-one/geo-parser](https://img.shields.io/badge/longitude--one-geo--parser-blue)\n![Stable release](https://img.shields.io/github/v/release/longitude-one/geo-parser)\n[![Packagist License](https://img.shields.io/packagist/l/longitude-one/geo-parser)](https://github.com/longitude-one/geo-parser/blob/main/LICENSE)\n\nLexer and parser library for geographic point string values.\n\n[![PHP CI](https://github.com/longitude-one/geo-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/longitude-one/geo-parser/actions/workflows/ci.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/395f661509f03ebed0ee/maintainability)](https://codeclimate.com/github/longitude-one/geo-parser/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/395f661509f03ebed0ee/test_coverage)](https://codeclimate.com/github/longitude-one/geo-parser/test_coverage)\n[![Coverage Status](https://coveralls.io/repos/github/longitude-one/geo-parser/badge.svg)](https://coveralls.io/github/longitude-one/geo-parser)\n![Minimum PHP Version](https://img.shields.io/packagist/php-v/longitude-one/geo-parser.svg?maxAge=3600)\n[![Tested on PHP 8.1 to 8.3](https://img.shields.io/badge/tested%20on-PHP%20%208.1%20|%208.2%20|%208.3-brightgreen.svg?maxAge=2419200)](https://github.com/longitude-one/geo-parser/actions)\n\n[![Downloads](https://img.shields.io/packagist/dm/longitude-one/geo-parser.svg)](https://packagist.org/packages/longitude-one/geo-parser)\n\n\u003e [!NOTE]\n\u003e This package is the continuation of the now abandoned [creof/geo-parser](https://github.com/creof/geo-parser) package.\n\n## Installation\n\n```bash\ncomposer require longitude-one/geo-parser\n```\n\n## Usage\n\nThere are two use patterns for the parser. The value to be parsed can be passed into the constructor, then parse()\ncalled on the returned ```Parser``` object:\n\n```php\n$input  = '79°56′55″W, 40°26′46″N';\n\n$parser = new Parser($input);\n\n$value = $parser-\u003eparse(); // [-79.948611111111, 40.446111111111]\n```\n\nIf many values need to be parsed, a single ```Parser``` instance can be used:\n\n```php\n$input1 = '56.242 E';\n$input2 = '40:26:46 S';\n\n$parser = new Parser();\n\n$value1 = $parser-\u003eparse($input1); //56.242\n$value2 = $parser-\u003eparse($input2); //-40.446111111111\n```\n\n## Supported Formats\n\nBoth single values and pairs are supported. Some samples of supported formats are below, though not every possible iteration may be explicitly specified:\n\n1. Simple single-signed values\n * 40\n * -40\n * -8.543\n * +132\n * +77.2\n\n2. Simple single signed values with degree symbol\n * 40°\n * -40°\n * -5.234°\n * +43°\n * +38.43°\n\n3. Single unsigned values with or without degree symbol, and cardinal direction\n * 40° N\n * 40 S\n * 56.242 E\n\n4. Single values of signed integer degrees with degree symbol, and decimal minutes with apostrophe\n * 40° 26.222'\n * -65° 32.22'\n * +165° 52.22'\n\n5. Single values of unsigned integer degrees with degree symbol, decimal minutes with apostrophe, and cardinal direction\n * 40° 26.222' E\n * 65° 32.22' S\n\n6. Single values of signed integer degrees with degree symbol, integer minutes with apostrophe, and optional integer or decimal seconds with quote\n * 40° 26' 46\"\n * -79° 58' 56\"\n * 93° 19' 25.8\"\n * +120° 19' 25.8\"\n\n6. Single values of signed integer degrees with colon symbol, integer minutes, and optional colon and integer or decimal seconds\n * +40:26:46\n * -79:58:56\n * 93:19:25.8\n\n7. Single values of unsigned integer degrees with degree symbol, integer minutes with apostrophe, optional integer or decimal seconds with quote, and cardinal direction\n * 40° 26' 46\" S\n * 99° 58' 56\" W\n * 44° 58' 53.9\" N\n\n7. Single values of unsigned integer degrees with colon symbol, integer minutes with, optional colon and integer or decimal seconds, and cardinal direction\n * 40:26:46 S\n * 99:58:56 W\n * 44:58:53.9 N\n\n8. Two of any one format separated by whitespace\n\n9. Two of any one format separated by a comma\n\n## Return\n\nThe parser will return an integer/float or an array containing a pair of these values.\n\n## Exceptions\n\nThe ```Lexer``` and ```Parser``` will throw exceptions implementing interface ```LongitudeOne\\Geo\\String\\Exception\\ExceptionInterface```.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongitude-one%2Fgeo-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongitude-one%2Fgeo-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongitude-one%2Fgeo-parser/lists"}