paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
910 stars 103 forks source link

geojson.Geometry does not implement orb.Geometry (missing Bound method) #30

Closed gertcuykens closed 5 years ago

gertcuykens commented 5 years ago

For me it would make sense to be able to cast a geojson feature orb.Geometry to a geojson.Geometry?

var f *geojson.Feature
g := f.Geometry.(geojson.Geometry)

geojson.Geometry does not implement orb.Geometry missing

func (g Geometry) Bound() orb.Bound {
         // todo
    return orb.Bound{}
}

func (g Geometry) Dimensions() int {
    return 2
}

func (g Geometry) GeoJSONType() string {
    return g.Type
}

// Still don't understand why this private thing XD?
func (g Geometry) private() {}
gertcuykens commented 5 years ago

Never mind understanding why now from geojson readme that the cast need to be orb specific and there is no case for g := f.Geometry.(geojson.Geometry) to be useful

point := f.Geometry.(orb.Point)