Coder Social home page Coder Social logo

Add a line/line-segment type? about geo HOT 7 CLOSED

georust avatar georust commented on June 13, 2024
Add a line/line-segment type?

from geo.

Comments (7)

TeXitoi avatar TeXitoi commented on June 13, 2024 1

I think here a line is a segment, composed of 2 coordinates.

from geo.

frewsxcv avatar frewsxcv commented on June 13, 2024

Is the distinction here that a Line is a series of Coordinates instead of a series of Points?

from geo.

frewsxcv avatar frewsxcv commented on June 13, 2024

(Aside: if you've written up the current direction of georust somewhere, I'd love a link!)

I don't have anything in writing really. I haven't done a great job at establishing a direction for rust-geo, other than saying it's a place for geospatial types and algorithms. I don't do much geospatial work anymore, and have been pretty busy with some other Rust projects, so if anyone has good ideas for the direction of this crate, let me know.

I had heard that it might be the plan to represent geo::types as traits; in which case this could either be its own trait or an implementation of LineString.

Traits would be cool, and I have a pull request open experimenting with them, but with the direction I was heading, it would have made the ergonomics significantly worse than they currently are, and I wasn't a fan of that. That's not to say traits aren't the way forward, they just might require more thinking.

Does it make sense to have a separate type for a Line, like https://github.com/paulmach/go.geo/blob/master/line.go (in that it is treated as a LineString for GeoJSON/WKT)?

I'm not really sure about this. For now, I've been very loosely following version 1.1.0 of the Simple Features spec

which has a data model that looks like:

screen shot 2017-03-18 at 4 11 44 pm

the latest version of the spec (v 1.2.1) has a data model that looks like:

screen shot 2017-03-18 at 4 11 51 pm

In that model, you'll see a Line type, which presumably corresponds to the type you're talking about. Maybe it makes sense to start modeling after v1.2.1? Does it make sense to follow a spec? Does it make sense to add all these new types? These are questions I don't know.

Sorry, that's not much of an answer, would appreciate any feedback here

from geo.

kestred avatar kestred commented on June 13, 2024

Disclosure: I'm also pretty new to GIS programming at this point, so take these opinions with some grains of salt.

Modelling the library according to the Simple Features specification seems like the best approach to take, because most GIS Databases support most (or some) of the specification.
I would definitely like to implement (or see implemented) an updated to the v1.2+ version of the spec (incorporating Z/M coordinates, open/closed, etc).

Following that plan, it doesn't make sense, at least initially, to include the Line/LinearRing/Triangle types because the specification describes them as non-instantiable; but also:

that the SFA-CA implementation standard assumes that a system handles these two types by means of added functionality that is not defined by the SFA-SQL


I'm thinking the final outcome might be:

  • Remove Coordinate type (should just be Point)
  • Have traits for Curve, Surface, MultiSurface, and MultiCurve
  • Have "core" types for Point, LineString, Polygon, MultiPoint, MultiPolygon, and MultiLineString
  • Have some extension with types (possibly in one of the other crates, or in a submodule) for Line, LinearRing since these types have distinct types in Spatial Schema (https://www.iso.org/standard/26012.html)

Still not sure whether Geometry should be a type (enum like you have now) or trait --- but this should probably just be based on the library's ergonomic needs.

from geo.

urschrei avatar urschrei commented on June 13, 2024

Some thoughts:

I'm in favour of compliance with a spec, but with an emphasis on "core" types, as above.
Some other things I'd like to see:

  • Distance methods for the core types (I'm working on a Rotating Calipers implementation which will solve this if I can make it work)
  • Union / Intersection / Etc as in #80 and #81. Vatti is probably a good fit here, and there are existing high-quality implementations in e.g. C++
  • Buffering. I haven't really looked into how to do this.

With the addition of the above, I feel like the library would cover most people's day-to-day needs (I haven't done much linear referencing or transformation, so I assume it's somewhat niche – this is obviously wrong)

  • FFI!

I'm also time-constrained, and will be until at least July (working on this project is a form of distraction for me), but I'm also conscious that we've made a lot of progress in the last 9 months or so, and I'd like to see this continue / expand. We could do a lot more in terms of finding new contributors, and the current quality of the code base and the reviews (@frewsxcv and @TeXitoi are fantastic) makes this a hugely valuable learning experience.

from geo.

frewsxcv avatar frewsxcv commented on June 13, 2024

A PR was opened last week with an implementation for Line: #118

from geo.

frewsxcv avatar frewsxcv commented on June 13, 2024

This was completed in #118

from geo.

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.