Code Monkey home page Code Monkey logo

Comments (5)

dazuma avatar dazuma commented on May 28, 2024

Confirmed, this is a bug. I'll get a fix out in RGeo 0.3.1 within the next day.

from rgeo.

haxney avatar haxney commented on May 28, 2024

Just to point out, I don't think my hack is the way it should be done, but just a way to get my specs to make it a bit farther before bailing :). Seeing as how there are a bunch of callers of Feature.cast(), that should probably be the place to solve this. Come up with the appropriate semantics for passing Feature.cast() a non-Feature and then define equals?, intersects?, crosses?, etc. in terms of that.

Or something. You obviously know the code a lot better than I do ;)

from rgeo.

dazuma avatar dazuma commented on May 28, 2024

I think the core issue here is that the == method is currently implemented as an alias of equals?, whereas they shouldn't have exactly the same semantics. The latter is one of the OGC relational predicates and should expect to be passed a geometry. (Otherwise, it should probably raise an ArgumentError or a TypeError.) Feature.cast similarly should expect to be passed a geometry and raise an appropriate exception accordingly. However, the former, ==, has further semantics in Ruby dealing with object equality (and it looks like Rails' fixture code is expecting that), so passing other types should still work (and return false).

The fix I checked in last night makes this separation. The == operator checks the type before passing control to equals?.

from rgeo.

haxney avatar haxney commented on May 28, 2024

I think the core issue here is that the == method is currently implemented as an alias of equals?, whereas they shouldn't have exactly the same semantics.

Makes sense. I don't have any familiarity with the OGC specs, so I don't have any opinion on that one way or the other.

The fix I checked in last night makes this separation.

Great! I'll look forward to a release with it included!

from rgeo.

dazuma avatar dazuma commented on May 28, 2024

RGeo 0.3.1 released with this fix.

from rgeo.

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.