{"id":20039069,"url":"https://github.com/defra/os-map-ref","last_synced_at":"2025-05-05T07:32:31.561Z","repository":{"id":40469963,"uuid":"54545574","full_name":"DEFRA/os-map-ref","owner":"DEFRA","description":"OsMapRef is a tool to help handle UK Ordnance Survey map references, in particular to convert them to other coordinate systems","archived":false,"fork":false,"pushed_at":"2022-05-06T07:50:05.000Z","size":84,"stargazers_count":2,"open_issues_count":1,"forks_count":5,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-04-25T07:43:03.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEFRA.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2016-03-23T09:08:48.000Z","updated_at":"2022-05-05T22:18:54.000Z","dependencies_parsed_at":"2022-08-09T21:21:06.216Z","dependency_job_id":null,"html_url":"https://github.com/DEFRA/os-map-ref","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fos-map-ref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fos-map-ref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fos-map-ref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fos-map-ref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/os-map-ref/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224433536,"owners_count":17310531,"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-13T10:35:15.900Z","updated_at":"2024-11-13T10:35:16.368Z","avatar_url":"https://github.com/DEFRA.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OsMapRef\n\n![Build Status](https://github.com/DEFRA/os-map-ref/workflows/CI/badge.svg?branch=main)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_os-map-ref\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=DEFRA_os-map-ref)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_os-map-ref\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=DEFRA_os-map-ref)\n[![Gem Version](https://badge.fury.io/rb/os_map_ref.svg)](https://badge.fury.io/rb/os_map_ref)\n[![Licence](https://img.shields.io/badge/Licence-OGLv3-blue.svg)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)\n\nThis gem allows you to gather U.K. Ordnance Survey Eastings, North, and Map\nReferences from a range of text inputs.\n\n## Installation\n\nAdd this line to your application's Gemfile\n\n```ruby\ngem 'os_map_ref'\n```\n\nAnd then update your dependencies by calling\n\n```bash\n$ bundle install\n```\n\nOr install it yourself as\n\n```bash\n$ gem install os_map_ref\n```\n\n## Usage\n\nTo convert a map reference to eastings and northings\n\n```ruby\nlocation = OsMapRef::Location.for 'ST5880171043'\n\nlocation.easting       == 358801\nlocation.northing      == 171043\nlocation.map_reference == 'ST 58801 71043'\n```\n\nTo convert eastings and northings to a map reference\n\n```ruby\nlocation = OsMapRef::Location.for '358801, 171043'\n\nlocation.easting       == 358801\nlocation.northing      == 171043\nlocation.map_reference == 'ST 58801 71043'\n```\n\n### Handling short easting/northing input values\nIf the full input easting or northing value has fewer than six digits, for example a northing value for a location in the south of England, the input value should be left-zero-padded within the input string. For example:\n\n*Without* a leading zero on the northing input value, the map reference is for a location in Fife, Scotland:\n```ruby\nlocation = OsMapRef::Location.for '358801, 71043'\n\nlocation.easting       == 358801\nlocation.northing      == 710430\nlocation.map_reference == 'NO 58801 10430'\n```\n\nWhereas *with* a leading zero on the northing input value, the map reference is for a location in Dorset, England.\n```ruby\nlocation = OsMapRef::Location.for '358801, 071043'\n\nlocation.easting       == 358801\nlocation.northing      == 071043\nlocation.map_reference == 'SY 58801 71043'\n```\n\n### From OS Map Reference to Longitude and Latitude\n\nIf your end result needs to be longitude and latitude, you can combine the\nOsMapRef output with that of another gem called\n[global_convert](https://github.com/reggieb/global_convert)\n\nFor example\n\n```ruby\nrequire 'global_convert'\nrequire 'os_map_ref'\n\nos_location = OsMapRef::Location.for 'ST 58801 71043'\n\nlocation = GlobalConvert::Location.new(\n  input: {\n    projection: :osgb36,\n    lon: os_location.easting,\n    lat: os_location.northing\n  },\n  output: {\n    projection: :wgs84\n  }\n)\n\nputs \"Latitude = #{location.lat} in radians.\"\nputs \"Longitude = #{location.lon} in radians.\"\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing to this project\n\nIf you have an idea you'd like to contribute please log an issue.\n\nAll contributions should be submitted via a pull request.\n\n## License\n\nTHIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:\n\nhttp://www.nationalarchives.gov.uk/doc/open-government-licence/version/3\n\nThe following attribution statement MUST be cited in your products and applications when using this information.\n\n\u003e Contains public sector information licensed under the Open Government license v3\n\n### About the license\n\nThe Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.\n\nIt is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fos-map-ref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fos-map-ref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fos-map-ref/lists"}