DeloitteOptimalReality / LightOSM.jl

A Julia package for downloading and analysing geospatial data from OpenStreetMap APIs.
https://deloitteoptimalreality.github.io/LightOSM.jl/docs
Other
48 stars 13 forks source link

More concise REPL output for GeoLocation #70

Closed jarodlam closed 2 years ago

jarodlam commented 2 years ago

The @with_kw macro has a very verbose output in the REPL by default:

julia> GeoLocation(-37.81841234315089, 144.95655834674835)
GeoLocation
  lat: Float64 -37.81841234315089
  lon: Float64 144.95655834674835
  alt: Float64 0.0

This is a problem when it is part of a struct e.g. Node:

julia> g.nodes[3306900957]
Node{Int64}(3306900957, GeoLocation
  lat: Float64 -37.8191237
  lon: Float64 144.9599131
  alt: Float64 0.0
, Dict{String, Any}("lanes" => 1, "maxspeed" => 45))

Solution is to define GeoLocation using the @with_kw_noshow macro instead of @with_kw. This gives an output more consistent with the rest of Julia:

julia> g.nodes[3306900957]
Node{Int64}(3306900957, GeoLocation(-37.8191237, 144.9599131, 0.0), Dict{String, Any}("lanes" => 1, "maxspeed" => 45))
codecov-commenter commented 2 years ago

Codecov Report

Merging #70 (28516ae) into master (9b46fc5) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #70   +/-   ##
=======================================
  Coverage   78.77%   78.77%           
=======================================
  Files          13       13           
  Lines        1046     1046           
=======================================
  Hits          824      824           
  Misses        222      222           
Impacted Files Coverage Δ
src/types.jl 57.69% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.