Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Updates README.md to explain the need to add a leading zero for easting/northing input values which are short because they are located in the first row/column of the grid.
Refer to #39
  • Loading branch information
PaulDoyle-EA authored May 6, 2022
1 parent 29bf217 commit f809bb3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ location.northing == 171043
location.map_reference == 'ST 58801 71043'
```

### Handling short easting/northing input values
If 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:

*Without* a leading zero on the northing input value, the map reference is for a location in Fife, Scotland:
```ruby
location = OsMapRef::Location.for '358801, 71043'

location.easting == 358801
location.northing == 710430
location.map_reference == 'NO 58801 10430'
```

Whereas *with* a leading zero on the northing input value, the map reference is for a location in Dorset, England.
```ruby
location = OsMapRef::Location.for '358801, 071043'

location.easting == 358801
location.northing == 071043
location.map_reference == 'SY 58801 71043'
```

### From OS Map Reference to Longitude and Latitude

If your end result needs to be longitude and latitude, you can combine the
Expand Down

0 comments on commit f809bb3

Please sign in to comment.