JuliaGeo / Geodesy.jl

Work with points defined in various coordinate systems.
MIT License
111 stars 24 forks source link

Package after install seems not to work correctly #17

Closed stochasticForest closed 8 years ago

stochasticForest commented 8 years ago

Hi there,

not sure if I'm doing anything wrong, after installing the package: Pkg.add("Geodesy") using Geodesy

I tried to compute the distance between two LLA points: Geodesy.distance(LLA(-27,153,0),LLA(-26.5,152,0)) ERROR:distancehas no method matching distance(::LLA, ::LLA)

and

Geodesy.distance(LLA(-27,153,0),LLA(-26.5,152,0),[datum = wgs84]) ERROR: wgs84 not defined

I'm using Julia 0.3.2 which is the latest official version on Debian Jessie. Where might I be going astray ?

Many thanks.

Update:

In the example given above I found that my problem was the integer values weren't matching the distance function types.

So I then used the code as given on the github page:

julia> x_lla = LLA(-27.468937, 153.023628, 0.0) LLA(-27.468937,153.023628,0.0)

julia> Geodesy.distance(x_lla,x_lla) ERROR:distancehas no method matching distance(::LLA, ::LLA)

So still no joy under Julia 0.3.2.

I downloaded a binary version of Julia 0.4.5

Computing a distance seemed to be successful;

julia> Geodesy.distance(x_lla,x_lla) 0.0

However using a datum still seems to fail: julia> Geodesy.distance(x_lla,x_lla,[datum = wgs84]) ERROR: No ellipsoid defined for datum [wgs84] in error at ./error.jl:21 in distance at /root/.julia/v0.4/Geodesy/src/distances.jl:14

So I think my issues are now:

Is this package compatible with Julia 0.3.2 ?

Is there a problem using datums under Julia 0.4.5 ?

Many thanks again.

c42f commented 8 years ago

The main problem is that the latest version (Geodesy-0.1.0) isn't compatible with julia-0.3, and that's the version which you're seeing the documentation for. If I recall, distance() doesn't even exists in Geodesy-0.0.1. This is just a symptom of things being in a state of flux at the moment with the package being heavily rewritten.

With julia itself being in heavy development, I'd really suggest you try 0.4 instead by grabbing the official downloadable package from julialang.org. Not only will it work with the latest Geodesy, but many other things will be a lot nicer to use!

stochasticForest commented 8 years ago

Thank you for your response, I'm not sure if you my update, I did get distance to work under 0.4.5, but there seemed to be a problem with specifying a datum in the distance function ?

andyferris commented 8 years ago

Hi @stochasticForest,

Just to confirm that I'm understanding the potential problem in Julia 0.4 and that we are on the same page - the [x = default] syntax is common shorthand (and definitely not verbatim Julia syntax) to mean an optional argument and its default value, so you can write either distance(lla1, lla2) or distance(lla1, lla2, wgs84) (which should give the same answer) or give a different datum like grs80.

What I think you typed eventually becomes equivalent to distance(lla1, lla2, [wgs84]) but the ellipsoid() function doesn't know what to do with an Array with a datum in it.

Try type distance(x_lla, x_lla, wgs84) and let me know if that works for you.

Andy

stochasticForest commented 8 years ago

Hi @andyferris,

thank you very much. Yes your understanding was exactly correct, through my unfamiliarity with Julia's syntax, I'd misinterpreted the function call form.

I can confirm distance works as advertised for me, thank you for taking the time to point out my mistake.

I should have spotted that from the other examples using the datum

andyferris commented 8 years ago

No worries. Please let us know if you have any other queries or issues.

c42f commented 8 years ago

Ah I didn't see the update when I was writing the above. Glad that it's sorted out.