Code Monkey home page Code Monkey logo

Comments (5)

keithdoggett avatar keithdoggett commented on June 21, 2024 1

Got it you're using the Ruby implementation. I think since Geos is now returning either NULL a point or a polygon rather than a linestring as well like in older versions we can make this change to match. I can work on a fix in the next few days.

from rgeo.

keithdoggett avatar keithdoggett commented on June 21, 2024

What version of geos are you using? On 3.10 I'm seeing a polygon when I run this.

from rgeo.

yogeshsyn23 avatar yogeshsyn23 commented on June 21, 2024

I have not installed geos for this.
Correct me if i am wrong, but this method no where specifies explicit dependency on geos.
Also in the factory-compatibiltiy doc, LineString#envelope shows compatibilty with cartesian factory.

from rgeo.

yogeshsyn23 avatar yogeshsyn23 commented on June 21, 2024

@keithdoggett is there any update to this.
also can i help in fixing this.

from rgeo.

keithdoggett avatar keithdoggett commented on June 21, 2024

I've looked into it but haven't had time to write a PR. We need to change the envelope method in RGeo::Cartesian::GeometryMethods (

def envelope
BoundingBox.new(factory).add(self).to_geometry
end
) to match the definition given by Geos now.

Per Geos it can either return a polygon or a point (https://github.com/libgeos/geos/blob/a8d2ed0aba46f88f9b8987526e68eea6565d16ae/capi/geos_c.h.in#L3881-L3887), so we should just add a check for the returned geometry from the BoundingBox call and if it's a linestring, coalesce it into a polygon (probably by taking the points into an array).

i.e. something like this (haven't run this)

def envelope
        env = BoundingBox.new(factory).add(self).to_geometry
        if RGeo::Feature::LineString.check_type(env)
           boundary = factory.line_string([env.start_point, env.end_point, env.start_point, env.end_point])
           env = factory.polygon(boundary)
       end
       env
end

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.