Closed jotolo closed 4 years ago
Can you please provide the full error backtrace?
There is no error backtrace. The rest is from my code in my application because I'm getting the error from my specs :( I know this is not helpful, sorry.
It's crazy, now I got this:
NoMethodError:
undefined method `map' for false:FalseClass
Did you mean? tap
Somehow it receives false
somewhere deep in the internals, where other data expected. I don't see anything that uses y
method in the library's code, so it is either some underlying libraries, or your client code. Backtrace of the error (what exact chain of calls lead to it) could really help.
I'm going to check what longitude
and latitude
is passing as argument. I will let you know. Thank you!
I suppose it goes from GeoRuby
lib as there is underlying methods (with y
variable definition) which this lib is using.
@zverok Could you please, check @sfate comment?
@jotolo I really need more information for debugging, some reproducible test case or at least detailed backtrace to the place where the error really happens. It is really hard to guess otherwise
@zverok I've got some information for you. It's useful. It's kinda the same issue.
from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/wheretz-0.0.2/lib/wheretz.rb:49:in `lookup'
11: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/wheretz-0.0.2/lib/wheretz.rb:86:in `lookup_geo'
10: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/wheretz-0.0.2/lib/wheretz.rb:86:in `select'
9: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/wheretz-0.0.2/lib/wheretz.rb:87:in `block in lookup_geo'
8: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/wheretz-0.0.2/lib/wheretz.rb:87:in `any?'
7: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/wheretz-0.0.2/lib/wheretz.rb:87:in `block (2 levels) in lookup_geo'
6: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/georuby-2.5.2/lib/geo_ruby/simple_features/polygon.rb:97:in `contains_point?'
5: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/georuby-2.5.2/lib/geo_ruby/simple_features/polygon.rb:97:in `select'
4: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/georuby-2.5.2/lib/geo_ruby/simple_features/polygon.rb:97:in `block in contains_point?'
3: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/georuby-2.5.2/lib/geo_ruby/simple_features/linear_ring.rb:26:in `contains_point?'
2: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/georuby-2.5.2/lib/geo_ruby/simple_features/linear_ring.rb:26:in `select'
1: from /var/www/backend/vendor/bundle/ruby/2.5.0/gems/georuby-2.5.2/lib/geo_ruby/simple_features/linear_ring.rb:27:in `block in contains_point?'
NoMethodError (undefined method `>' for nil:NilClass)
PR created to fix this issue in georuby library.
@jotolo I am not sure it is a bug in GeoRuby per se... Maybe a bug in data. If I understand your PR correctly, that happens that in some of geometry features loaded from WhereTZ source files, there is some point that has x
or y
as nil
, right?.. I believe it is either of two:
nil
s)Either way:
WhereTZ#inside_multipolygon?
method code) which exact multypoligon with which exact point causes this behaviorcontains_point?
, to make sure neither of its @points
has nil
s instead of coordinates, but before that it definitely needs to be caught, when they can have it.@zverok Sorry about the late reply. In this log file you can find an example of the multipolygon and a point causing the issue. Also, the small backtrace was added to the file.
Please, let me know if you find the issue here. It's a strange issue regarding some nil
values.
Thanks in advance.
@jotolo Sorry about me replying lately myself, but I still don't quite get it :( Your logs say the problematic point is:
#<GeoRuby::SimpleFeatures::Point:0x0000562778bc1358 @srid=4326, @with_z=false, @with_m=false, @y=14.282239542427845, @x=-82.84276949121094, @z=0.0, @m=0.0>
(which means lat -82.84276949121094
, lng 14.282239542427845
)
But
WhereTZ.lookup(-82.84276949121094, 14.282239542427845)
# => "Antarctica/Troll"
It is really hard to hunt for the bug without reproducible case :(
@zverok Thanks for checking this out. It turns out this issue was caused by random and invalid data in this case. If someone else has issues like this one in the future make sure you're using correct longitude and latitude values.
This is happening randomly in some code I use everyday. Any ideas?