Coder Social home page Coder Social logo

Support for (storing) altitude about orb HOT 6 OPEN

Jonas-Witt avatar Jonas-Witt commented on June 4, 2024 3
Support for (storing) altitude

from orb.

Comments (6)

paulmach avatar paulmach commented on June 4, 2024 1

The Point type is defined as a [2]float64 for performance reasons. Making it a []float64 would make a pointer to slice header with a pointer to data. much slower.

I think you could maintain a fork, or orb3, where point is [3]float64. I don't know if you could update all the helpers to be "generic", but that would be cool. Otherwise the libraries would not be cross compatible.

Some, solvable issues that come to mind:

  • It looks like tests would need to be update/rewritten as points become [0,0,0] (vs. [0,0]) in json.
  • wkt,wkb,ewkb would need to be checked they represent the extra point correctly.

Altitude could conditionally be marshaled whether it's non-zero.

I'm not sure I agree with this.

from orb.

martinrode avatar martinrode commented on June 4, 2024

We would also very much like that! So +1

from orb.

wenbert avatar wenbert commented on June 4, 2024

This would be https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1

A position is an array of numbers. There MUST be two or more
elements. The first two elements are longitude and latitude, or
easting and northing, precisely in that order and using decimal
numbers. Altitude or elevation MAY be included as an optional third
element.

Currently, when I do this:

// Create a GeoJSON LineString
lineString := orb.LineString{}

// Iterate through each result and add coordinates to the LineString
for _, result := range results {
    coordinate := orb.Point{result.Location.Lng, result.Location.Lat} // I want to add the 3rd value here; elevation
    lineString = append(lineString, coordinate)
}

I am not able to append the orb.Point{result.Location.Lng, result.Location.Lat, result.Elevation} (see 3rd value "elevation")

from orb.

scottbarnesg avatar scottbarnesg commented on June 4, 2024

I am also interested being able to add altitude to a GeoJSON point. I've scoured multiple available go libraries and haven't been able to find an implementation that supports this. I recognize that orb is a 2d library, that this is out of scope for 2d functionality, and I agree with @paulmach 's assessment about the performance implications.

That said, it seems a little silly to maintain a fork or start a new library just to get this feature. All I want to do is create a Point with altitude and add it to a GeoJSON Feature. Since it sounds like this isn't going to be implemented as part of orb, has anyone else found a viable library that supports this before I go roll my own implementation?

from orb.

martinrode avatar martinrode commented on June 4, 2024

has anyone else found a viable library that supports this before I go roll my own implementation?

I ended up using "https://github.com/twpayne/go-geom"

from orb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.