Giveme5W1H icon indicating copy to clipboard operation
Giveme5W1H copied to clipboard

Geopy error

Open DebanjanaKar opened this issue 4 years ago • 1 comments

While trying to parse the following text, I get a Geopy Value error. Even if I pass it through a try-except block, the code stops processing the next text I have in the pipeline to be parsed.

text = "New volcano discovered. A new volcano has been discovered under the ice in Antarctica. The active volcano which is currently unnamed was discovered by a group of scientists who had installed seismometers in the area. It is the first volcano discovered under the ice in Antarctica. After the seismometers were installed in 2010 in the Marie Byrd Land west of the continent two swarms of earthquakes were detected." The error occurs in this line: doc = extractor.parse(doc)

Following is the error log:


/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/point.py:472: UserWarning: Latitude normalization has been prohibited in the newer versions of geopy, because the normalized value happened to be on a different pole, which is probably not what was meant. If you pass coordinates as positional args, please make sure that the order is (latitude, longitude) or (y, x) in Cartesian terms.
  return cls(*args)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/Giveme5W1H/extractor/extractor.py", line 20, in run
    extractor.process(document)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/Giveme5W1H/extractor/extractors/abs_extractor.py", line 41, in process
    self._evaluate_candidates(document)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/Giveme5W1H/extractor/extractors/environment_extractor.py", line 75, in _evaluate_candidates
    locations = self._evaluate_locations(document)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/Giveme5W1H/extractor/extractors/environment_extractor.py", line 215, in _evaluate_locations
    area = int(great_circle((bb[0], bb[2]), (bb[0], bb[3])).meters) * int(
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/distance.py", line 333, in __init__
    super().__init__(*args, **kwargs)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/distance.py", line 200, in __init__
    kilometers += self.measure(a, b)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/distance.py", line 336, in measure
    a, b = Point(a), Point(b)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/point.py", line 175, in __new__
    return cls.from_sequence(seq)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/point.py", line 472, in from_sequence
    return cls(*args)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/point.py", line 188, in __new__
    _normalize_coordinates(latitude, longitude, altitude)
  File "/home/Debanjana/anaconda3/envs/tf_gpu/lib/python3.7/site-packages/geopy/point.py", line 74, in _normalize_coordinates
    raise ValueError('Latitude must be in the [-90; 90] range.')
ValueError: Latitude must be in the [-90; 90] range.

Versions (please complete the following information):

  • OS: Ubuntu 16.04.
  • Python Version : 3.7.6
  • Giveme5W1H Version [e.g. 1.2] : 1.0.17
  • Stanford CoreNLP Version : stanford-corenlp-full-2017-06-09

Any help on how to resolve this error would be really helpful. Thanks.

DebanjanaKar avatar Jan 17 '21 04:01 DebanjanaKar

Hi. Based on the geocode error message I'm guessing that you are using a more recent version of the geocode package than what's set in requirements.txt.

You should use: geopy version 1.13.0.

lgov avatar Feb 17 '21 11:02 lgov