Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Zone ¶
type Zone struct {
Number int // Zone number 1 to 60
Letter rune // Zone letter C to X (omitting O, I)
North bool // Zone hemisphere
}
Zone specifies the zone number and hemisphere
func LatLonZone ¶
LatLonZone returns the Zone for the provided coordinates
Example ¶
package main
import (
"fmt"
"github.com/TucarApp/utm"
)
func main() {
fmt.Println(utm.LatLonZone(50.77535, 6.008))
}
Output: 32U (north)
func LookupSRID ¶
LookupSRID returns a Zone by its EPSG/SRID code. Since the srid code only specifies the longitude zone number, the zone letter is left unset.
Example ¶
package main
import (
"fmt"
"github.com/TucarApp/utm"
)
func main() {
if zone, ok := utm.LookupSRID(32617); ok {
fmt.Println(zone)
}
}
Output: 17? (north)
func ParseZone ¶
ParseZone parses a zone number followed by a zone letter
Example ¶
package main
import (
"fmt"
"github.com/TucarApp/utm"
)
func main() {
if zone, ok := utm.ParseZone("4S"); ok {
fmt.Println(zone)
}
}
Output: 4S (north)
func ToUTM ¶
ToUTM convert a EPSG:4326 latitude/longitude to UTM.
Example ¶
package main
import (
"fmt"
"github.com/TucarApp/utm"
)
func main() {
easting, northing, zone := utm.ToUTM(50.77535, 6.008)
fmt.Println("Zone:", zone)
fmt.Printf("Easting: %f\n", easting)
fmt.Printf("Northing: %f\n", northing)
}
Output: Zone: 32U (north) Easting: 289059.493943 Northing: 5629111.846925
func (Zone) CentralMeridian ¶
CentralMeridian returns the zone's center longitude
func (Zone) ToLatLon ¶
ToLatLon converts UTM coordinates to EPSG:4326 latitude/longitude Note: the zone's North field must be correctly set, the letter is ignored
Example ¶
package main
import (
"fmt"
"github.com/TucarApp/utm"
)
func main() {
zone, _ := utm.LookupSRID(32632)
latitude, longitude := zone.ToLatLon(289059.493943, 5629111.846925)
fmt.Printf("Latitude: %f\n", latitude)
fmt.Printf("Longitude: %f\n", longitude)
}
Output: Latitude: 50.775350 Longitude: 6.008000
Click to show internal directories.
Click to hide internal directories.
