Giter Site home page Giter Site logo

Comments (3)

mpadge avatar mpadge commented on June 12, 2024 1
library (geodist)
# example data
from <- matrix(rep(c(-0.193011, 52.15549),2), ncol = 2, byrow = TRUE)
to <- matrix(rep(c(-0.197722, 52.15395),2), ncol = 2, byrow = TRUE)
colnames(from) <- c("lon","lat")
colnames(to) <- c("lon","lat")

# Just first row of matrix
geodist::geodist(from[1, , drop = FALSE], to[1,, drop = FALSE], paired = TRUE, measure = "cheap")
#> [1] 363.9617
geodist::geodist(from[1, , drop = TRUE], to[1,, drop = TRUE], measure = "cheap")
#>          [,1]
#> [1,] 363.9617
# Both rows (gives **SAME** answer)
geodist::geodist(from, to, paired = TRUE, measure = "cheap")
#> [1] 363.9617 363.9617

Created on 2020-01-14 by the reprex package (v0.3.0)

It all came from if <...> else if <...> statements used to determine min & max values. If there is only one value, then the clause is only evaluated once, and only generates a min value while the max stays undefined (at an arbitrarily large value). I simply had to remove the else to leave 2 separate if statements in every case, so full ranges are evaluated even for single points. Thanks

from geodist.

mem48 avatar mem48 commented on June 12, 2024

@mpadge any update on when this might be fixed?

from geodist.

mpadge avatar mpadge commented on June 12, 2024

Oh, that had slipped off the radar - thanks @mem48, i'll get on to it asap

from geodist.

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.