Skip to content

Commit

Permalink
docs: make example even clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 6, 2024
1 parent d60079d commit 1329037
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func ExamplePJ_Forward() {

// Convert Zürich's WGS84 latitude/longitude to Web Mercator.
zurich4326 := proj.NewCoord(47.374444, 8.541111, 408, 0)
fmt.Printf("initial: x=%.6f y=%.6f z=%.6f\n", zurich4326.X(), zurich4326.Y(), zurich4326.Z())

zurich3857, err := pj.Forward(zurich4326)
if err != nil {
panic(err)
Expand All @@ -48,6 +50,7 @@ func ExamplePJ_Forward() {
fmt.Printf("inverse: x=%.6f y=%.6f z=%.6f", zurich4326After.X(), zurich4326After.Y(), zurich4326After.Z())

// Output:
// initial: x=47.374444 y=8.541111 z=408.000000
// forward: x=950792.127329 y=6003408.475803 z=408.000000
// inverse: x=47.374444 y=8.541111 z=408.000000
}
Expand Down
3 changes: 3 additions & 0 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ func ExamplePJ_Forward() {

// Convert Zürich's WGS84 latitude/longitude to Web Mercator.
zurich4326 := proj.NewCoord(47.374444, 8.541111, 408, 0)
fmt.Printf("initial: x=%.6f y=%.6f z=%.6f\n", zurich4326.X(), zurich4326.Y(), zurich4326.Z())

zurich3857, err := pj.Forward(zurich4326)
if err != nil {
panic(err)
Expand All @@ -28,6 +30,7 @@ func ExamplePJ_Forward() {
fmt.Printf("inverse: x=%.6f y=%.6f z=%.6f", zurich4326After.X(), zurich4326After.Y(), zurich4326After.Z())

// Output:
// initial: x=47.374444 y=8.541111 z=408.000000
// forward: x=950792.127329 y=6003408.475803 z=408.000000
// inverse: x=47.374444 y=8.541111 z=408.000000
}

0 comments on commit 1329037

Please sign in to comment.