-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating license, readme, and documentation
- Loading branch information
Showing
7 changed files
with
160 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
© Copyright and database rights Ordnance Survey Limited 2016, © Crown copyright and database rights Land & Property Services 2016 and/or © Ordnance Survey Ireland, 2016. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation and/or | ||
other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
go-osgb | ||
============ | ||
|
||
A Go library for performing accurate conversions between OS National Grid and GPS coordinates. (More technically, coordinate transformations between the OSGB36/ODN and ETRS89 geodetic datums) | ||
|
||
Why would I need this? | ||
------------ | ||
Geodetic transformations that assume perfect geometry lose precision on imperfect geoids (e.g. The Helmert transformation for ETRS89 to OSGB36/ODN has errors up to 5m). This library implements the definitive transformation developed by Ordnance Survey for converting between National Grid and GPS coordinates, resulting in very accurate conversions (average < 0.1m error). | ||
|
||
Features | ||
------------ | ||
- Supports OSTN02/OSGM02 and OSTN15/OSGM15 transformations | ||
- All transformation parameters are included in the library. No need to load additional files! | ||
- Fully tested against the conversion samples provided in the Ordnance Survey developer resources | ||
|
||
Installation | ||
------------ | ||
go get github.com/fofanov/go-osgb | ||
|
||
Usage | ||
------------ | ||
Converting from National Grid to GPS | ||
```go | ||
import ( | ||
"log" | ||
|
||
osgb "github.com/fofanov/go-osgb" | ||
) | ||
|
||
func main() { | ||
trans, err := osgb.NewOSTN15Transformer() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
easting := 400001.4 | ||
northing := 305001.4 | ||
height := 5.0 | ||
nationalGridCoord := osgb.NewOSGB36Coord(easting, northing, height) | ||
gpsCoord, err := trans.FromNationalGrid(nationalGridCoord) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Printf("%#v\n", gpsCoord) | ||
// &osgb.ETRS89Coordinate{Lon:-2.001408181413446, Lat:52.64276984554203, Height:55.34172940576156} | ||
} | ||
``` | ||
|
||
Converting from GPS to National Grid | ||
```go | ||
import ( | ||
"log" | ||
|
||
osgb "github.com/fofanov/go-osgb" | ||
) | ||
|
||
func main() { | ||
trans, err := osgb.NewOSTN15Transformer() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
lon := -0.1262 | ||
lat := 51.5080 | ||
height := 10.5 | ||
gpsCoord := osgb.NewETRS89Coord(lon, lat height) | ||
nationalGridCoord, err := trans.ToNationalGrid(gpsCoord) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Printf("%#v\n", nationalGridCoord) | ||
// &osgb.OSGB36Coordinate{Easting:530136.3274244666, Northing:180449.45428526515, Height:-35.04663654446814} | ||
} | ||
``` | ||
|
||
Coordinate Units | ||
------------ | ||
National Grid eastings, northings and ODN height are all in metres. | ||
GPS longitude and latitude are in decimal degrees. Height is in metres. | ||
|
||
Transformation Limits | ||
------------ | ||
The transformation is only accurately defined for onshore positions of British Islands. | ||
|
||
When using OSTNO2, transformations attempted for positions greater than 10km offshore will return an `ErrPointOutsidePolygon` error. | ||
|
||
OSTN15 will not return an error for offshore transformations, but precision is severely degraded, so usage is not recommended. However, straying outside the extents of the 700x1250km transformation grid completely will lead to an `ErrPointOutsideTransformation` error. | ||
|
||
I want to know more about the transformation | ||
------------ | ||
The full details can be found in the [developers section](https://www.ordnancesurvey.co.uk/business-and-government/help-and-support/navigation-technology/os-net/formats-for-developers.html) of the Ordnance Survey website. | ||
|
||
|
||
Roadmap | ||
------------ | ||
- [ ] Expose geoid regions for ODN heights | ||
- [ ] Support transformations on the Irish mainland | ||
|
||
License | ||
------------ | ||
This library is released under the BSD license, as are the transformation models provided by Ordnance Survey. Full details can be found in the LICENSE file. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters